FRIHOSTFORUMSSEARCHFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

How to click an image/new window problem

 


Hobbit
I'm not too familiar with Javascript. I want to have an image to be clicked, and be sent to a new window that's a fixed size. I know how to do it if I have text, but I want an image.

Anyone know how to do it?
mathiaus
so you know all the jascript code? Saves me having to post it Razz
Code:
<a href="JAVASCRIPT STUFF HERE"><img src="IMG URL" alt="" /></a>

xhtml compliant as well
Hobbit
Well this is the code I used to have a text link open in a new window. I put that inside where it says 'javastuff stuff here' and it didn't work.

Code:
<a onclick="window.open('musicplayer/musicplayer.html', 'mywindow', 'width=309,height=223,resizable=no');" href="#">
Click Here To Open Music Player!</a>
LukeakaDanish
Mathaus forgot something...


Code:
<a href="javascript:JAVASCRIPT STUFF HERE" ><img src="IMG URL" alt="" /></a>
Hobbit
I'm confused. Can we start from the beginning and pretend I don't know how to open a new window in the first place?
Marston
Code:
<a href="javascript:window.open('musicplayer/musicplayer.html', 'mywindow', 'width=309,height=223,resizable=no');" href="#">
Click Here To Open Music Player!</a>
Hobbit
That's for a text link, I want an image. Lol. Laughing
aningbo
Code:
<a href="javascript:window.open('musicplayer/musicplayer.html', 'mywindow', 'width=309,height=223,resizable=no');" href="#">
<img src="image.gif" border="0"></a>


i hope this will do. good luck
Hobbit
That worked! Thank you so much. Check out www.bandoftheweek.com/botw.php to see it in action.
aningbo
oh well congratulations.... Wink
Stubru Freak
aningbo wrote:
Code:
<a href="javascript:window.open('musicplayer/musicplayer.html', 'mywindow', 'width=309,height=223,resizable=no');" href="#">
<img src="image.gif" border="0"></a>


i hope this will do. good luck


Seems to change the current page to a blank page with text [Object]. This will work:
Code:
<a href="javascript:window.open('musicplayer/musicplayer.html', 'mywindow', 'width=309,height=223,resizable=no');void(0);" href="#">
<img src="image.gif" border="0"></a>
Hobbit
That's true, and that did work. thanks again.
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.