Reply to Re: Forcing a script to open a link in a new window or tab

Your name:

Reply:


Posted by Michael Winter on 05/05/06 13:16

On 05/05/2006 09:46, Jeremy Brown wrote:

> Thank you for the assistance.

You're welcome. However, please do not top-post and full-quote to this
group in future.

How do I quote correctly in Usenet?
<http://www.netmeister.org/news/learn2quote2.html>

You might want to investigate OE-QuoteFix
(<http://home.in.tum.de/~jain/software/oe-quotefix/>).

[Corrected this once:]

> "Michael Winter" <m.winter@blueyonder.co.uk> wrote in message
> news:WMr6g.64211$wl.8160@text.news.blueyonder.co.uk...
>
>> function modifyWebringTargets() {
>> var ring;
>>
>> if (document.getElementById
>> && (ring = document.getElementById('webring'))
>> && ring.getElementsByTagName) {
>> var links = ring.getElementsByTagName('a');
>>
>> for (var i = 0; i < links.length; ++i) {
>> links[i].target = 'webring';
>> }
>> }
>> }
>
> Where in the would I put this script?

In a script element as a child of the head element will do:

<head>
<!-- ... -->
<script type="text/javascript">
function modifyWebringTargets() {
/* ... */
}
</script>
<!-- ... -->
</head>

You then have the option of calling the function in response to the load
event:

<body onload="modifyWebringTargets();">

or in a script element at the end of the document:

<!-- ... -->
<script type="text/javascript">
modifyWebringTargets();
</script>
</body>
</html>

The difference between the two is that in the former, the function will
be called after the entire document has finished loading, including any
images and the like. The latter example will call the function once the
script element has been parsed; more or less once all of the markup has
been received.

Hope that helps,
Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.

[Back to original 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

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