IE11不支持 onload吗?为什么我的问候语出不来
onload:
function greetUser() {
if (navigator.cookieEnabled)
userName = readCookie("irock_username");
if (userName)
alert("Hello " + userName + ", I missed you.");
else
alert('Hello, I am your pet rock.');
}
IE 11始终不能执行 ,初学JS 。请指教,谢谢!
function greetUser() {
if (navigator.cookieEnabled)
userName = readCookie("irock_username");
if (userName)
alert("Hello " + userName + ", I missed you.");
else
alert('Hello, I am your pet rock.');
}
IE 11始终不能执行 ,初学JS 。请指教,谢谢!
<head>
<title>iRock - The Virtual Pet Rock</title>
<script type="text/javascript" src="cookie.js"></script>
<script type="text/javascript">
var userName;
function resizeRock() {
document.getElementById("rockImg").style.height = (document.body.clientHeight - 100) * 0.9;
}
function greetUser() {
if (navigator.cookieEnabled)
userName = readCookie("irock_username");
//出现问题的地方
if (userName)
alert("Hello " + userName + ", I missed you.");
else
alert('Hello, I am your pet rock.');
}
function touchRock() {
if (userName) {
alert("I like the attention, " + userName + ". Thank you.");
}
else {
userName = prompt("What is your name?", "Enter your name here.");
if (userName) {
alert("It is good to meet you, " + userName + ".");
if (navigator.cookieEnabled)
writeCookie("irock_username", userName, 5 * 365);
else
alert("Cookies aren't supported/enabled in your browser, which means I won't remember you later. I'm sorry.");
}
}
document.getElementById("rockImg").src = "rock_happy.png";
setTimeout("document.getElementById('rockImg').src = 'rock.png';", 5 * 60 * 1000);
}
</script>
</head>
<body onload="resizeRock(); greetUser();" onresize="resizeRock();">
<div style="margin-top:100px; text-align:center">
<img id="rockImg" src="rock.png" alt="iRock" style="cursor:pointer" onclick="touchRock();" />
</div>
</body>
</html>
...全文
相关推荐
windowsserver 2008 IE8升级IE11.zip
ie升级 ie11完全离线安装,请注意: 适用于 Windows 2008 R2 SP1 ,升级到ie11. 整理好的全套安装包。
win11安装IE浏览器,win11修复IE11浏览器
win11安装IE浏览器,win11修复IE11浏览器
qtp11不支持IE9,需要安装补丁QTPWEB_0007
QTP11,IE9,win7操作系统,录制的时候总是报IE有错需要关闭 IE报错时的错误信息如下 此网页上的问题导致internet explorer关闭并重新打开该选项卡 解决此问题需要附件的补丁
IE11没有window.attachEvent方法处理方法
IE11没有window.attachEvent方法处理方法,文档中有详细说明
windowsserver 2008 IE8升级IE11-最新完整.rar
Win2008-ie-ie8升级 ie11完全离线安装,请注意: 适用于 Windows 2008 R2 SP1 ,升级到ie11. 整理好的全套安装包。



