Y
yogesh.bhardwaj
Hello all
I am trying to modify the link URL when a user clicks on the link.
Following is the code:
<a onClick="document.location.href=modifyURL(this.href);"
href="SOME_DYNAMIC_URL" %>Link</a>
The javascript function, modifyURL(href), works fine and returns the
desired URL, but for some reason, the value of 'href' is not getting
overwritten with the value returned from the js function. It works fine
if I use the following code:
<a onClick="this.href=modifyURL(this.href);" href="SOME_DYNAMIC_URL"
%>Link</a>
But the reason I'm trying to use document.location instead is because
of an IE bug. The string 'Link' actually contains the character '@', if
I use this.href, the URL will be formed perfectly, but right before the
page redirects to the new location, the whole URL will be printed on
the page (replacing the string 'Link'). This "bug" is overcome by using
document.location, but then the URL is not getting updated. Any ideas?
Thanks a lot
-Yogesh
I am trying to modify the link URL when a user clicks on the link.
Following is the code:
<a onClick="document.location.href=modifyURL(this.href);"
href="SOME_DYNAMIC_URL" %>Link</a>
The javascript function, modifyURL(href), works fine and returns the
desired URL, but for some reason, the value of 'href' is not getting
overwritten with the value returned from the js function. It works fine
if I use the following code:
<a onClick="this.href=modifyURL(this.href);" href="SOME_DYNAMIC_URL"
%>Link</a>
But the reason I'm trying to use document.location instead is because
of an IE bug. The string 'Link' actually contains the character '@', if
I use this.href, the URL will be formed perfectly, but right before the
page redirects to the new location, the whole URL will be printed on
the page (replacing the string 'Link'). This "bug" is overcome by using
document.location, but then the URL is not getting updated. Any ideas?
Thanks a lot
-Yogesh