PDA

View Full Version : Need meaning of a function script


kam31uf
07-18-2002, 03:09 AM
I have to fix some pages another person did. They are not around anymore and there is some code on a couple pages that I am unfamiliar with.
Oddly enough it is placed between the </head> and <body> tags

can anyone figure this out?:confused:

Here is the script:

<script language=javascript>
function ow(url) {window.open(url,"",'width=525,height=415,resizable=no,scrollbars=no');}
</script>

Thanks
Kam

Spookster
07-18-2002, 03:25 AM
The function ow probably was meant to stand for open window. That function takes one paramater of a URL and passes it into that function which then opens a new window with that URL. To use is one can do something like so:

<a href=#" onMouseover="ow('http://www.cnn.com');">CNN</a>

kam31uf
07-18-2002, 04:14 AM
What does the # mean?

kam31uf
07-18-2002, 04:18 AM
Also there isnt any significance to it being between tags, is there?

neil.c
07-18-2002, 11:32 AM
the # doesn't mean anything, it's just a dud link. a link has to have a href or it won't use the hyperlink formatting (eg underlines, hover effects). so putting a dud href like '#' or 'javascript:;' means the link looks like a link, but doesn't actually go anywhere. anything the link does is put into a javascript in an event handler like onmouseover.

you could also use this function in a regular link to pop up a new window:

<a href="javascript:ow('blah.html')">click here!</a>

it doesn't matter where you put a script tag, just as long as it is loaded before it is used. but being between the head and body might mean it doesn't work, and it's bad practice anyway. i usually put functions into the head.