F
funkychicken818
hi i have recently created a JavaScript DOM script and well for some
reason i t does not work.
can you help me find the problem?
here is the script
<!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>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div id="New_Input">
</div>
<input type="button" value="ADD" onclick="addfield();" />
</form>
<script language="javascript" type="text/javascript">
function addfield () {
// if this a non-DOM browser, bail out
if (document.getElementById) { return }
//Get the Input placeholder (<div id="New_Input">)
var Input_div = document.getElementById("New_Input");
//Create and add the Input to the form element
Input = document.write("<input type='text' value=''/>");
Input_div.appendChild(Input);
}
</script>
</body>
</html>
reason i t does not work.
can you help me find the problem?
here is the script
<!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>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div id="New_Input">
</div>
<input type="button" value="ADD" onclick="addfield();" />
</form>
<script language="javascript" type="text/javascript">
function addfield () {
// if this a non-DOM browser, bail out
if (document.getElementById) { return }
//Get the Input placeholder (<div id="New_Input">)
var Input_div = document.getElementById("New_Input");
//Create and add the Input to the form element
Input = document.write("<input type='text' value=''/>");
Input_div.appendChild(Input);
}
</script>
</body>
</html>