You are here: Re: script to open a new window « HTML « IT news, forums, messages
Re: script to open a new window

Posted by Jonathan N. Little on 11/19/25 11:28

Jackmac wrote:

> Hi all,
>
> Hopefully an easy one for someone.
>
> I'm trying to set up a link on my web pages which will allow me to open a
> new window of a specific size. Got that to work without a problem. The
> difficulty I have is that when you close the new window you've opened,
> instead of having the page you cliked from, you see a page with... [object]
> on it.
>
> The page concerned is:
>
> http://www.independentproducts.co.uk/test.htm
>
> Any ideas anyone please?
>
> TIA
>
> Jackmac
>
>
That's because window.open() return a reference to the new window which
to put in the href of the link.

<a href="javascript:foobar();">

is a bad idea, what happens if the user has javascript disabled?

better:


JavaScript:
function popup(url){
var newwin=window.open(url,'bob','WIDTH=320,HEIGHT=195');
return false; //so if javascript IS enabled prevents link on page
}


HTML:
<a href='http://www.wedgwood-group.com/'
onclick="return popup('http://www.wedgwood-group.com/')">
Click to download
</a>

If user has javascript disabled then the your download will be in main
window, else in the popup.

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация