Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

subWindow/button help

Status
Not open for further replies.

grayliner

Programmer
Feb 2, 2002
10
0
0
US
ok so when you click the prompt button it is supposed to launch a subwindow. all the arrays that are defined are for later in the project, right now i just need the subwindow to work so i can keep working on the project.

thanks

<html>
<head>
<script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>
<!-- Hide from older browsers.
//JavaScript code goes here.
alert(&quot;Display a message.&quot;)
//Stop hiding from old browsers. -->


var months = new Array(12)
months[0] = &quot;Jan.&quot;
months[1] = &quot;Feb.&quot;
months[2] = &quot;Mar.&quot;
months[3] = &quot;Apr.&quot;
months[4] = &quot;May&quot;
months[5] = &quot;Jun.&quot;
months[6] = &quot;Jul.&quot;
months[7] = &quot;Aug.&quot;
months[8] = &quot;Sep.&quot;
months[9] = &quot;Oct.&quot;
months[10] = &quot;Nov.&quot;
months[11] = &quot;Dec.&quot;

var days = new Array(7)
days[0] = &quot;Sunday&quot;
days[1] = &quot;Monday&quot;
days[2] = &quot;Tuesday&quot;
days[3] = &quot;Wednesday&quot;
days[4] = &quot;Thursday&quot;
days[5] = &quot;Friday&quot;
days[6] = &quot;Saturday&quot;

var seasons = new Array(4)
seasons[0] = &quot;Fall&quot;
seasons[1] = &quot;Winter&quot;
seasons[2] = &quot;Spring&quot;
seasons[3] = &quot;Summer&quot;

var browser = navigator.appName
var version = navigator.appVersion

function promptwindow() {
var promptwin = prompt(&quot;What is your name?&quot;,&quot;&quot;)
}

var newWindow
function makeNewWindow() {
newWindow=window.open(&quot;&quot;,&quot;&quot;,status,height=200,width=300&quot;)
}

function subWrite() {
if (newWindw.closed) {
makeNewWindow()
}
newWindow.focus()
var newContent = &quot;<html><head><title>Homework 2</title></head>&quot;
newContent += &quot;<body bgcolor='coral'><h1>This document is brand New.</h1>&quot;
newContent += &quot;</body></html>&quot;
newWindow.document.write(newContent)
newWindow.docment.close()
}






</script>
<title>right</title>
<meta name=&quot;author&quot; content=&quot;David Mudder&quot; />
<link rev=&quot;made&quot; title=&quot;author's e-mail&quot; href=&quot;mailto:klay2@juno.com&quot; />
</head>

<body bgcolor=&quot;#33CC00&quot; text=&quot;#000000&quot;>
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;&quot;>
Name:
<input type=&quot;text&quot; name=&quot;textfield&quot; />
<br />
Address:
<input type=&quot;text&quot; name=&quot;textfield2&quot; />

<br />
E-mail:
<input type=&quot;text&quot; name=&quot;textfield3&quot; />
<br />
Male:
<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;radiobutton&quot; checked />
<br />
Female:
<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;radiobutton&quot; />
<br />
Unsure:
<input type=&quot;radio&quot; name=&quot;radiobutton&quot; value=&quot;radiobutton&quot; />

<p>Free Magazine:
<input type=&quot;checkbox&quot; name=&quot;checkbox2&quot; value=&quot;checkbox&quot; />
<br />
Free Book:
<input type=&quot;checkbox&quot; name=&quot;checkbox3&quot; value=&quot;checkbox&quot; />
<br />
Free Pamphlet:
<input type=&quot;checkbox&quot; name=&quot;checkbox&quot; value=&quot;checkbox&quot; />
</p>

<input type=&quot;button&quot; name=&quot;button1&quot; value=&quot;Prompt&quot; onClick=&quot;promptwindow()&quot; />
<input type=&quot;button&quot; name=&quot;button2&quot; value=&quot;button2&quot; />
<input type=&quot;button&quot; name=&quot;button3&quot; value=&quot;button3&quot; />
<br />
<br />
<input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot; />
</form>
</body>
</html>
 
First, try fixing line 48, the first line of
Code:
function makeNewWindow()
...
Code:
    newWindow=window.open(&quot;&quot;,&quot;&quot;,status,height=200,width=300&quot;)
You see that? No starting quote for
Code:
&quot;status,height=200,width=300&quot;
. Keep in mind that when there's an unterminated string constant such as the one above, no functions after it are even considered, because there was an error on the page before they were declared.

As you said, first you want to get the prompt working. Fixing the problem mentioned above will put your prompt-launching function into existance and you will get a nice prompt popping up when you click the button.

Good luck on your project
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top