| |||||||
This is a discussion on Open URL in new "smaller" window within the HTML/CSS/JavaScript section, part of the Programming category; I know how to use the anchor tag, with the target attribute to create a link on my page that ...
![]() |
|
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
|
I know how to use the anchor tag, with the target attribute to create a link on my page that will open the URL in a new browser. What I want to know, is how do you do that, but into a smaller window than that which is currently displayed. I see this all the time, where you click on a link, it opens a new window (often without the toolbars at the top) that is much smaller, custom sized for the content. An example is the "more" link in the Smilies box. If I am making myself clear, can someone tell me how to do this. Thank you in advance. Mike |
|
#2
| ||||
| ||||
|
that is simple Mike.. those are Javascript Popup windows. You can easily create one Using the window.open method, fully customisable. Or Generate One ![]() Example Code:- HTML Code: <SCRIPT> function openwindow() { window.open("http://tech6.com","mywindow","menubar=1,resizable=1,width=350,height=250"); } </SCRIPT> <P> <A href="javascript: openwindow()">Open the JavaScript Window Example</A> </P>
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#3
| ||||
| ||||
|
Can I pass a parameter to the function? Something like this: HTML Code: <SCRIPT> function openwindow($theURL) { window.open($theURL,"menubar=1,resizable=1,width=350,height=250"); } </SCRIPT> <P> <A href="javascript: openwindow('http://tech6.com')">Open the JavaScript Window Example</A> </P> |
|
#4
| ||||
| ||||
|
Yes, you can ! But the code above won't work coz you missed a required parameter "mywindow" HTML Code: <SCRIPT> function openwindow($theURL) { window.open($theURL,"mywindow","menubar=1,resizable=1,width=350,height=250"); } </SCRIPT> <P> <A href="javascript: openwindow('http://tech6.com')">Open the JavaScript Window Example</A> </P>
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#5
| ||||
| ||||
|
Thank you, this has worked fine for me. It is almost exactly what I want. The only other thing I am having trouble with is moving the popup to where I want it. I used the following: Code: window.open($theURL,"mywindow","menubar=1,resizable=1,width=350,height=250"); mywindow.moveto(a,b) I'd be happy just knowing how to move it regardless of the browser. What I would REALLY like to know is how to make it popup right where the mouse clicked. Meaning, calculated on the fly depending on screen size, window location, etc. |
|
#6
| ||||
| ||||
|
This would work in both browsers:- HTML Code: <SCRIPT> function openwindow($theURL) { window.open($theURL,"mywindow","menubar=1,resizable=1,width=350,height=250,left=152,top=200"); } </SCRIPT> <P> <A href="javascript: openwindow('http://tech6.com')">Open the JavaScript Window Example</A> </P>
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#7
| ||||
| ||||
|
You see, now that works great, BUT the information link you sent: Using the window.open method Did not list left and top as one of the features and the string tokens you can use. I thought there might be something like that, but the reference didn't say so. Thanks. I must be really starting to bother you with all of the questions. Hope you do not mind too much. |
|
#8
| ||||
| ||||
|
ahh... please I do not mind at all. As said earlier, this is what this place is for ! btw if you would have gone through my second referance link (Generate One), you would have got it
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#9
| ||||
| ||||
|
Must have looked at the second link too fast. Sorry, and thank you.
|
![]() |
| Bookmarks |
| Tags |
| javascript, new window, open url |
| Thread Tools | |
| Display Modes | |
| |