Forum Moderators: open
I'm new to HTML and would like to know if there is a code to control the new window
that opens in the example code shown below. The example is for just one picture set but I normally
use six to twelve pictures on one page.
What I am doing is using thumbnails. They are set up to open in a new window when clicked on.
Because their only purpose is to view the enlarged image and then be closed I would like
to have the new browser window controlled so:
1. the address bar won't show
2. the url won't show on the title bar, maybe replace the url with my page name or
just have it remain blank
3. it will open at 640 pixels x 640 pixels
Can this be done using only HTML or is java script the only way. If java is the only way, what would that be
and where does it get placed. Any help is appreciated. Thanks in advance.
<center> <table cellpadding="9">
<tr><td>
<a href=http://www.geocities.com/myglobal7/1.jpg target=_blank>
<img src=http://www.geocities.com/myglobal7/tn1.jpg
width="120" height="160"></a></td></center></b>
Place the following in the <head> of the page which is opened by the link, as near to the top as possible (so it resizes straight away):
<script>
self.resizeTo(x,y);
</script>
James.
<a href="javascript:void(window.open(this.href,'newpic','width=640,height=640')"><img src="thumb1.gif"></a>
This will cause clicking on the thumbnail to run the method window.open. It will open a new window that is 640 X 640 and dump your image inside.
If you want to get rid of the toolbar on tis new window, add ,toolbar=no after height=640. There are actually all kinds of modifications you can make to the "chrome" of the new window, including getting rid of scrollbars, the status bar, the menu bar, etc. For a full list and explanation, check out the MSDN Reference page. it's got details on all this stuff.
Note: What I showed you is the ugly way of doing this. The prettier way is to write a function containing all the info you need, then call the function with onclick="newWindow()" in the <a> tag. However, this would require a lengthy explaination of how to do it and I don't have time at the moment.
Hope this helps.
Peace.
I was wrong on two counts:
One: replace this.href with the actual url of your image.
Two: You'd need another ) before the end quote.
The actual tag should read:
<a href="javascript:void(window.open('image1.jpg','newpic','width=640,height='640'))">
Again, you can see how hideously ugly this way of doing it is, particularly if you have a lot of thumbnails to deal with.
Peace.