Hi:
I am trying to open a window at a specific location on the screen and my code doesn't seem to be working, can someone please help?
Here is my code:
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE>
</TITLE>
<META NAME="Generator" CONTENT="TextPad 4.4">
<META NAME="Author" CONTENT="?">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<script type="text/javascript" src="Final Exam Question 7A and 7B.
js"></script>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">
<BR>Part 7a
<BR>10 marks<BR>
<table align="center">
<form name="f1">
<tr><td>
<ol>
<li>Select a file[list]
<li>YOU WILL NEED TO CREATE THOSE FILES
<li>the file names on the buttons below indicate what the files initial background colours should be.
</ul>
<li>Select its location on the screen
<li>Press the open window button.[list]
<li>The file should open in a window that is 200 by 200 with no tools.
</ul>
<li>Once open the user can then
<UL>
<LI>close the window using the same button they used to open it (the label
should then say close window)
<LI>change the background colour of that page.
<li>While open the small window should ALWAYS stay on top of the big window
</UL>
</ol>
<br>
<center>
<BR>Part 7b
<br>5 marks
</center>[list]
<LI>enter text in the input box and press a button to display it in a text box in the page being displayed in the new window and its status bar
<li>the buttons should not be clickable until the new window is open.
<LI>enter text in the input box of the page in the new window and press a button(on that page) to display text the window status bar of this big window
</ul>
</td></tr>
</table>
<BR>
<TABLE width="90%" border=1>
<TBODY>
<TR>
<TH>file
<TH>location
<TR>
<TD width="50%">
<INPUT type=button name="colour_butt1" value="red.htm" onClick="file_name='red.htm'">
<BR><INPUT type=button name="colour_butt2" value=blue.htm onClick="file_name='blue.htm'">
<BR><INPUT type=button name="colour_butt3" value=green.htm onClick="file_name='green.htm'">
<BR><INPUT type=button name="colour_butt4" value=yellow.htm onClick="file_name='yellow.htm'">
</TD>
<TD width="50%">
<INPUT type="button" value="top left" onClick="win_loc='left=0,top=0'">
<BR><INPUT type=button value="bottom left">
<BR><INPUT type=button value="top right">
<BR><INPUT type=button value="bottom right">
</TD>
</TR>
<TR>
<TD align=middle colSpan=2>
<INPUT type=button value="open window" name=button1 onClick="win_open()">
</TD>
</TR>
<TR>
<TD width="50%">
<CENTER>background colour</CENTER>
<INPUT type=button value=gold>
<BR><INPUT type=button value=purple>
<BR><INPUT type=button value=orange>
<BR><INPUT type=button value=white><BR>
</TD>
<TD width="50%">
<INPUT type=input>
<BR><INPUT type=button value="text in new windows' text box">
<BR><INPUT type=button value="text in new windows' status bar">
<BR><BR>also check if the field is not filled when a button is pushed
</TD>
</TR>
</TBODY>
</form>
</TABLE>
</BODY>
</HTML>
Javascript
alert("Starting script")
var file_name,win_loc;
function win_open()
{
window.status=win_loc
alert("File name is " + file_name + "Position is " + win_loc)
window.open(file_name,"colourwin","width=200,heigh t=200,win_loc")
window.open(file_name,"colourwin2","width=200,heig ht=200,top=0,left=0")
}
Thanks