|
Author
|
Topic: JavaScript function
|
Aui Pilot
|
posted 11-18- 06:27 PM
I need some help with this... I've never used Java before and I don't know C so I'm having a problem with the function below. How do I use the options of the function? In my example I want to disable all of the options "resizable=yes,scrollbars=yes,status=yes" but I can't figure out how to call the function correctly. ('My example' below works as it is, but it will currently open a new window with all the above options turned on. How should I change it to make it work the way I want?) ------------------------------------------------ <öHEAD> <öTITLE>Pictures<ö/TITLE>
<öSCRIPT> < !-- function openWindow(url, w, h) { var options = "width=" + w + ",height=" + h + ","; options += "resizable=yes,scrollbars=yes,status=yes,"; options += "menubar=no,toolbar=no,location=no,directories=no"; var newWin = window.open(url, 'newWin', options); newWin.focus(); } //--> <ö/SCRIPT> <ö/HEAD> ------------------------------------------------ My example: <öA ONCLICK="openWindow('onland.jpg', 810,550) ; return false" HREF="onland.jpg"><öIMG SRC="small/s_onland.jpg" hspace=10 border="2"><ö/A> [This message has been edited by Aui (edited 11-18-2000).] IP: Logged |
Aui Pilot
|
posted 11-18- 06:52 PM
...argh. Had to edit the above post >25 times as neither code:
[CODE]
nor code:
would disable my code. All the ö had to make the trick in the end anyway.---------- [Edit] This sucks. Neither |code| nor -pre- does work. And |code| can't even show -pre-. Ehh... if now anyone is able to understand that sentence. How does one post code on this board as plain text??!!! [This message has been edited by Aui (edited 11-18-2000).] IP: Logged |
Lothar Pilot
|
posted 11-18- 08:47 PM
You can edit your function replacing the "yes" with "no". This function is just a repackaged way of using the built-in javascript window functions. It's probably easier for you to figure this stuff out if you go with the raw javascript, which would be something like: onclick = "window.open('windop.htm', 'mycoolwindow', 'location=no, toolbar=no, status=no, menubar=no, scrollbars=no, resizable=no, width=200, height=200');return false"
If you are looking for a good pop up window handler which will also make sure that windows close automatically, etc., try: http://www.dynamicdrive.com/dynamicindex8/popwin.htm
This site has lots of other JavaScript functions that are worth checking out. Javascript tends to break across different OSs and browsers, which means that for complicated scripts, using a proven script from a site like dynamicdrive saves a lot of time over making sure your script works on the Macintosh, or on Netscape under Windows NT, etc. Good luck  [This message has been edited by Lothar (edited 11-18-2000).] [This message has been edited by Lothar (edited 11-18-2000).] IP: Logged |
Aui Pilot
|
posted 11-19- 02:45 PM
Worked great! - Thanks!!IP: Logged | |