Check input box value in javascript
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function check()
{
var nf=document.getElementById('f').value;
var nl=document.getElementById('l').value;
alert(nf +" "+nl);
document.write(nf +" "+nl);
}
</script>
</head>
<body>
<form action="" method="">
F. Name:<input type="text" id="f"/><br/>
L. Name:<input type="text" id="l"/><br/>
<input type="submit" name="sub" id="n" onclick="check()"/><br/>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function check()
{
var nf=document.getElementById('f').value;
var nl=document.getElementById('l').value;
alert(nf +" "+nl);
document.write(nf +" "+nl);
}
</script>
</head>
<body>
<form action="" method="">
F. Name:<input type="text" id="f"/><br/>
L. Name:<input type="text" id="l"/><br/>
<input type="submit" name="sub" id="n" onclick="check()"/><br/>
</form>
</body>
</html>
Comments
Post a Comment