0

I am attempting to populate a button dynamically using VBScript and call a JavaScript function from it passing a parameter (I'd like to pass 2). Here's what I have:

WriteLn ("<td nowrap class=""ContentActionSmall"">
<input type='button' name='VeiwReport' value='VIEW REPORT' 
onclick='jsfunction()'> </td>"

This is a static call to the jsfunction:

function jsfunction(lnk)
{
    alert("fx called V0.4 "+lnk);
    go_pop_upA("/aa/rpt/detailedReport_go.asp");
}

This part also works. But it is static. I need to pass a variable inside the onclick='jsfunction() like this:

WriteLn ("<td nowrap class=""ContentActionSmall"">
<input type='button' name='VeiwReport' value='VIEW REPORT' 
onclick='jsfunction(TOPIC_ID)'> </td>"

When I do this, jsfunction does not execute.

I've tried a number of things, including calling a VBScript Function or sub with the VB functions and subs not executing (calling jsfunction)

The goal is to open another page with the TOPID_ID and another string passed to the new page, which will be a popup window the user can close. So the above code, which was mostly in place when I started, does not have to remain the same.

user692942
  • 16,398
  • 7
  • 76
  • 175
Potemkyn
  • 3
  • 4

1 Answers1

0

Okay, this was... too complex a way to approach this. So I ditched the input/button and went back to this:

Response.Write("<td nowrap class=""ContentActionSmall"">
<a href=""javascript:go_pop_up('/aa/rpt/detailedReport_go.asp?
TOPIC_ID="& TOPIC_ID &"')"">View Report</a>")

This worked.

user692942
  • 16,398
  • 7
  • 76
  • 175
Potemkyn
  • 3
  • 4
  • Don't use `< a href="javascript:...">...` it's doesn't degrade nicely! See [Href attribute for JavaScript links: “#” or “javascript:void(0)”?](http://stackoverflow.com/a/135120/692942), it's a throwback from an earlier time and shouldn't be anywhere in modern code. – user692942 Mar 17 '16 at 11:23
  • Also [javascript:; vs javascript:void(0);](http://stackoverflow.com/a/3125685/692942) – user692942 Mar 17 '16 at 11:29