Changing a link...

  • Thread starter Thread starter Scott Meddows
  • Start date Start date
S

Scott Meddows

I have a regular HTML tag (<a id="link" runat="server">Next</a>) and I want
to change the URL that it points to. How can I change the href in code?
How can I even keep this from displaying if I want to?

Thanks.
 
Sounds like a test question to me :)

link.href = "blah.aspx"
link.visible = false

--Michael
 
You'll need to give it an ID first of all. Something like:

<a id="link" id="MyLink" runat="server">Next</a>

You'll then be able to change the link using:

MyLink.HRef = "anotherlink.aspx"

And hide it using:

MyLink.Visible = False


Dan
 
Back
Top