Javascript Help

Support, Discussion, Reviews
Post Reply
User avatar
Siji
Way too much time!
Way too much time!
Posts: 4040
Joined: November 11, 2002, 5:58 pm
Gender: Male
XBL Gamertag: mAcK 624
PSN ID: mAcK_624
Wii Friend Code: 7304853446448491
Location: Tampa Bay, FL
Contact:

Javascript Help

Post by Siji »

Looking for some simplified instructions on how to add a single line URL for the javascript window.open function/command thing..

I thought I had it down, but everytime I clicked on the link that would open the new window, it would do so.. and also change the source page to a blank page with just [object] for text on it.. Here's what I want to do:

Have a page with text and a link in the text that links to a picture that pops up in a window that is sized to the picture (specifying the window/image size in the html code) when the text is clicked on.

I thought the syntax was simple like

< a href="javascript:window.open('http://www.blah.com/img/image.jpg','win ... height=200')" >link text< /a >

*shrug*


As an added bonus, what's the command for the mouse-over 'tool tip' type text that pops up? (not in a new window, just text).
User avatar
Fash
Way too much time!
Way too much time!
Posts: 4147
Joined: July 10, 2002, 2:26 am
Gender: Male
XBL Gamertag: sylblaydis
Location: A Secure Location

Post by Fash »

best method is...

having a snip of javascript at the top of the file,

Code: Select all

<script language="JavaScript">
function popUp(URL,height,width) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=" + width + ",height=" + height + "');");
</script>
and then use

Code: Select all

<A HREF="javascript:popUp('http://www.whatever.com/whatever',200,200)" alt="pic name">Open the Popup Window</A>
and the tool-tip for links or images is set with the ALT tag.
Fash

--
Naivety is dangerous.
User avatar
Siji
Way too much time!
Way too much time!
Posts: 4040
Joined: November 11, 2002, 5:58 pm
Gender: Male
XBL Gamertag: mAcK 624
PSN ID: mAcK_624
Wii Friend Code: 7304853446448491
Location: Tampa Bay, FL
Contact:

Post by Siji »

Thanks for the javascript stuff, it worked.

I know about the alt text for links.. what I'm wanting is tool-tip type pop-up text for non-links though. Guess I could try using <a without an href link and just alt= in it..
Post Reply