Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting window size

Status
Not open for further replies.

SjrH

IS-IT--Management
Joined
Jun 24, 2003
Messages
747
Location
GB
Can I use the code below to also set a window size?
At the moment the link displays in a full window, but i'd like to set it to open in a new, custom size window, with no toolbars if poss!

Code:
document.write("<a target=\"_self\" href=\"" + docref[random_num] + "\"><img src=\"" + image[random_num] +"\" border=\"0\"></a>");

Thanks
 
Try this:

Code:
document.write('<a target="_self" href="' + docref[random_num] + '"><img src="' + image[random_num] +'" border="0" onclick="void(window.open(this.href, '', 'width=400,height=300')); return(false);"></a>');

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Ooops - I forgot to escape the single quotes. Let's try again!

Code:
document.write('<a target="_self" href="' + docref[random_num] + '"><img src="' + image[random_num] +'" border="0" onclick="void(window.open(this.href, \'\', \'width=400,height=300\')); return(false);"></a>');

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks Dan,

That is kinda what I want to do, but when I click on the link, it opens up a new custom sized page with the image displayed, not the link!

Maybe i'm going about this all wrong!

What I have is 2 arrays -
'image' which contains [random_number]'&
'docref' which contains [random_number]'
The original script displayed a random image which when clicked took the user to the relevant page for that image (allbeit in the same window). If I change the "_self" to "-new" the a new window was created, but it was full screen with toolbars an all...

The particular information that the script links too barely fills a 200 x 200 box so it looks a little out of sorts in a full screen view!

Am I over complicating things with 2 arrays? could I do it with one and still open a new custom size window with the linked info?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top