| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Jan 2003
Posts: 16
![]() | Question need help fast plz! I am running into serious problems w/ something i want to do w/ links. What i want to do and have seen in some websites is when a link is clicked a new window pops up resized and located somewhere other than in the center. how is this done. I have an example page but at the moment its under construction so i cant post it at the moment. does anyone know what i mean and can anyone help. if so email me or IM me. faster than readin a post |
| |
| | #2 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | This may work for you: ????: NamePros.com http://www.namepros.com/programming/14412-resolved-question-need-help-fast-plz.html First create a litlle function: <script language="JavaScript"> function popUP() { myWin = window.open("/page.html", "","toolbar=no,location=no,directories=no,menubar= no,scrollbars=no,resizable=no,left=60,top=60,width =600,height=400") } </script> Then call it by the name of the function like this: <a href="javascript:popUP();">Click Here To Open A New Window</a> This part should all go on one line: myWin = window.open("/page.html", "","toolbar=no,location=no,directories=no,menubar= no,scrollbars=no,resizable=no,left=60,top=60,width =600,height=400") You can change the left and top numbers to adjust the window to pop up in different locations. |
| |
| | #4 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | In your html page where you're calling the pop up from add this code anywhere in the body section: <script language="JavaScript"> function popUP() { myWin = window.open("/page.html", ""," toolbar=no,location=no,directories=no,menubar=no,s crollbars=no,resizable=no,left=60,top=60,width=600 ,height=400") } </script> You would need to change this part: (/"page.html" to the actual url of the page you want in the pop up window. Then where ever you want the link to appear that is clicked to open the popup window add this: <a href="javascript:popUP();">Click Here To Open A New Window</a> |
| |
| | #7 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | You can add another function with another name. Then call the new popup with the new name. For example you could name it popUP2 function popUP2() { Then call it with popUP2 in your link. <a href="javascript:popUP2();">Click Here To Open A New Window</a> There's other ways to do it also without creating a new function for each different pop up. I'll see if I can find something and post it. |
| |
| | #9 (permalink) |
| Senior Member Join Date: Aug 2002
Posts: 1,255
![]() ![]() | Well you can try something like this for each link: <a href="#" onclick="window.open('page2popup.htm','WindowName' ,'toolbar=no,location=no,directories=no,menubar=no ,scrollbars=no,resizable=no,left=60,top=60,width=6 00,height=400');return false">link</a> Then you wouldn't have to create all them functions for each link. There's alot of different ways of doing it, but maybe that will work for you. |
| |
| | THREAD STARTER #10 (permalink) |
| New Member Join Date: Jan 2003
Posts: 16
![]() | ugh! for some reason when i input the code and preview it it doesnt work. What could i be doing wrong? -And on your previous post the "#" icon, do i replace it w/ something other than that or leave it be? Sorry to be bugging so much but im no good w/ java script nor HTML all too well. |
| |
| | #12 (permalink) |
| NamePros Regular Join Date: Sep 2002 Location: Canada
Posts: 481
![]() | I would normally just use target="_blank" but i think that would center it.
__________________ Sometimes I lay awake at night and I ask "Where have I gone wrong?" Then a little voice says "This is going to take more than one night" |
| |