我在Javascript中有一段代碼來檢測屏幕的分辨率。 現在我的結果(1920 x 1080)站在一個文本框(輸入)內,但我只是希望它沒有文本框。我如何需要這樣做?Shot Javascript <script></script> not in TextArea
代碼:
<head>
<script type="text/javascript" language="javascript">
function scrResolution() {
var width = screen.width;
var height = screen.height;
document.getElementById("txt_scrWidth").value = width;
document.getElementById("txt_scrHeight").value = height;
}
</script>
</head>
<body onload="scrResolution();">
<table width="200" border="0">
<tr>
<td>
Width :
<input name="txt_scrWidth" type="text" id="txt_scrWidth" size="5" />
</td>
</tr>
<tr>
<td>
Height :
<input name="txt_scrHeight" type="text" id="txt_scrHeight" size="5" />
</td>
</tr>
</table>
</body>
</html>
我在這裏看不到一個textarea .. – darma
@darma我猜他的意思了'input's –
我不是確定「站在文本區域內」是什麼意思,你的意思是這些值顯示在你的輸入內部嗎? – jbabey