Computer Science Canada

Link that leads to a pop-up

Author:  poseidon [ Sun May 11, 2003 7:27 pm ]
Post subject:  Link that leads to a pop-up

I'm working on a site and I want a pop-up to appear when the user clicks a certain link.

eg. when the person clicks the link, a pop-up appears (the little customizable pop-ups that has the "OK" button), and when the user clicks "OK" the pop up closes and the browser links to another page.

Does any1 know the code for this? (if it exists)

Heres wat i have so far ....

a href="" onMouseover="alert('TEXT')">LINKTEXT</a

but I cannot actually get the browser to go to another page, I don't kno how to integrate the a href=URL> linktext</a into that code

Author:  octopi [ Sun May 11, 2003 8:26 pm ]
Post subject: 

I just quickly whipped this together:

code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function popup() {
  var URL = "http://www.google.com";
  alert("A popup window will appear...");
  popup = window.open(URL,"popup","");
}
</script>
</head>


<body>
  <a href="javascript:popup();">click</a>
</body>
</html>

Author:  octopi [ Sun May 11, 2003 8:35 pm ]
Post subject: 

errr.
On re-read I think I missed what you were saying, is this what you want?

code:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function leaving() {
  var URL = "http://www.google.com";
  alert("You are leaving my site...");
  window.location = URL;
}
</script>
</head>


<body>
    <a href="javascript:leaving();">click</a>
</body>
</html>

Author:  poseidon [ Sun May 11, 2003 11:48 pm ]
Post subject:  thx man

wow .. haha .... looking at ur code makes me feel like a true html newbie ... seems like I need to learn a lot more html

thx man ... exactly what I wanted .....

except .... I dont wanna be a nusiance but ... how do u get the linked url to open in another browser? so my initial page will still be there

thx again

Author:  poseidon [ Mon May 12, 2003 12:07 am ]
Post subject:  actually wait

I just tried it on my site, and for some reason it doesnt wrk .... the pop-up doesnt show ... and geocities(my host) ends up looking for a file

So far, I have


code:



<html>

<head>
<SCRIPT LANGUAGE="JavaScript">
function leaving() {
  var URL = "http://www.google.com";
  alert("You are leaving my site...");
  window.location = URL;
}
</script>
</head>



<body>
<text>

(My coding.  I omitted it because there's simply too much)


<a href="javascript:leaving();">click</a>

</text>
</body>
</html>




I was thinking, maybe the problem is in my placement of your coding or maybe .... href= " javacript:leaving() am I supposed to put a URL in there or something?

Also ... is there a way to put comments in html? (eg in turing, u use " % " in front of a statement to make it a comment)

Author:  octopi [ Mon May 12, 2003 12:26 am ]
Post subject: 

Here are some links, with the documents I uploaded on my server.
I included a html comment in them, so you can see. (included below too)

http://javascript.etw.ca
http://javascript.etw.ca/popup.html
http://javascript.etw.ca/alertlink.html



code:
<!--STUFF GOES HERE -->

Author:  Homer_simpson [ Mon May 12, 2003 12:33 am ]
Post subject:  Re: thx man

poseidon wrote:
wow .. haha .... looking at ur code makes me feel like a true html newbie ... seems like I need to learn a lot more html
you need to learn alot more java scripting not html... and CSS and dhtml are also very useful for webdesigning

Author:  poseidon [ Mon May 12, 2003 10:38 pm ]
Post subject:  thx

Thanks a lot man ... it wrked ...

I think there was an issue w/ geocities ..... cause when i put the same code onto my other host, it wrked perfectly .. but there was always somethign wrong when i used geocities ...

o yea .. can any1 suggest a good html tutorial? java tutorial?

anyways .... thx again

Author:  krishon [ Tue May 20, 2003 6:37 pm ]
Post subject: 

well u can start a new topic and i'll help u out wit some stuff u dun't know. i'm not and html god, as in i dun't know everythin there is to know, but i know a fair bit. Javascript i'm ok at gotta touch up. so nethin u need just holla.

Author:  hez [ Mon May 26, 2003 3:19 pm ]
Post subject: 

octopi wrote:
Here are some links, with the documents I uploaded on my server.
I included a html comment in them, so you can see. (included below too)

http://javascript.etw.ca
http://javascript.etw.ca/popup.html
http://javascript.etw.ca/alertlink.html



code:
<!--STUFF GOES HERE -->



Nicely Stated Wink we make newbies look bad Twisted Evil


: