How can I fire my (existing) custom control on hyperlink click?

I have developed a custom control (stored locally) that when called from a web page reads a local XML file, interprets the data and returns formatted HTML to be included on the calling web page.  I can hard code a filename in the control call and it all works.  Now I need to include a variable list of more than one filename (as hyperlinks) on the web page.  The user should be able to click a link and the control will be called (again) passing the selected filename and updating the page with the returned HTML.  FYI the returned HTML fills out the middle of a <table> with rows/cols including inline styles, color, fonts, etc.

I'm not sure where to start.  I'm not sure how to repaint the updated HTML without a page refresh.  And since all the processing is done locally (client side - no server), I think  a page refresh would lose the user's selection anyway.  I guess I could use Javascript (or even vbs) to update the DOM with values, but my control returns pretty complicated HTML.  I'd end up writing more js code to interpret the returned HTML and mapping that to the DOM than is reasonable.  If this is the only way I'd probably be better off rewriting my control to return the XML and process it on the page in Javascript to update the DOM.  But honestly I'm not really feel qualified to take that on. I'm hoping there is something I'm missing...

Here is an example that calls my control.
<html>
<body>
<!-- THIS CODE WILL WORK CALLING THE FILE C:\StaticFile1.xml -->
  <table width="100%">	
    <tr>
      <td>Table Heading</td>
    </tr>
    <!-- THE REST OF THE TABLE IS CREATED BY OUR ACTIVE X CONTROL... -->
  
      <script language="vbscript">
        set obj = CreateObject("MyHelper.MyHelper")
        str = obj.ProcessMWTSummary( "C:\StaticFile1.xml")
        document.writeln(str)  
        set obj = nothing
      </script>
  
  </table>
</body>
</html>
 
 
Obviously the vbs would be moved to a sub but this gives an idea what I need to do:
<html>
<body>
<!-- I NEED SOMETHING LIKE THIS THAT WILL UPDATE THE TABLE CONTENTS BASED ON THE USER SELECTION -->
 
  <p><a href="C:\file1.xml">File1</a></p>  <!-- click any of these and the filename is passed -->
  <p><a href="C:\file2.xml">File2</a></p>  <!-- to the vbs, the control is called and the HTML is updated -->
  <p><a href="c:\file3.xml">File3</a></p>
 
  <table width="100%">	
    <tr>
      <td>Table Heading</td>
    </tr>
    <!-- THE REST OF THE TABLE IS CREATED BY OUR ACTIVE X CONTROL... -->
  
      <script language="vbscript">
        set obj = CreateObject("MyHelper.MyHelper")
        str = obj.ProcessMWTSummary( "{CHANGES BASED ON USER SELECTION}")
        document.writeln(str)  
        set obj = nothing
      </script>
  
  </table>
</body>
</html>

Open in new window

graylintAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
<style type="text/css">
<!--
.file{text-decoration:underline;color:blue;}
-->
</style>
<script language="vbcript" type="text/vbscript">
Sub executeControl(file,o)
	'change the text color so it appears as a "visited link"
	o.style.color="#990099"
 
	Set obj = CreateObject("MyHelper.MyHelper")
	document.getElementById("result").innerHTML = "<table width='100%'><tr><td>Table Heading</td></tr>" & obj.ProcessMWTSummary(file) & "</table>"
	Set obj = nothing
End Sub
</script>
</head>
<body>
<!-- I NEED SOMETHING LIKE THIS THAT WILL UPDATE THE TABLE CONTENTS BASED ON THE USER SELECTION -->
 
  <p><a class="file" onclick='call executeControl("C:\file1.xml",Me)'>File1</a></p>  <!-- click any of these and the filename is passed -->
  <p><a class="file" onclick='call executeControl("C:\file2.xml",Me)'>File2</a></p>  <!-- to the vbs, the control is called and the HTML is updated -->
  <p><a class="file" onclick='call executeControl("c:\file3.xml",Me)'>File3</a></p>
 
	<div id="result"></div>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
graylintAuthor Commented:
We are busy reworking the control right now so I can't test your suggestion just yet.  But I do understand what you are suggesting and I think it is a good plan.  I didn't want to make you wait for the points on this.  I appreciate your answer.

There will be details to work out, but you gave me a great start.  Hopefully you won't mind if I have a quick question if I run into a jam once I get to test your plan.  I don't expect to since your solution is very clear.

Thanks so much for your help! - Robert
0
graylintAuthor Commented:
Thanks for your suggestion Hielo!  Your plan looks good and your code is very clear.

Thanks again for your help!
- Robert
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Components

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.