Change hyperlink's URL from client side

H

Hardy Wang

Hi,
I have a web form with a Hyperlink control, which renders client code
like:
<form id="form1" name="form1">
<a href="a.aspx?p=ppppp" id="mylink" target="_blank" >
</form>

What a need is when this link is clicked, I need to trigger a client
side JavaScript function to append some other parameter to exsting query
string, and then new window opens. I have to run this from client.

<script language="javascript">
function MyFunc() {
document.form1.mylink.href += "&b=NePrameter";
}
</script>

This method doesn't work.

Anybody has some idea?


Thanks

Hardy
 
C

chenhuawei

Did you forgot the onclick event?
<a href="a.aspx?p=ppppp" id="mylink" target="_blank" onclick="MyFunc()">
and then you can debug from the browser.maybe can help you
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top