js 设置 div 的宽度在firefox下如何实现 在 IE 下 可以这样些:document.getElementById("main").style.width = document.body.clientWidth - 194;但firefox 却不支持啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 document.getElementById("main").Attributes.Add("width",document.body.clientWidth - 194); 忘了attributes.add是C#的 你用document.getElementById("main").setAttribut("width",document.body.clientWidth - 194); 补充一点 setAttribute设置style和onclick这些属性在IE中是行不通的。所以在某些属性上我们必须这么写document.getElementById("testbt").className = "bordercss";document.getElementById("testbt").style.cssText = "color: #00f;";document.getElementById("testbt").style.color = "#00f";document.getElementById("testbt").onclick= function () { alert("This is a test!"); } document.getElementById("main").style.width = (document.body.clientWidth - 194) + "px"; 测试了,都不可行 ,3楼的只是在IE中有效,不支持firefox document.getElementById("main").style["width"]= (parseInt(document.body.clientWidth) - 194) + "px";不可能不行 需要给width的长度值加上一个单位, 4楼 6楼的都对。lz可以看看这个帖子:http://topic.csdn.net/u/20100714/20/759e2fc2-a619-42b8-a8e9-6fcab711f7cb.html?95241 希望对你有所帮助 关于区域滚动与元素定位问题 请问<%都是什么意思,我是初学者,不明白 IE缓存影响登陆问题 表头锁定可滚动的表格 - BizStruct 商业架构 关于jquery的on方法在动态改变元素class之后 关于关闭父窗口的方法,试了很多的不行 急!关闭页面的处理问题!请指教! 读cookie时报缺少对象 菜鸟提问,在线等待 Angular只是一个前端框架? js 如何 实现div 在限定范围内托动 给js赋值问题
你用document.getElementById("main").setAttribut("width",document.body.clientWidth - 194);
document.getElementById("testbt").className = "bordercss";
document.getElementById("testbt").style.cssText = "color: #00f;";
document.getElementById("testbt").style.color = "#00f";
document.getElementById("testbt").onclick= function () { alert("This is a test!"); }
document.getElementById("main").style.width = (document.body.clientWidth - 194) + "px";
不可能不行