//创建DIV的脚本
var _loadDiv = "aaDIV";
var loadDiv = document.createElement("DIV");
loadDiv.id = _loadDiv;
document.body.appendChild(loadDiv);
//设置div样式
with (loadDiv.style) {
position = "absolute";
width = 150;
height = 100;
display = "";
}
----------------------------------------
我在body里面加了这么个DIV
当创建DIV时 指定 display = "" 的时候,DIV默认能显示出来,
而且我document.getElementById(_loadDiv).style.display = "none"时能隐藏,
document.getElementById(_loadDiv).style.display = "" 时能显示出来
-----
当创建DIV时 指定 display = "none" 的时候,DIV默认不显示出来,
我用document.getElementById(_loadDiv).style.display = ""时,死活也显示不出来
我测试了alert(document.getElementById(_loadDiv).style.width);等属性时,都是正确的
所以初始终为display = ""时怎么操作display都可以,初始终为display = "none"时怎么操作display 都不可以
请帮个忙,谢谢
var _loadDiv = "aaDIV";
var loadDiv = document.createElement("DIV");
loadDiv.id = _loadDiv;
document.body.appendChild(loadDiv);
//设置div样式
with (loadDiv.style) {
position = "absolute";
width = 150;
height = 100;
display = "";
}
----------------------------------------
我在body里面加了这么个DIV
当创建DIV时 指定 display = "" 的时候,DIV默认能显示出来,
而且我document.getElementById(_loadDiv).style.display = "none"时能隐藏,
document.getElementById(_loadDiv).style.display = "" 时能显示出来
-----
当创建DIV时 指定 display = "none" 的时候,DIV默认不显示出来,
我用document.getElementById(_loadDiv).style.display = ""时,死活也显示不出来
我测试了alert(document.getElementById(_loadDiv).style.width);等属性时,都是正确的
所以初始终为display = ""时怎么操作display都可以,初始终为display = "none"时怎么操作display 都不可以
请帮个忙,谢谢
解决方案 »
- javascript裡用button標籤時onclick不會觸發事件不會觸發事件不會觸發事件
- 求教js使用hta程序牧师能否操作本地数据库
- 怎么使用一个新打开的窗口保持在所有已打开窗口的最前面?
- 求表单验证的Javascript代码
- 突破限制IP访问的方法?难倒我了!
- 请问prototype.js的klass.prototype.constructor = klass;有什么用
- 请教各位大侠,如何将一个Select控件对消息的响应屏蔽?
- 询问一个很BT的JavaScript问题,高手进来,解决者全部给分!
- 简单的问题:为什么不响应alert(),程序如下!!
- js中有没有类似trim的函数?
- 由于该控件目前不可见、未启用或其类型不允许 因此无法将焦点移向它。
- 求一个类似outlook左侧的导航菜单,能产生二三级菜单,并且二三级菜单是在点击一级菜单栏时动态生成的
window.onload = function(){
document.getElementById("pad").style.display = "block";
}
</script>
<div id="pad" style="display:none;">xxx</div>
loadDiv.innerHTML="my div"
loadDiv.innerHTML这个无所谓,我本来的样式是这样的,带有黄色后背景来区分的
with (loadDiv.style) {
position = "absolute";
width = 100;
height = 100;
top = 150;
left = 100;
border = 1;
display = "";
background = "yellow";
fontsize = 5;
borderColor = "green";
}
默认display = "";时,这块黄色区域是可以显示出来的
就是默认display = "none"时,怎么也显示不出来
操作怎么也显示不出来(重新赋值成display = "")
var loadDiv = cDocument.createElement("DIV");
loadDiv.id = _loadDiv;
cDocument.body.appendChild(loadDiv);
//设置div样式
with (loadDiv.style) {
position = "absolute";
width = 100;
height = 100;
top = 150;
left = 100;
border = 1;
display = "none";
background = "yellow";
fontsize = 5;
borderColor = "green";
}
loadDiv.innerHTML = _loadStatMsg;这样是否就不为空?
var _loadDiv = "aaDIV";
var loadDiv = document.createElement("DIV");
loadDiv.id = _loadDiv;
document.body.appendChild(loadDiv);
with(loadDiv.style){
position = "absolute";
width = 100;
height = 100;
top = 150;
left = 100;
border = 1;
display = "";
background = "yellow";
fontsize = 5;
borderColor = "green";
display="none"
}
document.getElementById(_loadDiv).style.display="";
</script>
IETester for IE6测试正常