Jump to content


JavaScript - check my work please, its not working -_-


1 reply to this topic

#1 lee890910

    Young Padawan

  • Members
  • Pip
  • 21 posts

Posted 01 May 2006 - 07:45 PM

this is what i had to do for this page.
i needed to open a new page, and place text that i write to the new page inside the paragraph marks, then change the paragraph line so that it sets the paragraph text to the font color specified by the customer, and finally, write 3 lines of information to the new page: name, email adress, and whether the customer wishes to be on the mailing list.
it seems like i have everything that follows these, but its not working. i just started javascript so although the work might seem lame or stupid, please fill me with your knowledge.
<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>Site Personal Preferences</title>
</head>

<script LANGUAGE="JavaScript">
<!--

function confirm()
{
var fcolor = fontBox;
var bgcolor = colorBox;
var w = window.open('');

//modify the following line of code
w.document.write("<p><font size='4' color=" + fcolor + ">");
w.document.write("Welcome");
w.document.write("</p>");
w.document.write("<p>");
w.document.write("Name: " + nameBox + ".<br>");
w.document.write("E-Mail: " + addrBox + ".<br>");
w.document.write("On Mailing List?: " + mailBox + ".<br>");
w.document.write("</p>");
w.document.bgColor = bgcolor;
}

//-->
</SCRIPT>

<body bgcolor="#FFFFFF">

<p align="center"><img
src="digiblab_banner.gif"
width="700" height="63"></p>

<p align="center"><font size="5">Sprocket Designs Personal
Preferences</font> </p>

<form method="POST" name=preferenceForm>
	<table border="0" width="700">
		<tr>
			<td align="right" width="350">Name or nickname: </td>
			<td width="350"><input type="text" size="22"
			name="nameBox"></td>
		</tr>
		<tr>
			<td align="right">Email address: </td>
			<td><input type="text" size="22" name="addrBox"></td>
		</tr>
		<tr>
			<td align="right">Do you wish to be placed on our mailing list?</td>
			<td><input type="text" size="22" name="mailBox"></td>
		</tr>
		<tr>
			<td align="right">Preferred font color: </td>
			<td><input type="text" size="22" name="fontBox"></td>
		</tr>
		<tr>
			<td align="right">Page background color: </td>
			<td><input type="text" size="22" name="colorBox"></td>
		</tr>
	</table>
	<p align="center"><input type="button" name="register"
	value="Register Preferences" 
	onClick = "confirm()" ></p>
</form>
</body>
</html>

Edited by lee890910, 01 May 2006 - 07:45 PM.


#2 Futingkiller

    Young Padawan

  • Members
  • Pip
  • 110 posts

Posted 02 May 2006 - 04:03 PM

put w.document.open(); before writing and
w.document.close () at the end.
write like this
document.preferenceForm.mailbox and the rest
put preferenceForm in " "
remove : method="POST" it's useless

Edited by Futingkiller, 02 May 2006 - 04:06 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users