JavaScript To Display Error Message After the Form Object:
Example:
<script>
function check()
{
if(document.getElementById('sid').value=="")
{
document.getElementById('stxt').innerHTML="* Enter any Search Key word";
document.getElementById('stxt').style.color="red";
document.getElementById('sid').style.backgroundColor="yellow";
}
else
alert("Searching Result...");
}
</script>
</head>
<body>
<input type="text" name="searchtxt" id="sid" /><span id="stxt">*Require</span>
<br/>
<input type="button" value="Search" onClick="check()" />
</body>
Output:
*Require
Example:
<script>
function check()
{
if(document.getElementById('sid').value=="")
{
document.getElementById('stxt').innerHTML="* Enter any Search Key word";
document.getElementById('stxt').style.color="red";
document.getElementById('sid').style.backgroundColor="yellow";
}
else
alert("Searching Result...");
}
</script>
</head>
<body>
<input type="text" name="searchtxt" id="sid" /><span id="stxt">*Require</span>
<br/>
<input type="button" value="Search" onClick="check()" />
</body>
Output:
*Require
No comments:
Post a Comment