Forum Moderators: open

Message Too Old, No Replies

Jump link Question

location.href = uri not working

         

flashfan

8:10 pm on Jul 27, 2004 (gmt 0)

10+ Year Member




<script language="Javascript">
function go (uri){
location.href=uri;
return false;
}

</script>

<A href="javascript:" onClick="go('http://www.google.com');">Test</a>

I don't know why the JS not working. Any hint?

drHtml

8:43 pm on Jul 27, 2004 (gmt 0)



Hi,

Try Replace this
<A href="javascript:onClick=go('http://www.google.com');">Test</a>

Hope this helps,

Chiu

flashfan

8:55 pm on Jul 27, 2004 (gmt 0)

10+ Year Member



Your example works. Another solution:

<A href='#' onClick="go('http://www.google.com');">Test</A>

The onClick should overwrite href. I am confused. I tried replace "return false" with "return true" or "", no luck.

flashfan

4:59 pm on Jul 28, 2004 (gmt 0)

10+ Year Member



Either of the following works:

<a href='#' onClick="go(uri)">Test</a>

or

<a href="javascript:go(uri)">Test</a>

but this doesn't work:

<a href='javascript:' onClick="go(uri)">Test</a>

onClick should overwrite href, shouldn't it?