Forum Archive

Go Back   3D Realms Forums > General Topics > Programming Forum
Blogs FAQ Members List Social Groups Calendar Mark Forums Read

Notices

 
 
Thread Tools
Old 03-10-2005, 03:37 AM   #1
Decker

Decker's Avatar
Opening links in new window
I want to open a link in a new window with a custom size and w/o any toolbars and such.

Am I correct in that I have to use JavaScript for that? I've successfully implemented the script I need into a submit button, but I want to do the same with a graphic button, i.e. a small TD background image with a text in the cell acting as the link.

So far I've got this:
Quote:

<TD background="path/image.gif">

<a href="" title="Opens new window" onClick="window.open('http://www.url.address','Window name','width=820,height=600','menubar=no','directo ries=no','status=no')"> Link text</a>

</TD>

This works fine in Firefox. But I guess IE gets confused about the empty href value because nothing happens when I press the link.

Help, please.
__________________
Wii FC : 2494-2649-5817-0179
PSN ID: DeckerFI
Decker is offline  
Old 03-10-2005, 03:45 AM   #2
Phait

Phait's Avatar
Re: Opening links in new window
Try...

Code:
<a href="#" onclick="window.open('yourpage.html','Windowname','width=300,top=0,left=0,height=240,scrollbars=0');  return false;">
As for particular window elements to show, there's a list of parameters out there, I don't really KNOW javascript so...
__________________
Music: http://www.oquilluksound.com Album: http://machinefaultred.blogspot.com Album Calendar Youtube: http://www.youtube.com/oquilluksound

"but I promise you this, I'll always look out for you, that's what I do" -Coldplay
Phait is offline  
Old 03-10-2005, 05:07 AM   #3
Decker

Decker's Avatar
Re: Opening links in new window
Weird. The link only works in IE if the only parameter I leave in is the target URL.


Another approach that would eliminate the need for all the stuff I previously asked would be to modify the originating page itself to accommodate my requirements.

So my question is:

How do I set a browser window to hide scroll bars, tool bars and such when I open the page manually? I managed to set the size and position with the following script, which I then executed using <body onLoad="JavaScript:windowMod()")>

Code:
<script language="JavaScript">

function windowMod()
	{
		window.resizeTo(300,200);window.moveTo(10,10);
	}
</script>
So, what's the window.xxx command for setting the toolbar=no, scrollbars=no etc?
__________________
Wii FC : 2494-2649-5817-0179
PSN ID: DeckerFI
Decker is offline  
Old 03-10-2005, 10:46 PM   #4
Night Hacker

Night Hacker's Avatar
Re: Opening links in new window
This is how I did it...

First I have some javascript early on my webpage...
Code:
<script LANGUAGE="javascript">
	function Screen01() {
X=window.open("screen1.html","X","toolbar=no,scrollbars=yes,directories=no,resizable=1,menubar=no,width=700,height=550")
   }

Later in my page I have a small thumbnail image and a link to the above java that opens up a small window with the image etc...
Code:
<a href="javascript:Screen01()"><img src="thumbnail.jpg" border="0"></a>

Of course, you need a scree1.html (or whatever you call it) with your image code etc...

This is mine (trimmed down actually)...

Code:
<html>

<head>
<title>Screen1</title>
</head>

<body bgcolor="#E99D49">
<center>
<img src="dev001.jpg" border="3"><br>
<a href="javascript:window.close()">Close Window</a>
</center>

</body>
</html>
The close window part isn't really needed, but I include it anyhow, just in case.
__________________
"My general feeling is that computers are doing more harm than good." - Jay Miner ("father" of the Amiga)
Night Hacker is offline  
Old 03-11-2005, 05:36 AM   #5
Iggy

Iggy's Avatar
Re: Opening links in new window
I'm curious, if I would have multiple of those clickable thumbnails on one page and I use the same javascript code for it but different targetimages, is there a way to centralize the JavaScript code used for the pop-up?

Btw, I use this code for my thumbnails.

Quote:

<a onclick="window.open('image-url,'View picture',
'width=800,height=600,scrollbars=yes,toolbar=no,st atus=no,resizable=no,location=no'); return false" href="image-url" target="_blank"><img src="thumbnail.jpg" border="0" width="80" height="60" alt="" /></a>

This seems to work in Firefox and IE 6.0, plus the official validator approves it.
__________________
Duke4Ever || The Game Collector's Market - Forum for game collectors.
"That Nordbergian wench could be a handful! Several." - Gnarl (Overlord 2)
Iggy is offline  
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:59 PM.

Page generated in 0.21090293 seconds (100.00% PHP - 0% MySQL) with 18 queries

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.

Website is 1987-2014 Apogee Software, Ltd.
Ideas and messages posted here become property of Apogee Software Ltd.