This is a discussion on "Open another new window from javascript window" within the JavaScript Forum section. This forum, and the thread "Open another new window from javascript window are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Open another new window from javascript window
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Open another new window from javascript window
Hello folks..
I'm not a professional web developer at all and am just learning bit by bit whilst making my own sites by nicking code from here and there... so bear with me... Anyway, I have made a page with click links on an image map that open up a new little pop up window of certain dimensions etc with javascript... as below (with imaginary urls )
Can I use a similar javascript function in the html file for the new little window (http://www.myimaginarysite.com/popupexample.htm) ? The reason I want to do this is that this little page will include links to external websites and I would like them to open in a separate window altogether from those already open.. Ideally a larger window over to the right of the little popup window. I have tried repeating the code above within the small popup's html but it appears not to work... the link just opens in the small window. Perhaps there is some difficulty with "doubling" the javascript? Hope I have explained clearly... and that someone might be able to help. Many thanks Rima Last edited by c010depunkk; Jan 23rd, 2008 at 12:31. Reason: please use [HTML] tags when posting HTML |
|
|
|
||||
|
Re: Open another new window from javascript window
You don;t need javascript, just add target="_blank" to your links.
eg.: <a href="http://www.webforumz.com/" target="_blank">Go to Webforumz.com</a>
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Re: Open another new window from javascript window
Thanks spinal007
I want to be able to specify the position and dimensions of the second popup that opens separate from the first. Is this possible? |
|
||||
|
Re: Open another new window from javascript window
of course it is, just use the same code you already have on the first page:
<script language="javascript" type="text/javascript"> function winOpen(goto){ window.open(goto,null,"height=570,width=450,status =yes,toolbar=no,menubar=no,scrollbars=no,resizable =no,top=80,left=80"); } </script>...and... <a href="javascript:winOpen('http://www.webforumz.com/');">Webforumz</a> ...change.. height=570,width=450, ...to whatever you like.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Re: Open another new window from javascript window
Have a look here : www.orlawren.com ... the link I have made is from my name "rima staines" ... about halfway down the second photograph ... this opens up a new window ... all fine ... and then the links within that window should open another.. but I am finding that it doesn't ... any brainwaves? cheers |
|
||||
|
Re: Open another new window from javascript window
Ok, find this code:
window.open(goto,null, on the first page, change it to: window.open(goto,'MyPopup', on the second page (the popup), change it to: window.open(goto,'MyPopup' + (window.count = (window.count || 0 ) +1), See if that works...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Re: Open another new window from javascript window
Hooray it works!
perhaps one day I might know what on earth all that means! Cheers Rima |
|
||||
|
Re: Open another new window from javascript window
lol, it's simple - window.open takes 3 parameters: url, window name, window settings.
the 'window name' parameter lets you identify the window and re-use it. all you had to do was use a different 'window name' every time a link was clicked. this... (window.count = (window.count || 0 ) +1) ...was just a clever little way of doing just that. it will add an increment (1,2,3,4,5...) to the name of the popup every time you click on a link, so the name is never the same, so you get a new window every time. You'll get there with a little practice... PS.: For a real explanation of window.open, see this and maybe these.
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Re: Open another new window from javascript window
Thanks
Here's another little problem for you From the main 1st page (www.orlawren.com) All the little popup windows that open are using the same function and therefore open at the same size .... If you look to the bottom of the page ..the old postcard is a click link to a small window containing a guestbook (which as you can see is too large for the window ) is it possible to open them at different sizes using the code you gave me? Do I have to repeat the script function within the html for that page each time with a different number? Thanks again .. help much appreciated Last edited by thehermitage; Jan 27th, 2008 at 14:47. |
|
||||
|
Re: Open another new window from javascript window
like I said before, change...
height=570,width=450, ...to whatever value you like the window to be. I suggest you read the window.open specs if you're going to be using it so often...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
|
|
|||
|
Re: Open another new window from javascript window
I worked it out! The problem I had was not knowing that you could name the functions differently eg winOpen and winOpen2 therefore enabling me to make the different windows do different things!
cheers Rima |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Change open in new window to open in same window | nsr500rossi | JavaScript Forum | 2 | Jan 18th, 2008 14:13 |
| [SOLVED] open new window from main window | AdRock | Other Programming Languages | 1 | Nov 1st, 2007 02:45 |
| Need JavaScript for html links should open in a new window in the first time, after.. | jayaramgussy | JavaScript Forum | 0 | Jun 19th, 2007 09:00 |
| javascript to open new window | snappy | JavaScript Forum | 4 | Nov 9th, 2006 13:02 |
| Open a new window | pokerskatershark | JavaScript Forum | 4 | Mar 17th, 2006 19:25 |