0
votes

I'm using both javascript/vbscript in my HTA and am building the table for my HTA interface inside of a VBS loop. When I simply run:

strHTML = strHTML & "<tr>" &_ 
        "<td><a id=""" & aName & """ href=""javascript:toggleRow('" & rowName & "','" & arrTemp(1) & "','" & aName & "')"">+ </a>" & arrTemp(1) & "</td>" & _
        "<td>" & arrTemp(2) & "</td><td class='status'>" & _
        "<img onclick=""displayRow()"" src='" & strStatus & "' border='0'></td></tr>" & _
        "<tr id='" & rowName & "' style=""display:none;""><td id='" & arrTemp(1) & "' colspan=""3"">test</td></tr>"

...my HTA displays fine. But when I try to add Javascript functions to my TR tag, I get all sorts of VBS errors:

strHTML = strHTML & "<tr onmouseover=""ChangeColor(this, true);"" onmouseout=""ChangeColor(this, false);"" onclick=""DoNav();"">" &_ 
        "<td><a id=""" & aName & """ href=""javascript:toggleRow('" & rowName & "','" & arrTemp(1) & "','" & aName & "')"">+ </a>" & arrTemp(1) & "</td>" & _
        "<td>" & arrTemp(2) & "</td><td class='status'>" & _
        "<img onclick=""displayRow()"" src='" & strStatus & "' border='0'></td></tr>" & _
        "<tr id='" & rowName & "' style=""display:none;""><td id='" & arrTemp(1) & "' colspan=""3"">test</td></tr>"

I'm pretty sure I've commented out the extra quotations correctly but I can't get it to work. Can anyone see what I'm doing wrong just on the first line?

Edit: Additionally, if i leave all of the on* events with their associated 4 quotes but remove all of the internal javascript functions, the page loads fine if that helps at all

1

1 Answers

1
votes

Ah... found the answer. the HTA was interpreting the functions as VBS functions. An explicit declaration to javascript is what did the trick:

strHTML = strHTML & "<tr onmouseover=""javascript:ChangeColor(this, true);"" onmouseout=""javascript:ChangeColor(this, false);"" onclick=""javascript:DoNav();"">" &_ 
                          "<td><a id=""" & aName & """ href=""javascript:toggleRow('" & rowName & "','" & arrTemp(1) & "','" & aName & "')"">+ </a>" & arrTemp(1) & "</td>" & _
                          "<td>" & arrTemp(2) & "</td><td class='status'>" & _
                          "<img src='" & strStatus & "' border='0'></td></tr>" & _
                          "<tr id='" & rowName & "' style=""display:none;""><td id='" & arrTemp(1) & "' colspan=""3"">test</td></tr>"