我有一個按鈕,當它被點擊時它會調用一個獲取瀏覽器大小的警報,但它只是表示undefined x undefined。如果我刪除功能部件,那麼它將正常工作。我如何使它與點擊按鈕一起工作?使用HTML頁面獲取瀏覽器大小
<input type="button" onclick="alertME()" value="Finish">
<script>
function alertME()
{
alert (screen.width + 'x' + screen.height);
}
</script>
您正在使用哪種瀏覽器?以上代碼適用於Chrome和Firefox。 – ram1
檢查http://www.javascripter.net/faq/browserw.htm –
我正在使用firefox – Joe24