02 August 2008

Before few days a go, It was a requirement to create a menu dynamically and apply link in to it.

Here it is a simple example to create hyperlink to the div tag.



Here in the above image you can see that, there are two menu with div tag, If I'm using HyperLink tag it will just create hyperlink to the text only. But if I want to create HyperLink to the entire block, I will not happens with simple "A" anchor tag.

So here is that trick.




See the above image, there is a style with cursor:pointer; style. It will started to show hyperlink mouse pointer to that image tag.

Now lets add hyper link to the div tag using some javascript.



You can see that using "onClick" event of that div tag have some javascript.

onclick="document.location='./TestPage1.aspx';"

It means when user will click on that div tag it will redirect the page to the "TextPage.aspx"

1 comment :

  1. I think you should be more elaborate . Even though i like to thank you for this new trick.

    ReplyDelete