通过JavaScript将输入框设置为只读
注意:readOnly中的O要大写
//页面初始化录入,判断指标说明是否为工资性支出。
function init() {
var mark = "<%=mark%>";
//如果指标说明为“工资性支出”,则工资支出那一项变为只读,且值为“指标可用金额”;其他录入框都不可录入。
if(mark!="" && mark=="工资性支出") {
document.getElementById("money0").readOnly = "true";
document.getElementById("money1").readOnly = "true";
document.getElementById("money3").readOnly = "true";
document.getElementById("forwhat0").readOnly = "true";
document.getElementById("forwhat1").readOnly = "true";
document.getElementById("forwhat3").readOnly = "true";
document.getElementById('money2').value = <%=budgetMoney[2]%>;
document.getElementById('money2').readOnly = "true";
} else {
//如果指标说明不为“工资性支出”,则工资支出那一项不可录入。
document.getElementById('money2').readOnly = "true";
document.getElementById('forwhat2').readOnly = "true";
}
}
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
test1.htnl
<script type="text/javascript">
function get(){
var ifr1 = window.parent.document.getElementById('test2Frm');
var b1 = ifr1.contentWindow.document.get ......
---->什么是类和对象
这是所有面向对象编程之前必须弄明白的.
所谓类:简单地说就是模板,说的专业一些,是一类具有某种性质的物的集合.比如:人就是一个类,车也是一个类,等等.
所谓对象:就是类的具体实现.如上面所说,人是一个类,一个具体的人就是一个对象,比如张三.
对象是类的实例化后的结果.ja ......
注意:Option中的O是要大写的,不然语法报错
1.动态创建select
function createSelect(){
var mySelect = document.createElement("select");
mySelect.id = "mySelect";
  ......
兼容IE、FireFox、Chrome
//加载js
function loadJs(){
if (!getObj('script_PlData')){
var scriptObj= document.createElement("script");
//scriptObj.id = 'script_1';
&nb ......