PDA

View Full Version : open in new window...


The Wizzard
09-04-2002, 12:08 AM
I have this code for a table cell rollover, how do i make it open in a new window?

<td onMouseOver="background='images/bar_bg_lightgray.jpg'" onClick="window.location='?j=home'" style="cursor:hand" onMouseOut="background='images/bar_bg.jpg'" width="10%" valign="middle">Home</td>

Thanks

Nightfire
09-04-2002, 03:01 AM
onClick="window.open='?j=home'"

?

The Wizzard
09-04-2002, 03:17 AM
I was thinking the same thing, but it didnt work... :(

wontgetlost
09-04-2002, 03:56 AM
Based on the above noted code you would need an anchor first:
a href=
Then you can place the onclick function in the anchor.

a href="javascript:void(null);" onClick='window.open("home.htm","_blank","hotkeys=1,directories=1,toolbar=1,titlebar=1,status=1,location=1,status=1,menubar=1,top=90,left=90,w idth=450,height=235,scrollbars=1,resizable=1");'

The Wizzard
09-04-2002, 08:41 PM
Sorry, that doesnt work...

wontgetlost
09-04-2002, 09:01 PM
Originally posted by The Wizzard
Sorry, that doesnt work...

I put your code together with 2 images. What's not working is the background image swap onmouseover. Could you please post a link to what you have so far and then I should be able to fix it for you.

The Wizzard
09-04-2002, 09:29 PM
http://www.enemydown.org/ia

wontgetlost
09-04-2002, 10:23 PM
I tested it and it works:



<a href="javascript:void(null);" onclick='window.open("home.htm","0","0");'><TD onmouseover="background='images/bar_bg_lightgray.jpg'"
style="CURSOR: hand" onclick="window.location='?j=home'"
onmouseout="background='images/bar_bg.jpg'" width="10%"
background="Clan Internal Affairs_files/bar_bg.jpg">Home</TD></a>



Please note that there's a space between java and script in the code above. This forum has put it there, not me. Don't forget to remove the space.

You'll need to create the page home.htm and then designate how you want the window to display by changing the "0" parameters.

Also, you won't be needing the other onclick command ( onclick="window.location='?j=home'" ) You could just remove it or leave it if you want but it won't serve any function.

Good luck with your site, looks very nicely done so far :)

The Wizzard
09-04-2002, 11:31 PM
Thanks for your help wontgetlost, but with your code, I was able to use a much simpler way...

Instead of creating a home.htm page, and all that stuff, I simply took the code which I had


<td onMouseOver="background='images/bar_bg_lightgray.jpg'" onClick="window.location='?j=home'" style="cursor:hand" onMouseOut="background='images/bar_bg.jpg'" width="10%" valign="middle">Home</td>


And then took out the onClick function, and added this...


<a href="http://www.enemydown.org/forum" target="_blank"><td background="images/bar_bg.jpg" onMouseOver="background='images/bar_bg_lightgray.jpg'" style="cursor:hand" onMouseOut="background='images/bar_bg.jpg'" width="10%">Forums</td></a>


Thank you very much, your code made me think of this :thumbsup: