日期:2014-05-19  浏览次数:20437 次

问一个关于浮动广告的问题,为什么在js代码里的input(text类型)不能自定义width和height啊?
问题同上。

以下是位于head中的js代码:
<script   language= "javascript ">
var   specialcode= " <DIV   id=UserLogon   style= 'left:   1px;   POSITION:   absolute;   TOP:   160px; '> <tbody> <TABLE   cellSpacing=0   cellPadding=0   width=120   style= 'border-left:1px   solid   #fdd576;border-top:1px   solid   #fdd576;border-right:1px   solid   #fdd576;font-size:12px;color:#000000;   border-bottom-color:#fdd576;   border-bottom-width:1px '> <TR   bgcolor=#fdd576> <TD   height=20> 用户登录 </TD> <TD   style= 'CURSOR:   hand '   onclick=UserLogon.style.visibility= 'hidden '   width=30> 关   闭 </TD> </TR> </TABLE> <table   border= '1 '   width= '120 '   height= '120 '   bordercolor= '#fdd576 '> <tr> <td   height= '30 '> <br> 用户名: <input   type= 'text '   name= 'uName '   width= '12 '> <br> <br> 密&nbsp;&nbsp;&nbsp;&nbsp;码: <br> <br> &nbsp;&nbsp; <input   type= 'submit '   name= 'btnOK '   width= '15 '   value= '登录 '   class= 'btn2 '> &nbsp;&nbsp; <input   type= 'submit '   name= 'btnReg '   width= '15 '   value= '注册 '   class= 'btn2 '> </table> </tbody> </DIV> ";
document.write(specialcode);lastScrollY=0;
function   heartBeat0()
{diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);
  if(percent> 0)percent=Math.ceil(percent);
  else   percent=Math.floor(percent);document.all.UserLogon.style.pixelTop+=percent;
  lastScrollY=lastScrollY+percent;}window.setInterval( "heartBeat0() ",1);
</script>

------解决方案--------------------
; <input type= 'submit ' name= 'btnOK ' style= 'width:15px ' value= '登录 '

html就没有width属性
------解决方案--------------------
width 和 height实际上是 样式表 属性
孟子老大 已解
------解决方案--------------------
实际上HTML中的任何元素都不应当在属性中定义width和height,这些都应在样式中定义