FengShui1998
MIS
I am trying to change a button's color with javascript. The code works in IE but I believe it doesn't work in NS. Anybody have any ideas. Thanks,
Fengshui1998
-------------------
<html>
<body>
<form name="f1">
<input type="button" name="btn" value="red" style="background-color:red"
onclick="dothis()">
</form>
</body>
<script language="javascript">
function dothis() {
if (document.f1.btn.value=="red"{
document.f1.btn.value="green"
document.f1.btn.style.backgroundColor='green'
return
}
if (document.f1.btn.value=="green"{
document.f1.btn.value="red"
document.f1.btn.style.backgroundColor='red'
return;
}
}
</script>
</html> [sig][/sig]
Fengshui1998
-------------------
<html>
<body>
<form name="f1">
<input type="button" name="btn" value="red" style="background-color:red"
onclick="dothis()">
</form>
</body>
<script language="javascript">
function dothis() {
if (document.f1.btn.value=="red"{
document.f1.btn.value="green"
document.f1.btn.style.backgroundColor='green'
return
}
if (document.f1.btn.value=="green"{
document.f1.btn.value="red"
document.f1.btn.style.backgroundColor='red'
return;
}
}
</script>
</html> [sig][/sig]