| Select Index Validation Using javaScript
|
|
Select Index validation:
Example
<html>
<head>
<script LANGUAGE="JavaScript">
function validation()
{
if(document.login.type.selectedIndex==0)
{
alert("Please select your member type");
document.login.type.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name="login" method="post" action="#" onsubmit="return validation();">
<select name="type" class="texta1">
<option name="sel" value="Selected">Select Type</option>
<option name="fr" value="Freshers">Freshers</option>
<option name="ex" value="Experienced">Experienced</option>
<option name="un" value="Under_Studying">Under_Studying</option>
</select>
</form>
</body>
</html>
|
|
|
The Output is Shown Here:
|
Drog and Drop Validation
Example
<html>
<head>
<script type="text/javascript">
function handleDragDropEvent(oEvent) {
var oTextbox = document.getElementById("txt1");
oTextbox.value += oEvent.type + "\n";
</script>
</head>
<body>
<P>Try dragging the text from the left textbox to the right one.</p>
<P>
<input type="text" value="drag this text"
ondragstart="handleDragDropEvent(event)"
ondrag="handleDragDropEvent(event)"
ondragend="handleDragDropEvent(event)" />
<input type="text"
ondragenter="handleDragDropEvent(event)"
ondragover="handleDragDropEvent(event)"
ondragleave="handleDragDropEvent(event)"
ondrop="handleDragDropEvent(event)" />
</p>
<P><textarea rows="10" cols="25" readonly="readonly" id="txt1"></textarea></p>
</body>
</html>
|
|
|
The Output is Shown Here:
|