Change hyperlink's URL from client side

Discussion in 'ASP .Net' started by Hardy Wang, Jul 19, 2004.

  1. Hardy Wang

    Hardy Wang Guest

    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
    Hardy Wang, Jul 19, 2004
    #1
    1. Advertising

  2. Hardy Wang

    chenhuawei Guest

    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
    "Hardy Wang" <> дÈëÓʼþ
    news:...
    > 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
    >
    >
    chenhuawei, Jul 20, 2004
    #2
    1. Advertising

  3. Hardy Wang

    Hardy Wang Guest

    Yes, I know OnClick, but it does not work.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    Hardy Wang, Jul 20, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian W
    Replies:
    4
    Views:
    3,726
    Brian W
    Mar 4, 2004
  2. Boss302
    Replies:
    0
    Views:
    1,021
    Boss302
    Nov 21, 2006
  3. Bogdan
    Replies:
    2
    Views:
    637
    Bogdan
    Jun 9, 2008
  4. Zoe Hart
    Replies:
    1
    Views:
    348
    Scott Wisniewski
    Jan 8, 2004
  5. castnblast
    Replies:
    0
    Views:
    74
    castnblast
    Dec 1, 2004
Loading...

Share This Page