|
|
|
|
![]() ![]() |
May 24 2005, 05:02 PM
Post
#1
|
|
|
PhilosopherX ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 106 Joined: 5-February 05 From: Planet X Member No.: 3,613 |
CODE <HEAD> var popUpWin=0; function popUpWindow(URLStr) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'GunBound Tactics: Screenshots', 'width=820,height=550,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top= 90,left=90'); } </HEAD> <BODY> <a href="javascript:popUpWindow('/f11/clipped.php');"><b>Clips</b></a> </BODY> This is a script for opening a new window. It works with Firefox and not Internet Explorer. IE gives a script error and it references a part of the code that has nothing to do with the script. Someone please tell me if you can figure out why. Used at this address I'm not asking your opinion about IE and FF. Just help me fix it if you can. Thanks. |
|
|
|
May 24 2005, 05:06 PM
Post
#2
|
|
|
PhilosopherX ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 106 Joined: 5-February 05 From: Planet X Member No.: 3,613 |
Sorry, something went wrong with that post. The ' is supposed to be a ', and </BODY> is supposed to be in the code tag.
Additional note: this script came from DreamWeaver MX 2004 I'd appreciate if someone would fix this and delete this second post. |
|
|
|
May 24 2005, 05:11 PM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 117 Joined: 3-May 05 From: A Canadian South of the 49th Parallel Member No.: 6,544 |
I wrote this script for use in a few past projects, and it has worked fine for me ever since, maybe it will suit your needs as well?
CODE function OpenSubWin( page, w, h, sb ) { var sw = screen.width, sh = screen.height; var ulx = ((sw-w)/2), uly = ((sh-h)/2); var sbt = (sb==1) ? 'yes' : 'no'; var paramz = 'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scro llbars='+sbt+',width='+w+',height='+h+''; var oSubWin = window.open( "", "SubWin", paramz ); oSubWin.moveTo( ulx, uly ); oSubWin.location.replace( page ); } The parameters it accepts are: page --> the URL to the page to open w --> the Width of the Sub-Window h --> the Height of the Sub-Window sb --> if 1 then display Scrollbars in Sub-Window (could be set to 0, or auto) It even centers the Sub-Window for you too.. Example usage: CODE <a href="javascript:OpenSubWin( 'my_page.html', 640, 480, 1 );"> Click Here.. </a> I hope that helps! |
|
|
|
May 24 2005, 05:15 PM
Post
#4
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 117 Joined: 3-May 05 From: A Canadian South of the 49th Parallel Member No.: 6,544 |
Sorry for double-post, but the Code tags messed up my script above, you should replace the & # 39 ; with a single-quote to fix the script I posted..
|
|
|
|
May 24 2005, 06:42 PM
Post
#5
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 15 Joined: 22-May 05 Member No.: 7,377 |
Ewww Dreamweaver.
That being said, here is the code that works for me. I find it very nice and simple. CODE <head> <script language="JavaScript"> <!-- function FUNCTION1() { window.open('WEBPAGEADDRESS.html','mywindow','width=500,height=500,toolbar=no,menubar=no,scrollbars=no,resizable=no'); } //--> </script> </head> <body> <a href="javascript:FUNCTION1()">TEXT</a> </body> You can replace WEBPAGEADDRESS with any webpage. (main.html, index.html, http://google.com) If you had wanted two links on the page then your code would look like this. CODE <head> <script language="JavaScript"> <!-- function FUNCTION1() { window.open('WEBPAGEADDRESS.html','mywindow','width=500,height=500,toolbar=no,menubar=no,scrollbars=no,resizable=no'); } //--> <!-- function FUNCTION2() { window.open('WEBPAGEADDRESS.html','mywindow','width=500,height=500,toolbar=no,menubar=no,scrollbars=no,resizable=no'); } //--> </script> </head> <body> <a href="javascript:FUNCTION1()">TEXT</a> <a href="javascript:FUNCTION2()">TEXT</a> </body> Hope thats clear. |
|
|
|
May 25 2005, 02:41 AM
Post
#6
|
|
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 1,161 Joined: 9-May 05 From: Brisbane, QLD Member No.: 6,818 |
QUOTE(gunbound @ May 25 2005, 03:02 AM) CODE <HEAD> var popUpWin=0; function popUpWindow(URLStr) { if(popUpWin) { if(!popUpWin.closed) popUpWin.close(); } popUpWin = open(URLStr, 'GunBound Tactics: Screenshots', 'width=820,height=550,menubar=no,resizable=yes,scrollbars=yes,toolbar=no,top= 90,left=90'); } </HEAD> You've left out the <script type="text/javascript"> & </script> tags. |
|
|
|
May 25 2005, 11:05 AM
Post
#7
|
|
|
Member [Level 1] ![]() ![]() ![]() ![]() Group: Members Posts: 69 Joined: 12-March 05 From: Australia Member No.: 4,401 |
I think what you are missing is the <script> tags as Tyssen mentioned above and you should also add the 'window' part to call the open window like all the other examples other members have given. eg. popUpWin = window.open();
Also, the opened window name ('GunBound Tactics: Screenshots') should only contain alphanumeric characters (A-Z, 0-9) or underscores (_). Although, I doubt that would be causing the problem. This post has been edited by snlildude87: May 25 2005, 04:41 PM |
|
|
|
Sep 25 2007, 02:27 PM
Post
#8
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,360 Joined: 21-September 07 Member No.: 50,369 |
"GunBound Tactics: Screenshots" is your window name, not your title of the window.
IE only let you use alphabet and _.
you should have something like "newwin" insted.
then use document. write ... <TITLE>...</TITLE> to add title.
-deluxmilkman
|
|
|
|
May 14 2008, 04:50 AM
Post
#9
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,360 Joined: 21-September 07 Member No.: 50,369 |
parse parameter when open new window
[help] Java Script: Window.open Page that I create to open a new window already done, but it cannot parse parameter. Where should I put a parameter? jsp or java. Before that in parent window I have filter the value by pttName and month and output display. So I want to bring this 2 parameter to child window. Below its code that I have done. Page1.Jsp Function prntLetter() { var url = "ReportBirthdateNameList.Jsp"; var name = "pageLetter"; var features = "toolbar=0,location=0,directories=0,status=0, menubar=0,copyhistory=no,scrollbars=yes,resile=no"; window.Open(url,name, features); } </script> Button code: <input type="button" name="btnLetter" value="Print Name & Address" onclick="prntLetter()"> -question by miedah |