Locking a webpage so that it opens a certain size?

liunx

Guest
Hi Guys!<br />
<br />
I'm currently working on a website but there is one part of it I need a bit of help with.<br />
<br />
I'm creating this site for an internet radio station and there is an image which acts as a link - when they click on it, it opens up a new page. What I want to do is lock this other page that appears when they click on the link to a certain size (fairly small). It will only be used for information purposes and doesn't require a full web page size - it will look fairly unprofessional and it will also 'drown out' the main homepage - taking the attention away from it.<br />
<br />
Is there any code or command I can put into the page so that it forces the page to open at a certain size? I'm using Dreamweaver MX for my project just incase that help at all.<br />
<br />
Thanks in advance guys. :D<!--content-->It would take JavaScript or VBScript to open a window a particular size.<br />
<br />
Instead of specifying <br />
target="_blank"<br />
you would need to call the window.open() function in the onclick event of the link. See <!-- m --><a class="postlink" href="http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp">http://msdn.microsoft.com/workshop/auth ... open_0.asp</a><!-- m --> for the complete syntax.<br />
<br />
Alternately, you could place a script in the page that you want to load in the new window to resize the window. Place this code in the head section:<br />
<script language="JavaScript" type="text/javascript"><br />
<!--<br />
window.resizeTo(100,100);<br />
//--><br />
</script><br />
and the window that the page is loaded into will always be 100px by 100px. <br />
<br />
However, there are many window features (menu bar, location, etc.) that you can only manage when using window.open().<!--content-->you could also use this code to open the window of a certain size, without it opening and then resizing:<br />
<br />
place in head:<br />
<br />
<br />
<script language=javascript><br />
<br />
function openIt()<br />
<br />
stats='width=100,height=100'<br />
window.open ("window-url","windowName",stats)<br />
<br />
<br />
</script><br />
<br />
<br />
<br />
place in body:<br />
<br />
<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"" onclick="openIt()"><img src="image-location" width="image-width" height="image-height"></a><br />
<br />
<br />
<br />
hope this helps,<br />
-Dan<!--content-->Thanks guys - those were very helpful indeed.<br />
<br />
That first script seemed the most effective for what I need. The only thing which I forgot to mention is that on that particular script, it keeps the 'back', 'refresh' icons, etc at the top of the window. Is there anyway of removing them so that it acts like a pop-up window where there isn't an option to resize the window, and having the 'back', 'refresh' icons, etc<!--content-->all you have to do(if you use my way of opening the window at a specific size)is change your "stats" line 2 this:<br />
<br />
stats='width=100,height=100,toolbar=no,location=no'<br />
stats+='directories=no,status=no,menubar=no,scrollbars=no,'<br />
stats+='resizable=no'<!--content-->Cheers mate, i'l give that a try now :)<br />
<br />
Just a random comment nothing to do with this thread but when you click on a link from an image, it replaces the current page. Can you make the image link so that it opens in a new page rather than replacing the current one?<br />
<br />
Sorry to be a pain :D<!--content-->In general you can add the target attribute to the link tag to open it in a new window.<br />
<br />
Example:<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"somepage.html" target="_blank"><img blah blah></a><br />
<br />
This will not set the size of the window, but you said that this question wasn't related, so I think that is the answer.<!--content-->You guys are a massive help. Thanks a lot everyone. If I could buy you a beer then I would lol :cool:<!--content-->ok i got a picture that when you click on it, it opens a page that shows more pictures, i need it so when u clcick the picture it opens the new window in a certail size (long and skinny)<!--content--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<br />
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><br />
<head><title>Example</title><br />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1" /><br />
<style type="text/css"><br />
</style><br />
<br />
<script type="text/javascript"><br />
function openIt() {<br />
properties = "width=200,height=500,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";<br />
url = "http://www.teenchat.com";<br />
window.open(url,"WindowName",properties);<br />
}<br />
</script><br />
</head><br />
<br />
<body><br />
<br />
<input type="button" name="PopUp Button" value="Open The New Window" onclick="openIt()" /><br />
<br />
</body><br />
</html><br />
<br />
Hope this helps.<!--content-->is that for me?<!--content-->Originally posted by modifier_guy <br />
is that for me? <br />
It most certainly is. <br />
You might also check out this link (<!-- m --><a class="postlink" href="http://www.w3schools.com/js/js_window.asp">http://www.w3schools.com/js/js_window.asp</a><!-- m -->) if you have anymore problems.<!--content-->ok so were do i add my image and the url? in that script? on ym site it has a picture then u clcik it to open a new window<!--content-->The JS:<br />
<br />
<script type="text/javascript"><br />
function openIt() {<br />
properties = " width=200,height=500,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";<br />
window.open(this.href,"WindowName",properties);<br />
}<br />
</script><br />
<br />
HTML:<br />
<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"linktoimage.jpg" onclick="openIt(); return false;"><img src="pathtoimage.jpg" width="imgwidth" height="imgheight" alt-"Text Description" /></a><br />
<br />
Lemme know if that works. I'm pretty new at this, so that's a bit of untested, stab-in-the-dark code. :p :o<!--content-->The script works but it just opens a new window and i got that LOL<br />
<br />
I need it to make it so when you clcik the picture it opens a long and skinny window displaying a long list of pictures<!--content--><html><br />
<head><br />
<br />
<script type="text/javascript"><br />
function openwindow()<br />
{<br />
window.open("http://www.w3schools.com","my_new_window","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400")<br />
}<br />
</script><br />
<br />
</head><br />
<body><br />
<br />
<form><br />
<input type="button" <br />
value="Open Window" <br />
onclick="openwindow()"><br />
</form><br />
<br />
</body><br />
</html><br />
<br />
i found this script but it make a button so you click the button to open the page. i need it to clcik a pciture is it possible to modify this script?<!--content-->Change<br />
<br />
<form><br />
<input type="button"<br />
value="Open Window"<br />
onclick="openwindow()"></form> <br />
to<br />
<a href=http://www.webdeveloper.com/forum/archive/index.php/"urltoimage.jpg" onclick="openwindow(); return false"><img src="path/toimage.jpg"..... /></a> <br />
Of course, you must add the proper attributes to your image tag, the dots are there just to save space.<!--content-->ok i will try it<!--content-->
 
Back
Top