By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,137 Members | 1,205 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,137 IT Pros & Developers. It's quick & easy.

Calling function from html hyperlink

P: 2
I have an webform that shows an html file in an iFrame. In the html file, I need to mark up some of the text as a hyperlink so that when a user clicks it, it calls an function on the server, passing the text of the hyperlink as a parameter.

e.g. in the html file, I have this
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <p>This is <myTag>some</myTag> text </p>
  3. </html>
the question is, what should myTag be, such that the word 'some' appears as a hyperlink, and when the user clicks on it, an function is called with the word 'some' passed in as a parameter?

It would be easier if I could use an linkbutton, but remember this is an html file that's being loaded, so I don't have that option...

maybe the answer is some javascript???

thanks in adv...
May 31 '12 #1
Share this Question
Share on Google+
2 Replies

P: 293
You can achieve it with JQuery.

Here is the sample code for -

Expand|Select|Wrap|Line Numbers
  1. (document).ready(
  2. function () {
  3. $("myTag").click(function () { // Put in the required functionality.})
  4. }() 
Let me know if this works.
Jun 6 '12 #2

P: 2
thanks madankarmukta, I'm assuming that where you have 'Put in the required functionality', I would have some kind of JQuery ajax call?
But I need to popluate a container control that is on the original webform, but not in the container that is hosting the html. Do you know how I can address another container on the webform?
Jun 8 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.