Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


This is really urgent, please help

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,1099
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> This is really urgent, please help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 This is really urgent, please help - 6/29/2004 7:02:27 AM   
  ramsateesht

 

Posts: 1
Score: 0
Joined: 6/29/2004
From: India
Status: offline
This is my html code in which I am using a vb script. this whole code is being generated by a cgi written in Perl. But I am getting errors just download the code and place a sample xml file as given below and try browsing the page.

#####################HTML FILE##################

<html>
<head>
<title> This is the C1 Question Bank </title>
<script type='text/vbscript'>
function evaluate(xmlDoc)
set answers = xmlDoc.getElementsByTagName("answer")
Dim useranswers(100)
Dim i,j,k
For i = 0 to answers.length-1
For j = 0 to Document.exam.Elements.Count-1
If Document.exam.Elements(j).Name = (i+1) Then
useranswers(i) = Document.exam.Elements(j).Value
End if
Next j
Next i
Dim Score = 0
For k = 0 to answers.length-1
If useranswers(k) = answers(k) Then
Score++
End if
Next
msgbox " Your Score is : " & Score
end function
</script>
</head>
<body>
<script type="text/vbscript">
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("C1.xml")
set x1 = xmlDoc.getElementsByTagName("number")
set x2 = xmlDoc.getElementsByTagName("question")
set x3 = xmlDoc.getElementsByTagName("choice1")
set x4 = xmlDoc.getElementsByTagName("choice2")
set x5 = xmlDoc.getElementsByTagName("choice3")
set x6 = xmlDoc.getElementsByTagName("choice4")
document.write("<form name=exam action=submit.cgi method=GET> ")
document.write(" <input type=hidden name=id value=82877807617188 ></input> ")
document.write(" <b> ")
for i = 1 to x1.length
document.write("<br><br>")
document.write(" <pre> ")
document.write(x1.item(i-1).text)
document.write(".   ")
document.write(x2.item(i-1).text)
document.write(" </pre> ")
document.write("<br><br>")
document.write("<font color=blue> ")
document.write(" <pre> ")
document.write("1.   ")
document.write("<input type=radio name=")
document.write(x1.item(i-1).text)
document.write(" value=1>")
document.write(x3.item(i-1).text)
document.write("</input>")
document.write(" </pre>")
document.write(" <pre>")
document.write(" 2.  ")
document.write(" <input type=radio name=")
document.write(x1.item(i-1).text)
document.write(" value=2>")
document.write(x4.item(i-1).text)
document.write("</input>")
document.write(" </pre>")
document.write(" <pre>")
document.write(" 3.  ")
document.write(" <input type=radio name=")
document.write(x1.item(i-1).text)
document.write(" value=3>")
document.write(x5.item(i-1).text)
document.write("</input>")
document.write(" </pre>")
document.write(" <pre>")
document.write(" 4.  ")
document.write(" <input type=radio name=")
document.write(x1.item(i-1).text)
document.write(" value=4>")
document.write(x6.item(i-1).text)
document.write("</input>")
document.write(" </pre></font>")
document.write("<br>")
next
document.write(" </b> ")
document.write(" <input type=button value=Submit onClick='evaluate(xmlDoc)'> </input> ")
document.write(" </form> ")
</script>
</body>
</html>

#####################XML FILE####################

<?xml version="1.0" encoding="ISO-8859-1"?>
<questionbank>
<questions>
<number>1</number>
<question>
This is a sample question
</question>
<choice1>
Compilation error at Step3
</choice1>
<choice2>
Compilation error at Step2
</choice2>
<choice3>
file1: 10
</choice3>
<choice4>
main : 10
</choice4>
<answer>4</answer>
</questions>
</questionbank>

Thanks in advance

Ram
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> This is really urgent, please help Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts