JavaScript Tutorials

Auto fill

Auto Fill
auto_fill.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=iso-8859-1" />
<title>Pop-up a new browser window</title>

<script language="javascript" type="text/javascript">
<!--
function popUpMyWindow () {
window.open("pop_up_auto_fill.html", "myWindowName", "width=250, height=210, scrollbars=yes, resizable=yes");
}
// -->
</script>

</head>
<body>
<form id="demoForm" name="demoForm" method="post" action="">
<input type="text" name="demoField" id="demoField" />
<a href="javascript:popUpMyWindow();">Click here</a></p>
</form>
</body>
</html>

pop_up_auto_fill.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=iso-8859-1" />
<title>Auto Fill</title>
<script language="javascript" type="text/javascript">
<!--
function demoAutoFill(demoContent) {
window.opener.document.demoForm.demoField.value = demoContent;
}
// -->
</script>
</head>

<body>
<ul>
<li><a href="javascript:demoAutoFill('Jane')">Jane</a></li>
<li><a href="javascript:demoAutoFill('John')">John</a></li>
<li><a href="javascript:demoAutoFill('Doe')">Doe</a></li>
</ul>
</body>
</html

JavaScript Tutorials
Other Tutorials