mozilla firefox不支持输入文本框

时间:2013-11-06 07:10:31

标签: html css

我有一个使用javascript创建的秒表,我使用html和css添加一个表。

我在chrome中测试它,当我在mozilla firefox中测试时,它的UI很好,输入文本框看起来很小。

 <script type="text/javascript">
var c=0;
var t;
var timer_is_on=0;

function timedCount()
{
document.getElementById('txt').value=c;
c=c+1;
t=setTimeout("timedCount()",1000);
}

function doTimer()
{
if (!timer_is_on)
  {
  timer_is_on=1;
  timedCount();
  }
}
function resetCount() {
     document.getElementById('txt').value =0;
    c =0;
}
function stopCount()
{
clearTimeout(t);
timer_is_on=0;
}
</script>
</head>

<body>
<form>
<center><table bgcolor="#000000">
<tr><td><center><h3 class="css">STOP WATCH</h3></center></td></tr>
<tr><td>
<input type="text" id="txt" size="50">
</td></tr><tr><td>
<input type="button" value="START COUNT" onClick="doTimer()" id="start" >

<input type="button" value="STOP COUNT" onClick="stopCount()" id="stop">
<input type="button" value="RESET COUNT" onClick="resetCount()" id="reset"> </td></tr></table></center>
</form>
</body>
</html>
<style>
#start
{
border-bottom-color:#006600;
background-color:#00FF33;
}
#stop
{
border-bottom-color:#006600;
background-color:#FF0000;
}
#reset
{
border-bottom-color:#006600;
background-color:#FFFF00;
}
.css
{
color:#FFFFFF;
}
</style>

2 个答案:

答案 0 :(得分:0)

在此处验证您的代码:http://validator.w3.org

在.css文件的顶部添加它,它将重置css,它应该在所有浏览器上看起来都一样。否则你的代码看起来很好。

/* Eric Meyer's Reset CSS v2.0 - http://cssreset.com */
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}

答案 1 :(得分:0)

如果您在Firefox上引用未填充填充宽度的输入文本,则可以将以下行添加到CSS脚本中:

input[type='text'] {
    width: 100%;
}

我不确定它是否只是一个复制和粘贴错误,但你也应该将样式放在head标签的某处。还没有打开html标签。