Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
|
It's actually pretty easy to use window.open. You don't really need to know much about JavaScript. Instead of adding target="_blank" to your <a> tag you would do something like:
HTML Code:
<a href="#" onclick="window.open('pathToYourFile','windowName','scrollbars=yes,resizable=yes,width=550, height=565');"
The # for the href just holds the place for the javascript which starts with the onlcick even handler. So when anyone clicks on the link the window.open dunction will take over.
That first parameter in window.open is the path to the file you want open. It's the same thing you would have put into the href="" The next parameter is the name you want to give to the new window. That's so you could write code for that window later. After that you can add a lot of different things to determine how you want the new window to look.
In the code I gave I just allowed for the window to have a scrollbar and be resizable in case someone wanted to make it bigger or smaller and I also specified a width and height. The width and height are what the new window will open at first.
One thing to notice is that the path and the window name get quotes places around them and then all the other features get one set of quotes around them, but not around each individual feature. You separate the different extra features with a comma.
The link I gave before lists some of the other features you can control. If you do a search for window.open you'll find a lot of other pages that will give you similar or more information.
Feel free to just use the line of code I supplied and substitute the values you want for the width and height as well as the path to the file and the name for the window.
I hope that helps.
Last edited by vangogh; 08-05-2006 at 12:18 PM..
|