[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details

Jquerny doesn't work from VB script function

Asked by SameerMirza in JavaScript, VB Script

Tags: VB Script

Hi all,

I am dealing with an application, developed in hta and Visual basic. All I was asked was to add the sorter functionality to the dynamically populated table (using the data obtained by the WMI connection made to a machine, to get the DNS records).

It is bassically just a html code that I need to run to get the sorter working, which call the jscript and CSS. Here is the code,


Code:
document.write "<div id = ""main""> <div id = ""demo""> <table cellspacing = ""1"" class = ""tablesorter"">"
document.write "<thead><tr><th>First Name</th><th>Age</th></tr></thead>"
document.write "<tbody><tr><td>Parker</td><td>90</td></tr>"
document.write "<tr><td>arker</td><td>70</td></tr>"
document.write "<tr><td>rker</td><td>80</td></tr>"
document.write "</tbody></table></div><br>"Now coz I dont have much idea about the Visual basic, when I run this code as it is out side the function ConnectToDNSServer() (in the below code) it works fine but I try to put it inside it does not take the functionality from CSS and the jscript it is calling. Here is the code,


Code:
Sub ConnectToDNSServer()
Dim strDNSServer, inFile, i
strDNSserver = InputBox("Enter the DNS server to connect to : ", "DNS Server",,200,200)
document.write "<input type=button value=""Connect to Server"" Onclick='ConnectToDNSServer()'>"
      document.write "<h2>Displaying : " & strDNSserver & "</h2>"
      document.write "<hr color=#FF9933>"
      document.write "<div id = ""main""> <div id = ""demo""> "
      document.write "<table   cellpadding=""0"" cellspacing=""4"" border=""1"" width=""600"" class = ""tablesorter"" >"      document.write "<thead>"
      document.write "<tr>"
      document.write "<th>DNS NAME</th>"
      document.write "<th>Type</th>"
      document.write "<th>IP address</th>"
      document.write "<th>Timestamp</th>"
      document.write "</tr>"
      document.write "</thead>"
Dim objDNS, objDNSServer, objRRs, objInst, cnt, recDetailscnt = 0
On Error Resume Next
Err.Clear
Set objDNS = GetObject("winMgmts:\\" & strDNSserver & "\root\MicrosoftDNS")
If Err.number <> 0 Then
MsgBox("Error connecting to DNS Server : " & strDNSserver)
LoadForm()
 Else
Set objRRs = objDNS.ExecQuery("Select * from MicrosoftDNS_ResourceRecord " & _"WHERE ContainerName = 'uk.world.socgen'")
For each objInst in ObjRRs
      recDetails = split(objInst.TextRepresentation)
      document.write "<tbody><tr>"
      document.write "<td>" & recDetails(0) & "</td>"
      document.write "<td>" & recDetails(2) & "</td>"
      document.write "<td>" & recDetails(3) & "</td>"
document.write "<td>" & objInst.Timestamp & "</td></tr></tbody>" & VbCrLf
cnt = cnt + 1
If cnt = 100 Then
document.write " </table></div>"Can any one think of a way out, so that the line,
Set objDNS = GetObject("winMgmts:\\" & strDNSserver & "\root\MicrosoftDNS")
 above would work properly? If I run the test code outside the sub in the VB script it works fine. I am sure that it has to do with the functionality of the sub, I think it reloads the form/page as the test table appears when inserted just before the functions but I am not sure how to get it working inside the sub so that it keeps the functionality after when the form is reloaded?

It is realy very urgent for me to get this piece of code to work. I will appretiate if some one could quickly give me a tip on it.

Regards,
Sameer.
 
Related Solutions
Keywords: Jquerny doesn't work from VB script …
 
Loading Advertisement...
 
[+][-]10/22/09 07:40 PM, ID: 25640992Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/23/09 03:11 AM, ID: 25642835Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/26/09 03:02 AM, ID: 25660794Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/26/09 03:59 AM, ID: 25661036Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/26/09 10:03 AM, ID: 25664351Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10/26/09 10:12 PM, ID: 25669290Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/27/09 03:05 AM, ID: 25670620Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/22/09 01:52 PM, ID: 25883834Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92 - Hierarchy / EE_QW_3_20080625