![]() |
#2
aspic2009-12-27 15:23
|
这个东西不完全算是js程序……这只是我自己想的一个练习,就是鼠标指着按钮时按钮改变~但是又遇到可恶的问题……我知道我可能就是遇到了最不该遇到的愚蠢问题了,但我就是对着它看了1小时看不出问题所在~请好心的还记得自己初学时愚蠢样子的程序员们帮帮这个小忙吧,就当是扫盲好不?


<html>
<head>
<script language="JacaScript">
<!--
function changeButton(flag)
{
var buttonObj=document.getElementById("myButton");
if(flag==1)
{
buttonObj.style.backgroundColor = "lightBlue";
buttonObj.style.color = "black";
buttonObj.style.cursor = "pointer";
}
else
{
buttonObj.style.backgroundColor = "darkBlue";
buttonObj.style.color = "white";
buttonObj.style.cursor = "default";
}
}
//-->
</script>
<style>
#myButton
{
background-color:darkBlue;border:1px outset;color:white;
}
</style>
</head>
<body>
<div style="margin-top:10px;">
<input id = "myButton" type = "button" value = "check it" onmouseover = "changeButton(1)" onmouseout = "changeButton(0)">
</div>
</body>
</html>
<head>
<script language="JacaScript">
<!--
function changeButton(flag)
{
var buttonObj=document.getElementById("myButton");
if(flag==1)
{
buttonObj.style.backgroundColor = "lightBlue";
buttonObj.style.color = "black";
buttonObj.style.cursor = "pointer";
}
else
{
buttonObj.style.backgroundColor = "darkBlue";
buttonObj.style.color = "white";
buttonObj.style.cursor = "default";
}
}
//-->
</script>
<style>
#myButton
{
background-color:darkBlue;border:1px outset;color:white;
}
</style>
</head>
<body>
<div style="margin-top:10px;">
<input id = "myButton" type = "button" value = "check it" onmouseover = "changeButton(1)" onmouseout = "changeButton(0)">
</div>
</body>
</html>