Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-22-2005, 06:14 AM   PM User | #1
sunzini
New to the CF scene

 
Join Date: Jun 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sunzini is an unknown quantity at this point
window.open function

Hi, ive been studing javascript for a little bit, and ive been giving 9 exercise that involve createing a new window, each one of these has the same problem beacause there basically the same just adding more stuff as we go along.

my code is exactly like my handouts so it has to be somthing simple that the teacher forgot or is being sneaky, i dont want any drastic changes please.


----------------------function----------------------------------



function MakeA Win(){
win=window.open("","results","toolbar=yes,width=200,height=200,directories=yes
,status=yes,scrollbars=yes,resize=yes,menubar=yes");
win.document.write("<html><head><title>Window2</title></head>");
win.document.write("<body><h3 align=center>WindowOne</h3>");
win.document.write("</body></html>");}



--------------------------form button------------------------

<form action="">
<input type="submit" name="mywin" value="Create Window!"
onclick="MakeA Win()" />
</form>

----------------------------------------------------------------

this is just bugging me!

Last edited by sunzini; 03-22-2005 at 09:13 AM..
sunzini is offline   Reply With Quote
Old 03-22-2005, 07:16 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
What's your question? You didn't mention the problem you're talking about.

But judging from the script you posted, I can guess that the problem seems to be in the function name. Space is not allowed in function names. Is that a typo?
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 03-22-2005, 07:36 AM   PM User | #3
sunzini
New to the CF scene

 
Join Date: Jun 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sunzini is an unknown quantity at this point
it doesn't open a new window, try it yourself. And i dont think it's the space in the function name.
sunzini is offline   Reply With Quote
Old 03-22-2005, 07:50 AM   PM User | #4
warhammerdude20
Regular Coder

 
Join Date: Dec 2003
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
warhammerdude20 is an unknown quantity at this point
Aside from the function name, you haven't got a comma between
directories=yes and status=yes...
__________________
UNDER CONSTRUCTION
warhammerdude20 is offline   Reply With Quote
Old 03-22-2005, 08:39 AM   PM User | #5
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
And the button must be a regular button and not a submit button.

<input type="button" ...>


and document should be closed after the last document.write.

win.document.close();


The popup window may also be blocked by popup blocker installed in your system (if any)
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 03-22-2005, 09:11 AM   PM User | #6
sunzini
New to the CF scene

 
Join Date: Jun 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sunzini is an unknown quantity at this point
Unhappy

i tried all the suggestions and it still doesn't work. Could somebody try the javascript on their browser?

Im just wondering why my lecturer would make me do it this way.
sunzini is offline   Reply With Quote
Old 03-22-2005, 09:57 AM   PM User | #7
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Can you post the whole and final code of the page that you're working with? Also what browser are you using?
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 03-22-2005, 10:03 AM   PM User | #8
sunzini
New to the CF scene

 
Join Date: Jun 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sunzini is an unknown quantity at this point
sure, here it is. Im using firefox, but ive used opera, and IE


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>New Window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="standard.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" type="text/javascript">
<!--
function MakeA Win(){
win=window.open("","results","toolbar=yes,width=200,height=200,directories=yes
,status=yes,scrollbars=yes,resize=yes,menubar=yes");
win.document.write("<html><head><title>Window 2</title></head>");
win.document.write("<body><h3 align=center>Window One</h3>");
win.document.write("</body></html>");}

//-->
</script>
</head>
<body>
<form action="#">
<input type="submit" name="mywin" value="Create Window!"
onclick="MakeA Win()" />
</form>
</body>
</html>
sunzini is offline   Reply With Quote
Old 03-22-2005, 10:25 AM   PM User | #9
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Did you really follow all the suggestions?

If you remove the space in the function name and the newline between "directories=yes" and ",status=yes", it will work.

To debug, open the Tools->Javascript Console to see javascript errors. That will tell you the exact error and will help you fix it.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 03-22-2005, 10:33 AM   PM User | #10
sunzini
New to the CF scene

 
Join Date: Jun 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sunzini is an unknown quantity at this point
It works's that's great!

I must have given you the original version.

Because i tried it with the changes and it still didn't work. It must be my browser or somthing.

thanks for the help, it's appreciated
sunzini is offline   Reply With Quote
Old 03-22-2005, 10:39 AM   PM User | #11
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Or it must be the user, j/k

In the future, use the Javascript console to fix errors.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:40 AM.


Advertisement
Log in to turn off these ads.