PDA

View Full Version : Probably an easy one....


snowtown
07-15-2002, 02:11 PM
I've tried the following code in IE6, NS6.2 and Opera6.01 but it only works in IE, why?

I have the following function in an external .js file:

function goto(where){
window.location = where;
}


And the following code in the .asp document:

.....
<td onclick="goto('default.asp');">
.....

But when I click the <td>, nothing happens.

mordred
07-15-2002, 02:22 PM
goto is a reserverd keyword for javascript. You should refrain form using it, although IE accepts that anyway.
NS and Opera are reacting the right way.

See also
http://devedge.netscape.com/docs/manuals/js/core/jsref15/keywords.html#1004016

Just change your function name to something different from a reserved keyword, for example gotoPage and it will work both in Opera and NS6 (better use NS7).

snowtown
07-15-2002, 02:32 PM
Yes of course! :thumbsup:

Thanks