0

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>
4

2 に答える 2

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}
于 2013-11-06T07:16:25.793 に答える