My dele...dilemm...problem is this, when the html below is run, it will validate the forms's inputs. What I would then like to do after the validation is to open a formatted html doc in a popup window that shows the form's data. Could this be done with document.write? Also could all of this be done with a single button?
Thanks
===============
Thanks
===============
Code:
<html><head><title></title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function display() {
DispWin = window.open('','NewWin', 'toolbar=no,status=no,width=300,height=500')
message = "<ul><li><b>NAME: </b>" + document.myform.fname.value + "</ul>";
//add more later
DispWin.document.write(message);
}
// Preload images
var empty = new Image(); empty.src = "Pix/fieldempty.gif";
var email = new Image(); email.src = "Pix/emailerror.gif";
var zipcd = new Image(); zipcd.src = "Pix/ziperror.gif";
var phone = new Image(); phone.src = "Pix/phoneerror.gif";
var haveerrors = 0;
function showImage(imagename, imageurl, errors) {
document[imagename].src = imageurl;
if (!haveerrors && errors) haveerrors = errors;
}
function validateForm(f) {
haveerrors = 0;
(f.fname.value.length < 1) // validate first name length
? showImage("firstnameerror", "Pix/fieldempty.gif", true) // no semi-colon after this line!
: showImage("firstnameerror", "Pix/blankimage.gif", false); // true = errors, false = no errors
return (!haveerrors);
}
// End -->
</script>
</head>
<body>
<center>
<form method="get" ACTION="gpl1.html" name="myform" onSubmit="return validateForm(this)" >
<table border=0 cellspacing=0 celpadding=0>
<tr>
<td colspan=2>Enter your information:<br>
<sup>(<font color="#ff0000">*</font> denotes required field).</sup></td>
</tr>
<tr>
<td><p align=right>
First Name:</td>
<td>
<input type=text name="fname" size=25 maxlength=50><font color="#ff0000">*</font><br>
<img name=firstnameerror src="Pix/blankimage.gif" width=350 height=10 border=0></td>
</tr>
<tr>
<td><p align=center>
</td>
<td><p align=right>
<input type=submit value="Submit Form">
</td>
</tr>
</table>
</form>
</center>
</center><p>
</body>
</html>