try another color scheme:


Go Back   TECH6.0 > Get Techie > Programming > HTML/CSS/JavaScript


Open URL in new "smaller" window

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 ...

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 24-09-2008, 02:52 PM
No Avatar

Techie
 
Join Date: Aug 2008
Location: United States
Posts: 54
MisawaPlayer is on a distinguished road
Send a message via Yahoo to MisawaPlayer
Default Open URL in new "smaller" window

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
Reply With Quote
  #2  
Old 24-09-2008, 03:05 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

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> 
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #3  
Old 24-09-2008, 03:43 PM
No Avatar

Techie
 
Join Date: Aug 2008
Location: United States
Posts: 54
MisawaPlayer is on a distinguished road
Send a message via Yahoo to MisawaPlayer
Default

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> 
Reply With Quote
  #4  
Old 24-09-2008, 04:12 PM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

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> 
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #5  
Old 26-09-2008, 05:21 AM
No Avatar

Techie
 
Join Date: Aug 2008
Location: United States
Posts: 54
MisawaPlayer is on a distinguished road
Send a message via Yahoo to MisawaPlayer
Default

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)
But this only works in my Mozilla Firefox browser. If I am using IE, it does not move the window at all.

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.
Reply With Quote
  #6  
Old 26-09-2008, 05:30 AM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

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> 
Note the two new parameters, left and top
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #7  
Old 26-09-2008, 08:53 AM
No Avatar

Techie
 
Join Date: Aug 2008
Location: United States
Posts: 54
MisawaPlayer is on a distinguished road
Send a message via Yahoo to MisawaPlayer
Default

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.
Reply With Quote
  #8  
Old 26-09-2008, 09:00 AM
webwizzy's Avatar

Administrator
 
Name: Vinayak
Join Date: Feb 2008
Location: India
Phone: Samsung Wave
Posts: 1,116
webwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nicewebwizzy is just really nice
Send a message via Yahoo to webwizzy
Default

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
__________________
Always TAG and SHARE your threads
Submit your site to TECH6 Directory
TECH6 on Facebook - Like Us

Would you like to Link To Us | Support TECH6 by going Premium
Know more about me at Vinayaks.com | Follow TECH6 at Twitter


Reply With Quote
  #9  
Old 26-09-2008, 09:29 AM
No Avatar

Techie
 
Join Date: Aug 2008
Location: United States
Posts: 54
MisawaPlayer is on a distinguished road
Send a message via Yahoo to MisawaPlayer
Default

Must have looked at the second link too fast. Sorry, and thank you.
Reply With Quote
Reply

Bookmarks

Tags
javascript, new window, open url


Thread Tools
Display Modes




All times are GMT +5.5. The time now is 01:35 AM.

Contact Us - Tech6.com - Link to Us - Advertise - Submit Site - Privacy Statement - TOS - Top