0
votes

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.

1
Why you are using Writeln() to create td element? - Jorge Mejia
I'm doing code maintenance, and that is what was there already.Is there a better way? - Potemkyn
The variable you want to pass is in the HTML document? - Jorge Mejia
It comes from a table: For intI = 0 To UBound(arrData,2) Course_ID = arrData(0,intI) Course_Name = arrData(1,intI) TOPIC_ID = arrData(2,intI) - Potemkyn
Ok, when you loop your array, where did you put TOPIC_ID ? - Jorge Mejia

1 Answers

0
votes

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.