62,046
社区成员
发帖
与我相关
我的任务
分享
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script>
function Test() {
if (document.getElementById("bgImg").style.backgroundImage.indexOf('Jellyfish.jpg') > 0) {
document.getElementById("bgImg").style.backgroundImage = "url('bg_img.jpg')";
}
else {
document.getElementById("bgImg").style.backgroundImage = "url('Jellyfish.jpg')";
}
}
</script>
</head>
<body id="bgImg" >
<form id="form1" runat="server">
<div>
<input type="button" id="btn" onclick="javascript:Test();" value="更换" />
</div>
</form>
</body>
</html>