[CODE]<html>
<head>
<script>
function dt(){
var dt = new Date();
document.getElementById(“time”).innerHTML=dt;
}
function changeBgColor1(){
document.getElementById(“bgc”).style.backgroundColor=’#ee0000′;
}
function changeBgColor2(){
document.getElementById(“bgc”).style.backgroundColor=’#880099′;
}
function changeBgColor3(){
document.getElementById(“bgc”).style.backgroundColor=’#888888′;
}
function validate(){
var a = document.getElementById(“input1”).value;
var b = /[abcdef]/;
if(b.test(a)){
return true;
}
else {
alert(“invalid character”);
}
}
</script>
<style>
#bgc{
width:300px;
height:100px;
background-color:#cccccc;
font-weight:bold;
color:#ff00ff;
}
#time{
width:300px;
height:50px;
background-color:#aabb00;
}
</style>
</head>
<body onload=”dt()”>
<p id=”time”> </p>
<p id=”bgc” onmouseover=”changeBgColor1()” onmouseout=”changeBgColor2()” onclick=”changeBgColor3()”>
Hi There, pls change bg color
</p>
<form id=”form1″ onsubmit=”validate()”>
<input id=”input1″ type=text />
<input id=”input2″ type=”submit” value=”Submit” />
</form>
</body>
</html>
validate function does not work with IE or Firefox, it always returns true, even if some digits are entered in input box (which should not be validated by regexp). Why does regexp not work ? How to make it work ?
Thanks