View Full Version : confusing...


sakura_angel
01-20-2003, 05:06 AM
I can't seem to get the popup window to work... here's the code:

<script language="javascript">
//<!--
function popup()
{ window.open ("http://ca.geocities.com/citrinne_magic/index.html","popup","width=400,height=400,location=0,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=1,toolbar=0") }
-->
</script>
</head>
<a href=javascript:popup ('http://ca.geocities.com/citrinne_magic/index.html')><img src="http://ca.geocities.com/citrinne_magic/enter.jpg" border=0 width="235" height="105" alt="Click to enter!"></a>

Okay, it keeps on trying to open up "javascript:popup ('http://ca.geocities.com/citrinne_magic/index.html)" as a site. how do i stop it from doing that?

Dude128
01-20-2003, 05:08 AM
it should just be <a href="javasript:popup()">

sakura_angel
01-20-2003, 05:14 AM
it still doesn't work... it keeps on trying to open
http://ca.geocities.com/citrinne_magic/javasript:popup(http://ca.geocities.com/citrinne_magic/index.html)

Dude128
01-20-2003, 05:20 AM
could you post a link to the page that you're trying to open the popup from?

sakura_angel
01-20-2003, 05:20 AM
okay

http://ca.geocities.com/citrinne_magic/enter.html

sorry, i posted the wrong url a minute ago...

Dude128
01-20-2003, 05:24 AM
the popup code needs to go in the head section, and the <body> tag needs to be after the </head> tag...you have some tags mixed up.

sakura_angel
01-20-2003, 05:28 AM
still confused, cuz it still won't work. i'll post all the code this time.

<html>
<head>
<title>Click to Enter!</title>

<body bgcolor="#FFFFFF" text="indigo">

<script language="javascript">
//<!--
function popup()
{ window.open ("http://ca.geocities.com/citrinne_magic/index.html","popup","width=400,height=400,location=0,menubar=0,resizabl e=0,scrollbars=0,status=0,titlebar=1,toolbar=0") }
-->
</script>

<center><a href="javasript:popup()">
<img src="http://ca.geocities.com/citrinne_magic/enter.jpg" border=0 width="235" height="105" alt="Click to enter!"></a>

</head>
<body><br>Click to enter!
</body>
</html>

Dude128
01-20-2003, 05:33 AM
you now have two body sections and the <head> tag is misplaced.

remember that the page should be in this general format:
<html>
<head>
<title>Title</title>
JavaScript codes, etc. here
</head>
<body>
everything that gets displayed on the page goes here
</body>
</html>

sakura_angel
01-20-2003, 05:39 AM
i fixed the head and body tags, but it still doesn't fix the fact that the link opens up "javascript:popup".

btw, thanks for your help:) I'll try this popup thing tomorrow...

epolady
01-20-2003, 05:39 AM
I don't mean to intrude on Dude's thread, but I noticed the error.

Other than having the script in the <head>, you always have to make sure that Javascript is spelled correctly, in your HTML page, you have

<a href="javasript:popup()">

which should be

<a href="javascript:popup()">

sakura_angel
01-20-2003, 05:46 AM
thanks so much! it works! sometimes it's the stupidest things that make the code not work... (can't type:))