What I need help with:
My page shall take user input text, then show what was entered on the page (no alert) and open a new window on click if a match is found that would be stored in an array or var.
Here is the line I am having trouble with below:
onclick="insert(this.form.name.value),show();"/>
Here is the code thus far:
Input
var array = new Array();
function insert(val){
array[array.length]=val;
}
function show() {
var string="<b>All Element of the Array :</b><br>";
for(i = 0; i < array.length; i++) {
string =string+array[i]+"<br>";
}
if(array.length > 0)
document.getElementById('myDiv').innerHTML = string;
}
function open_win(){
window.open ,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no,
copyhistory=no, width=200, height=305")
}
</script>
</head>
<body>
<h2>Input</h2>
<form name="form1">
<table width="407">
<tr>
<td width="154" align="right"><b>Name</b>
<td width="9"><b> :</b>
<td width="224">
<input type="text" name="name"/>
</tr>
<tr>
<td width="154" align="right">
<td width="9">
<td width="224">
</tr>
<tr>
<td width="154" align="right">
<td width="9">
<td width="224">
<input type="button" Value="Print Name to page and open new window"
onclick="insert(this.form.name.value),show();"/>
</tr>
</table>
</form>
<div id="myDiv"></div>
</body>
Thank you for your help,
Michael