Pages

Sunday, April 22, 2012

Using javascript handling different page


<script language="javascript">
function check()
{
if(document.getElementById('login_type').value=='')
{
    alert('Please select a login type');
    return false;
}
if(document.getElementById('login_type').value=='emp')
{
window.location='emp_pg.php';
}
else
{
    window.location='other_pg.php';
}
}
</script>
Login Type :
<select name="login_type" id="login_type">
<option value="">-Please Select-</option>
<option value="emp">Employee</option>
<option value="other">Others</option>
</select>
<br>
Password : <input type="password">
<br>
<input type="button" value="submit" onclick="check();">