Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help to adapt a script to work with IE5.5X

Status
Not open for further replies.

fuzion

IS-IT--Management
Jun 4, 2001
1
GB
I run a website for a little known freeware app that I hasten to add I didnt write called trandumper. This excellent little utility converts any text file formatted in a certain way into a practice exam.

The problem is that if you try and use this util in ie5.5+ it will not run correctly. It works to a point and then when you press the ready to go button to start exam nothing happens whereby it should be reading contents of the text file and converting it ???

Here is the trandumper.htm file which contains the code. I would really appreciate help with this as people are always asking me why it doesnt work properly with newer variants of IE

<html>
<script Language=&quot;JavaScript&quot;>
function ShowHint() {
if (parent.up.JJ.indexOf('['+parent.up.II+']')<0)
{
parent.up.JJ=parent.up.JJ + '[' + parent.up.II + ']';
}
for (i=0;i<parent.side.myChkbx.length;i++)
{
parent.side.myChkbx(i).disabled = true;
if (parent.up.Ans(parent.up.II).indexOf(parent.up.Opti(parent.up.II, i+1))>=0)
{
parent.side.SELE(i).innerHTML='<font color=red><b>' + parent.up.Opti(parent.up.II,i+1) + '. ';
parent.side.ENGL(i).innerHTML='<font color=red><b>' + parent.up.Body(parent.up.II,i+1);
}
}
parent.side.COMM.innerHTML='<font face=Verdana color=red size=2><b>Answer:&nbsp' + parent.up.Ans(parent.up.II) + '</b></font><br><font size=2 face=Verdana color=DarkBlue>' + parent.up.Desc(parent.up.II);
}

var intHours, intMinutes, intSeconds;
intHours = 0;
intMinutes = 0;
intSeconds = 0;

function tick() {
var hours, minutes, seconds;
var nowHowers, nowMinutes, nowSeconds;
var today;
today = new Date();
nowHours = today.getHours();
nowMinutes = today.getMinutes();
nowSeconds = today.getSeconds();
intSeconds++;
if (intSeconds>=60) {
intSeconds -= 60;
intMinutes++;
}
if (intMinutes>=60) {
intMinutes -= 60;
intHours++;
}
if (intHours < 10) {
hours = &quot;0&quot;+intHours+&quot;:&quot;;
} else {
hours = intHours+&quot;:&quot;;
}
if (intMinutes < 10) {
minutes = &quot;0&quot;+intMinutes+&quot;:&quot;;
} else {
minutes = intMinutes+&quot;:&quot;;
}
if (intSeconds < 10) {
seconds = &quot;0&quot;+intSeconds+&quot; &quot;;
} else {
seconds = intSeconds+&quot; &quot;;
}
if (nowHours < 10) {
nowHours = &quot;0&quot;+nowHours;
}
if (nowMinutes < 10) {
nowMinutes = &quot;0&quot;+nowMinutes;
}
if (nowSeconds < 10) {
nowSeconds = &quot;0&quot;+nowSeconds;
}
parent.topp.Now.innerHTML = nowHours+&quot;:&quot;+nowMinutes+&quot;:&quot;+nowSeconds;
timeString = hours+minutes+seconds;

parent.topp.Clock.innerHTML = timeString;

window.setTimeout(&quot;tick();&quot;, 1000);
}
</script>
<script Language=&quot;VBScript&quot;>
Dim Subject(400)
Dim Body(400,12)
Dim Opti(400,12)
Dim Usr(400)
Dim Ans(400)
Dim Markk(400)
Dim Desc(400)
Dim II, MM, JJ, DISAB
Dim MAXIMI, MAXIMJ
Dim AA, LOGO, FOLDER, PAScore, WRIGHTS, WRONGS, TOTALS, answermode
Dim R(), S()
WRIGHTS=0
WRONGS=0
TOTALS=0
PAScore = 800
DISAB = &quot;&quot;
II=0
JJ=&quot;&quot;
MM=0
MAXIMI=400
MAXIMJ=12

Sub window_onLoad()
If location.search = &quot;&quot; Then
window.open &quot;./Trandumper.htm?index&quot;,&quot;index&quot;,&quot;width=630,height=430,top=&quot; & (screen.height-480)/2 & &quot;,left=&quot; & (screen.width-640)/2 & &quot;,directories=no , Toolbar = no, resizable = yes, menubar = no, ScrollBars = yes&quot;
ElseIf location.search = &quot;?index&quot; Then
IndexFrame()
ElseIf location.search = &quot;?hid&quot; Then
answermode = 0
AA = &quot;DEFAULT&quot;
FOLDER = &quot;&quot;
LOGO = &quot;<center><table border=0><tr><img id=GIF src='./images/logo.jpg'></tr></table></center><table border=0 width=90%><tr><td align=right><i><font face='verdana,arial,helvetica' size=1 color=black><b>Designed by: </font><font face='verdana,arial,helvetica' size=1 color=brown><b>Peter Pan, JT</font></tr></table>&quot;
ElseIf location.search = &quot;?first&quot; Then
FirstPage()
ElseIf location.search = &quot;?second&quot; Then
SecondPage()
ElseIf location.search = &quot;?review&quot; Then
Review()
ElseIf location.search = &quot;?frame&quot; Then
WriteFrame()
ElseIf location.search = &quot;?up&quot; Then
ReadFile()
ElseIf location.search = &quot;?topp&quot; Then
WriteTopp()
ElseIf location.search = &quot;?left&quot; Then
document.write &quot;<html><body background='./images/bg1.gif' leftmargin=0>&nbsp;<p>&nbsp;<p>&nbsp;<p><img id=GIF src='./images/blank.gif'></body></html>&quot;
ElseIf location.search= &quot;?right&quot; Then
document.write &quot;<html><body background='./images/bg1.gif'></body></html>&quot;
ElseIf location.search= &quot;?0&quot; Then
parent.up.II=0
HomePage()
ElseIf location.search= &quot;?1&quot; Then
If top.hid.answermode=1 Then
parent.up.JJ = &quot;&quot;
For i = 1 To parent.up.MM
parent.up.JJ = parent.up.JJ & &quot;[&quot; & i & &quot;]&quot;
Next
End If
parent.left.GIF.src=&quot;./images/blank.gif&quot;
parent.up.II = parent.up.II + 1
If InStr(parent.up.JJ, &quot;[&quot; & parent.up.II & &quot;]&quot;) > 0 Then
parent.up.DISAB = &quot;DISABLED&quot;
Else
parent.up.DISAB = &quot;&quot;
End If
If parent.up.II = 1 Then
parent.topp.Marked.disabled = False
parent.down.prev.disabled = True
parent.down.nextt.disabled = False
parent.down.answ.disabled = False
parent.down.review.disabled = False
Else
parent.down.prev.disabled = False
End If
If parent.up.II = parent.up.MM Then parent.down.nextt.disabled = True
If parent.up.Markk(parent.up.II) = 1 then
parent.topp.Marked.checked = True
Else
parent.topp.Marked.checked = False
End If
WriteSide()
ElseIf location.search= &quot;?2&quot; Then
parent.left.GIF.src=&quot;./images/blank.gif&quot;
If parent.up.II > 1 Then parent.up.II = parent.up.II - 1
If InStr(parent.up.JJ, &quot;[&quot; & parent.up.II & &quot;]&quot;) > 0 Then
parent.up.DISAB = &quot;DISABLED&quot;
Else
parent.up.DISAB = &quot;&quot;
End If
If parent.up.II = 1 Then parent.down.prev.disabled = True
If parent.up.II < parent.up.MM Then parent.down.nextt.disabled = False
If parent.up.Markk(parent.up.II) = 1 then
parent.topp.Marked.checked = True
Else
parent.topp.Marked.checked = False
End If
WriteSide()
ElseIf location.search= &quot;?down&quot; Then
WriteDown()
Else
End If
End Sub

Sub Review()
Dim intHI
Dim myII
myII = 0
parent.left.GIF.src=&quot;./images/blank.gif&quot;
If (parent.up.MM mod 4 = 0) Then
intHI = Int(parent.up.MM / 4)
Else
intHI = Int(parent.up.MM / 4) + 1
End If
document.write &quot;<html><body><center><table border=5 cellspacing=0 cellpadding=0><tr valign=top>&quot;
For j = 1 To 4
document.write &quot;<td width=120><table cellspacing=0 cellpadding=0>&quot;
For i = 1 To intHI
myII = myII + 1
If myII > parent.up.MM Then Exit For
document.write &quot;<tr><td align=right><nobr><button onClick=&quot;&quot;parent.up.II=&quot; & myII-1 & &quot;;parent.side.location.href='Trandumper.htm?1';&quot;&quot;><font face=Verdana style='font-size:12px'>&quot;
document.write myII
If Len(myII) <2 Then document.write &quot;&nbsp;&nbsp;&quot;
document.write &quot;(&quot; & Left(top.hid.AA,1) & parent.up.S(myII)
If Len(parent.up.S(myII)) < 2 Then document.write &quot;&nbsp;&nbsp;&quot;
document.write &quot;).&quot; & &quot;</button>&quot;
'==========Write Answer===========
If (parent.up.Usr(myII) <> &quot;&quot; and InStr(parent.up.JJ, &quot;[&quot; & myII & &quot;]&quot;) > 0) Then
document.write &quot;<td><nobr><font &quot;
If ChkAnswer(myII) = True Then
document.write &quot;color=blue&quot;
Else
document.write &quot;color=red&quot;
End If
document.write &quot; face=Verdana style='font-size:16px'><b>&quot; & parent.up.Usr(myII) & &quot;</b></font>&quot;
Else
document.write &quot;<td><font face=Verdana style='font-size:16px;background-color:red;'>&quot;
If parent.up.Usr(myII) <> &quot;&quot; Then
document.write parent.up.Usr(myII)
Else
document.write &quot;&nbsp;|&nbsp;</font>&quot;
End If
End If
document.write &quot;</tr>&quot;
Next
document.write &quot;</table></td>&quot;
Next
document.write &quot;</tr></table>&quot;
document.write &quot;<button onClick=&quot;&quot;if((gotoo.value.slice(0,1).toUpperCase()>='A') && (gotoo.value.slice(0,1).toUpperCase()<='Z')) {parent.up.II=parent.up.R(gotoo.value.slice(1))-1;} else {parent.up.II=gotoo.value-1};parent.side.location.href='Trandumper.htm?1'&quot;&quot;>Review Item</button>&quot;
document.write &quot;<input type=text ID=gotoo NAME=gotoo size=4 maxlength=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;
document.write &quot;<button onClick=&quot;&quot;if (WRONG.value.length>0) {parent.up.SaveWrong();}&quot;&quot;>Save Wrong To</button>&quot;
document.write &quot;<input type=text ID=WRONG NAME=WRONG size=15 maxlength=30 value='Z.My Wrongs.txt'>&quot;
document.write &quot;</body></html>&quot;
End Sub

Sub IndexFrame()
document.write &quot;<title>TranDumper v1.1</title><frameset framespacing=0 rows='0,*' frameborder=NO>&quot; &_
&quot;<frame src='./Trandumper.htm?hid' name='hid' marginwidth=0 &quot; &_
&quot;frameborder=NO scrolling=NO NORESIZE>&quot; &_
&quot;<frame src='./Trandumper.htm?first' name='main' marginwidth=0 &quot; &_
&quot;frameborder=NO scrolling=AUTO NORESIZE></frameset>&quot;
End Sub

Sub FirstPage()
Dim fs, f, fc, f1, s, a, strTmp(30), isEnd
Dim PATH, i
PATH = mid(location.pathname, 2, len(location.pathname)-15)
Set fs=CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f =fs.GetFolder(PATH)
Set fc=f.SubFolders
i = 0
strPAGE = &quot;<dd><font face='verdana,arial,helvetica' size=2 color=black><b>Please select one exam type:</b></font><p>&quot; &_
&quot;<center><table border=0 cellpadding=10><tr align=center>&quot;
For Each s in fc
If UCase(right(s, 6))<> &quot;IMAGES&quot; Then
If i mod 5 =0 Then strPAGE = strPAGE & &quot;</tr><tr align=center>&quot;
i = i + 1
strTmp(i) = Right(s, Len(s) - Len(PATH))
strPAGE = strPAGE & &quot;<td><a onClick=&quot;&quot;VBSCript:top.hid.FOLDER='&quot; & PATH & strTmp(i) & &quot;\':document.location.href='./trandumper.htm?second'&quot;&quot;><img src='./images/icon.gif' border=0><br><font face='verdana,arial,helvetica' color=brown size=2><b><i>&quot; & strTmp(i) & &quot;</i></b></font></a>&quot;
End If
Next
top.document.title = &quot;TranDumper v1.1&quot;
document.write &quot;<html><body background='./images/bg1.gif'>&quot; & top.hid.LOGO & strPAGE & &quot;</tr></table>&quot; &_
&quot;<center><button onClick=&quot;&quot;VBScript:top.window.close&quot;&quot;><font size=2 face=Arail><b>&nbsp;&nbsp;&nbsp;<u>E</u>xit&nbsp;&nbsp;&nbsp;</b></font></button></center></body></html>&quot;
End Sub

Sub SecondPage()
Dim fs, f, fc, f1, s, a, strTmp, isEnd
Dim PATH, i
Set fs=CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set f = fs.GetFolder(top.hid.FOLDER)
Set fc=f.Files
FILES=&quot;&quot;
i = 0
For Each f1 in fc
If UCase(Right(f1.name,3)) = &quot;TXT&quot; or (UCase(right(f1.name,3)) = &quot;HTM&quot; and UCase(Right(f1.name,14)) <> &quot;TRANDUMPER.HTM&quot; and UCase(Right(f1.name,10))<>&quot;README.HTM&quot;) Then
Set a = fs.OpenTextFile(top.hid.FOLDER & f1.name, 1, False)
MEMO = MEMO & &quot;<input type=hidden name=MEMO value=&quot;&quot;&quot;
Do While a.AtEndOfStream <> True
strTmp=Trim(join(split(a.ReadLine, Chr(9)),&quot;&quot;))
arrTmp = Split(strTmp, &quot;.&quot;)
If UBound(arrTmp) = -1 Then
ReDim arrTmp(0)
End If
If NOT IsNumeric(arrTmp(0)) Then arrTmp(0) = 0
If arrTmp(0)> 0 and arrTmp(0) < 999 Then ' ¬O Subject
Exit Do
Else
If Len(strTmp) > 0 Then
MEMO = MEMO & &quot; &quot; & strTmp
Else
MEMO = MEMO & vbCrLf
End If
End If
Loop
MEMO = MEMO & &quot;&quot;&quot;>&quot;
a.Close
Set a = Nothing
i = i + 1
FILES = FILES & &quot;<option value='&quot; & f1.name & &quot;'>&quot; & Left(f1.name, Len(f1.name)-4)
End If
Next
MEMO = MEMO & &quot;<input type=hidden name=MEMO value=''><input type=hidden name=MEMO value=''>&quot;
FILES = FILES & &quot;<option value=''>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;
Set fc = Nothing
Set f = Nothing
Set fs = Nothing
top.document.title=&quot;TranDumper v1.1&quot;
document.write &quot;<html><body background='./images/bg1.gif'>&quot; & top.hid.LOGO & &quot;<font size=2 face=Verdana><dd><b>Select a <u>T</u>est:&nbsp;&nbsp;&nbsp;<input type=checkbox name=answermode onClick=&quot;&quot;if (answermode.checked==true) { top.hid.answermode=1} else { top.hid.answermode=0}&quot;&quot;>Answer Mode<br>&quot; & MEMO &_
&quot;<center><select name='myChoice' size=6 onClick=&quot;&quot;if((myChoice.selectedIndex)<0) return(0);if (myChoice(myChoice.selectedIndex).value == '') star.disabled = true;if(myChoice(myChoice.selectedIndex).value != '') star.disabled = false; area.value=top.main.MEMO(myChoice.selectedIndex).value;top.hid.AA=myChoice(myChoice.selectedIndex).value&quot;&quot;>&quot; & FILES & &quot;</select></center><dd><u>D</u>escription:</b></font><br><center><textarea rows=7 cols=58 name=area></textarea><br><button name=star disabled onClick=&quot;&quot;document.location.href='Trandumper.htm?frame'&quot;&quot;>&nbsp;&nbsp;&nbsp;&nbsp;<b><u>S</u>tart</b>&nbsp;&nbsp;&nbsp;&nbsp;</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onClick=&quot;&quot;document.location.href='Trandumper.htm?first'&quot;&quot;>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font face=Arail><b><u>E</u>xit</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button></center></body></html>&quot;
End Sub

Sub HomePage()
top.document.title=&quot;TranDumper v1.1&quot;
document.write &quot;<center><font color=blue size=5><b><i>&quot; & Left(top.hid.AA, Len(top.hid.AA)-4) & &quot;</i></b></font><p><button OnClick=&quot;&quot;parent.up.tick();document.location.href='./Trandumper.htm?1'&quot;&quot;><font face=Verdana><b><u>R</u>eady to Go</b></font></button></center>&quot;
End Sub

Sub ReadFile()
Dim fs, a
Dim i, j, k, kk, strTmp, arrTmp, blnSubj, blnBody, pre
Dim PATH
For i = 1 To MAXIMI
Markk(i) = 0
Next
i = 0
j = 0
Set fs=CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set a =fs.OpenTextFile(top.hid.FOLDER & top.hid.AA, 1, False)
strTmp = &quot;a&quot;
pre = false
Do While a.AtEndOfStream <> True
If i >= MAXIMI Then Exit Do
strBak = Trim(strTmp)
If i = 0 Then strBak = &quot;&quot;
strTmp = a.ReadLine
If strTmp <> &quot;&quot; and strBak = &quot;&quot; Then
strTmp = Trim(join(split(strTmp, Chr(9)),&quot;&quot;))
strStar = &quot;&quot;
Do While Left(strTmp, 1) = &quot;*&quot;
strTmp = Trim(Right(strTmp, Len(strTmp)-1))
strStar = strStar & &quot;*&quot;
Loop
arrTmp = Split(strTmp, &quot;.&quot;)
If UBound(arrTmp) <=0 Then
ReDim arrTmp(1)
End If
If NOT IsNumeric(arrTmp(0)) Then arrTmp(0) = 0
If arrTmp(0)> 0 and arrTmp(0) < 999 and Len(arrTmp(1)) >4 Then i=i+1
End If
Loop
a.Close
MM = i
Randomize
ReDim R(MM), S(MM)
For i = 1 to MM
R(i) = i
Next
For i = 1 To MM
j = Int(MM*Rnd)+1
tmp = R(j)
R(j) = R(i)
R(i) = tmp
Next
For i = 1 To MM
For j = 1 To MM
If R(j) = i Then
S(i) = j
Exit For
End If
Next
Next

i = 0
j = 0
blnSubj = False
Set a =fs.OpenTextFile(top.hid.FOLDER & top.hid.AA, 1, False)
strTmp = &quot;<BR>&quot;
Do While a.AtEndOfStream <> True
If i >= MAXIMI Then Exit Do
strBak = strTmp
strTmp = a.ReadLine
If InStr(strTmp, &quot;<pre>&quot;) > 0 Then pre = True
If pre=False Then
strTmp = Trim(join(split(strTmp, Chr(9)),&quot;&quot;))
End If
If InStr(strTmp, &quot;</pre>&quot;) > 0 Then pre = False
strStar = &quot;&quot;
Do While Left(strTmp, 1) = &quot;*&quot;
strTmp = Trim(Right(strTmp, Len(strTmp)-1))
strStar = strStar & &quot;*&quot;
Loop
arrTmp = Split(strTmp, &quot;.&quot;)
If UBound(arrTmp) <=0 Then
ReDim arrTmp(1)
End If
If NOT IsNumeric(arrTmp(0)) Then arrTmp(0) = 0
If (strBak = &quot;<BR>&quot; or strBak=&quot;&quot;) and blnSubj=False and arrTmp(0)> 0 and arrTmp(0) < 999 and Len(arrTmp(1)) >4 Then
i = i + 1
K = R(i)
j = 0
Subject(K) = strStar & Right(strTmp, Len(strTmp)-Len(arrTmp(0))-1) & vbCrLf
Ans(K) = &quot;&quot;
Usr(K) = &quot;&quot;
Desc(K) = &quot;&quot;
strONE = Right(Subject(K),1)
If strONE = &quot;.&quot; or strONE = &quot;:&quot; or strONE = &quot;&quot; or strONE = &quot;?&quot; or strONE = &quot;%&quot; or (strONE >=&quot;0&quot; and strONE <=&quot;9&quot;) Then Subject(K) = Subject(K) & &quot;<BR>&quot;
blnSubj = True
blnBody = False
ElseIf (Mid(strTmp, 2, 1) = &quot;)&quot; or Mid(strTmp, 2, 1) = &quot;.&quot;) and UCase(Left(strTmp,1))>=&quot;A&quot; Then
j = j + 1
blnSubj = False
blnBody = True
Body(K, j) = Right(strTmp, Len(strTmp) - 2)
Opti(K, j) = UCase(Left(strTmp, 1))
If UCase(Right(Body(K,j),8)) = &quot;(ANSWER)&quot; Then
If InStr(Ans(K), Opti(K,j))<=0 Then Ans(K)=Ans(K) & Opti(K,j)
Body(K,j) = Left(Body(K,j), Len(Body(K,j))-8)
End If
ElseIf UCase(Left(strTmp, 7)) = &quot;ANSWER:&quot; Then
blnSubj = False
blnBody = False
Ans(K) = UCase(Trim(Right(strTmp, Len(strTmp) - 7)))
Ans(K) = join(split(Ans(K), &quot;AND &quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot;,&quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot; &quot;), &quot;&quot;)
ElseIf UCase(Left(strTmp, 8)) = &quot;ANSWER :&quot; Then
blnSubj = False
blnBody = False
Ans(K) = UCase(Trim(Right(strTmp, Len(strTmp) - 8)))
Ans(K) = join(split(Ans(K), &quot;AND &quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot;,&quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot; &quot;), &quot;&quot;)
ElseIf UCase(Left(strTmp, 4)) = &quot;ANS:&quot; Then
blnSubj = False
blnBody = False
Ans(K) = UCase(Trim(Right(strTmp, Len(strTmp) - 4)))
Ans(K) = join(split(Ans(K), &quot;AND &quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot;,&quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot; &quot;), &quot;&quot;)
ElseIf UCase(Left(strTmp, 5)) = &quot;ANS :&quot; Then
blnSubj = False
blnBody = False
Ans(K) = UCase(Trim(Right(strTmp, Len(strTmp) - 5)))
Ans(K) = join(split(Ans(K), &quot;AND &quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot;,&quot;), &quot;&quot;)
Ans(K) = join(split(Ans(K), &quot; &quot;), &quot;&quot;)
Else
If blnBody = True Then
If Len(strTmp) = 0 Then
blnBody = False
Else
Body(K,j) = Body(K,j) & &quot; &quot; & strTmp
If UCase(Right(Body(K,j),8)) = &quot;(ANSWER)&quot; Then
If InStr(Ans(K), Opti(K,j))<=0 Then Ans(K)=Ans(K) & Opti(K,j)
Body(K,j) = Left(Body(K,j), Len(Body(K,j))-8)
End If
End If
ElseIf blnSubj = True Then
If Left(strTmp, 1) = &quot;-&quot; and Right(Subject(K),4) <> &quot;<BR>&quot; Then strTmp = &quot;<BR>&quot; & strTmp
Subject(K) = Subject(K) & &quot; &quot; & strTmp & vbCrLf
strONE = Right(strTmp,1)
If strONE = &quot;.&quot; or strONE = &quot;:&quot; or strONE = &quot;&quot; or strONE = &quot;?&quot; or strONE = &quot;%&quot; or (strONE >=&quot;0&quot; and strONE <=&quot;9&quot;) Then Subject(K) = Subject(K) & &quot;<BR>&quot;
ElseIf not blnSubj and not blnBody Then
If Left(strTmp, 1) = &quot;-&quot; Then strTmp = &quot;<BR>&quot; & strTmp
strONE = Right(strTmp,1)
If strONE = &quot;&quot; or strONE = &quot;.&quot; or strONE = &quot;:&quot; or strONE = &quot;&quot; or strONE = &quot;?&quot; or strONE = &quot;%&quot; or (strONE >=&quot;0&quot; and strONE <=&quot;9&quot;) then strTmp = strTmp & &quot;<BR>&quot;
Desc(K) = Desc(K) & &quot; &quot; & strTmp & vbCrLf
End If
End If
Loop
a.Close
MM = i

'=== Begin to Sorting Option
'For i = 1 To MM
' MO = 0
' For j=1 To MAXIMJ
' If Opti(i,j) = &quot;&quot; Then Exit For
' MO = MO + 1
' Next
' Ans(i) = Trim(Ans(i))
' For j=1 To MO
' If Opti(i,j) = &quot;&quot; Then Exit For
' k = Int(MO*Rnd)+1
' tmp = Body(i,k)
' Body(i,k) = Body(i,j)
' Body(i,j) = tmp
' Ans(i) = Join(Split(Ans(i),Opti(1,j)),&quot;Z&quot;)
' Ans(i) = Join(Split(Ans(i),Opti(i,k)),Opti(i,j))
' Ans(i) = Join(Split(Ans(i),&quot;Z&quot;),Opti(i,k))
' Next
' NAns = &quot;&quot;
' For j = 1 To MO
' If (InStr(Ans(i), Opti(i,j))>0) Then NAns=NAns & Opti(i,)
' Next
' Ans(i) = NAns
'Next
End Sub


Sub WriteFrame()
FRAM = &quot;<title>TranDumper v1.1</title><frameset framespacing=0 rows='0,20,*,50' frameborder=NO>&quot; &_
&quot;<frame src='./Trandumper.htm?up' name='up' marginwidth=0 &quot; &_
&quot;frameborder=NO scrolling=NO NORESIZE>&quot; &_
&quot;<frame src='./Trandumper.htm?topp' name='topp' marginwidth=0 &quot; &_
&quot;frameborder=NO scrolling=NO NORESIZE>&quot; &_
&quot;<frameset cols='36,*,15' frameborder=YES>&quot; &_
&quot;<frame src='./Trandumper.htm?left' name='left' frameborder=NO bordercolor=white scrolling=NO NORESIZE>&quot; &_
&quot;<frame src='./Trandumper.htm?0' name='side' &quot; &_
&quot;frameborder=YES bordercolor=black scrolling=AUTO>&quot; &_
&quot;<frame src='./Trandumper.htm?right' frameborder=NO bordercolor=white scrolling=NO NORESIZE></frameset>&quot; &_
&quot;<frame src='./Trandumper.htm?down' name='down' &quot; &_
&quot;marginwidth=0 frameborder=NO scrolling=NO frameborder=NO scrolling=NO NORESIZE>&quot; &_
&quot;</frameset>&quot;
document.write FRAM
End Sub

Sub WriteTopp()
top.document.title=&quot;Item &quot; & parent.up.II & &quot; (&quot; & Left(top.hid.AA,1) & parent.up.S(parent.up.II) & &quot;) of &quot; & parent.up.MM & &quot;[&quot; & Left(top.hid.AA, Len(top.hid.AA)-4) & &quot;]&quot;
TOPP=&quot;<html><body background='./images/bg1.gif'><center><table border=0 width=96% cellspacing=0 cellpadding=0>&quot; &_
&quot;<tr><td width=150>&quot; &_
&quot;<font face='Verdana' style='font-size:16px'><input type=checkbox name='Marked' disabled onClick=&quot;&quot;if (Marked.checked) parent.up.Markk(parent.up.II)=1; else parent.up.Markk(parent.up.II)=0;&quot;&quot;> &quot; &_
&quot;<b><u>M</u>ark&quot; &_
&quot;<td><font face='Verdana' style='font-size:16px'><b>Time Now: <font color=blue><span ID=Now>00:00:00&quot;&_
&quot;</span></font></b></font>&quot; &_
&quot;<td align=right><font face='Verdana' style='font-size:16px'><b>Time Elapsed: <font color=blue><span ID=Clock>00:00:00&quot;&_
&quot;</span></font></b></font>&quot; &_
&quot;</tr></table></body></html>&quot;
document.write TOPP
End Sub


Function WriteRadio(ByVal item1, ByVal english)
If item1 = parent.up.Usr(parent.up.II) Then
strChecked = &quot;CHECKED&quot;
Else
strChecked = &quot;&quot;
End If
WriteRadio = &quot;<tr valign=top><td valign=top><input type=radio name=myChkbx &quot; & strChecked & &quot; value='&quot; & item1 & &quot;' &quot; & parent.up.DISAB & &quot; onClick=&quot;&quot;parent.up.Usr(parent.up.II)=this.value;for(i=0;i<myChkbx.length;i++){myChkbx(i).disabled=true;} if(this.value==parent.up.Ans(parent.up.II)){ parent.up.WRIGHTS= parent.up.WRIGHTS + 1; parent.up.TOTALS = parent.up.TOTALS + Math.ceil(1000/parent.up.MM); if(parent.up.TOTALS > 1000) parent.up.TOTALS=1000; parent.down.right.innerHTML=parent.up.WRIGHTS; parent.down.total.innerHTML=parent.up.TOTALS; parent.left.GIF.src='./images/right.gif';myResult='Congratulation!&nbsp;&nbsp;';} else { parent.up.WRONGS= parent.up.WRONGS + 1; parent.down.wrong.innerHTML=parent.up.WRONGS; parent.left.GIF.src='./images/wrong.gif';myResult='Sorry!&nbsp;&nbsp;';} parent.side.MYRESULT.innerHTML=myResult; parent.up.ShowHint();&quot;&quot;><font face=Verdana size=2><span ID=SELE>&quot;
If (parent.up.DISAB<>&quot;&quot; and InStr(parent.up.Ans(parent.up.II), item1)>0) Then WriteRadio = WriteRadio & &quot;<font color=red><b>&quot;
WriteRadio = WriteRadio & item1 & &quot;. </span><td valign=bottom><font face=Verdana size=2><span ID=ENGL>&quot;
If (parent.up.DISAB<>&quot;&quot; and InStr(parent.up.Ans(parent.up.II), item1)>0) Then WriteRadio = WriteRadio & &quot;<font color=red><b>&quot;
WriteRadio = WriteRadio & english & &quot;</span></tr>&quot;
End Function

Function WriteChkbx(ByVal j, item1, ByVal english)
If InStr(parent.up.Usr(parent.up.II), item1) > 0 Then
strChecked = &quot;CHECKED&quot;
Else
strChecked = &quot;&quot;
End If
WriteChkbx = &quot;<tr valign=top><td valign=top><input type=checkbox name=myChkbx &quot; & strChecked & &quot; value='&quot; & item1 & &quot;' &quot; & parent.up.DISAB & &quot; onClick=&quot;&quot;if(myChkbx(&quot; & j & &quot;).checked && parent.up.Usr(parent.up.II).indexOf(myChkbx(&quot; & j & &quot;).value)<0){parent.up.Usr(parent.up.II) = parent.up.Usr(parent.up.II) + '&quot; & item1 & &quot;';} if(! myChkbx(&quot; & j & &quot;).checked && parent.up.Usr(parent.up.II).indexOf(myChkbx(&quot; & j & &quot;).value)>=0){parent.up.Usr(parent.up.II) = parent.up.Usr(parent.up.II).slice(0,parent.up.Usr(parent.up.II).indexOf('&quot; & item1 & &quot;')) + parent.up.Usr(parent.up.II).slice(parent.up.Usr(parent.up.II).indexOf('&quot; & item1 & &quot;')+1, parent.up.Usr(parent.up.II).length);} if(parent.up.Usr(parent.up.II).length==parent.up.Ans(parent.up.II).length) { parent.up.JJ=parent.up.JJ + '[' + parent.up.II + ']'; for(i=0;i<myChkbx.length;i++){myChkbx(i).disabled=true;} j=0; for(i=0;i<parent.up.Usr(parent.up.II).length;i++){ if (parent.up.Ans(parent.up.II).indexOf(parent.up.Usr(parent.up.II).slice(i,i+1))>=0){j=j+1;}} if (j==parent.up.Ans(parent.up.II).length) { parent.up.WRIGHTS= parent.up.WRIGHTS + 1; parent.up.TOTALS = parent.up.TOTALS + Math.ceil(1000/parent.up.MM); if(parent.up.TOTALS>1000)parent.up.TOTALS=1000; parent.down.right.innerHTML=parent.up.WRIGHTS; parent.down.total.innerHTML=parent.up.TOTALS; parent.left.GIF.src='./images/right.gif';myResult='Congratulation!&nbsp;&nbsp;';} else { parent.up.WRONGS= parent.up.WRONGS + 1; parent.down.wrong.innerHTML=parent.up.WRONGS; parent.left.GIF.src='./images/wrong.gif';myResult='Sorry!&nbsp;&nbsp;';} parent.side.MYRESULT.innerHTML=myResult; parent.up.ShowHint();}&quot;&quot;><font face=Verdana size=2><span ID=SELE>&quot;
If (parent.up.DISAB<>&quot;&quot; and InStr(parent.up.Ans(parent.up.II), item1)>0) Then WriteChkbx = WriteChkbx & &quot;<font color=red><b>&quot;
WriteChkbx = WriteChkbx & item1 & &quot;. </span><td valign=bottom><font face=Verdana size=2><span ID=ENGL>&quot;
If (parent.up.DISAB<>&quot;&quot; and InStr(parent.up.Ans(parent.up.II), item1)>0) Then WriteChkbx = WriteChkbx & &quot;<font color=red><b>&quot;
WriteChkbx = WriteChkbx & english & &quot;</span></tr>&quot;
End Function

Sub WriteSide()
Dim HEAD, ITEMS, ansTmp
top.document.title=&quot;Item &quot; & parent.up.II & &quot; (&quot; & Left(top.hid.AA,1) & parent.up.S(parent.up.II) & &quot;) of &quot; & parent.up.MM & &quot; [&quot; & Left(top.hid.AA, Len(top.hid.AA)-4) & &quot;]&quot;
HEAD = &quot;<HTML><BODY BGCOLOR=white leftmargin=0 topmargin=0 rightmargin=0>&quot; &_
&quot;<table border=0 cellspacing=10 cellpadding=0 width=100%><tr><td width=3%><td width=97%>&quot; &_
&quot;<font face='Verdana' size=2>&quot;
SUBJ = parent.up.Subject(parent.up.II)
ITEMS = &quot;&quot;
If Len(parent.up.Ans(parent.up.II)) > 1 Then
ansTmp = join(split(parent.up.Ans(parent.up.II), &quot;,&quot;), &quot;&quot;)
ansTmp = join(split(ansTmp, &quot; &quot;), &quot;&quot;)
parent.down.numbers.innerHTML=&quot;Select <font color=blue>&quot; & Len(ansTmp) & &quot;</font> correct answers.&quot;
Else
parent.down.numbers.innerHTML=&quot;Select the best answer.&quot;
End If
For j = 1 to parent.up.MAXIMJ
If parent.up.Body(parent.up.II, j) <> &quot;&quot; Then
If Len(parent.up.Ans(parent.up.II)) > 1 Then
ITEMS = ITEMS & WriteChkbx(j-1, parent.up.Opti(parent.up.II,j), parent.up.Body(parent.up.II, j))
Else
ITEMS = ITEMS & WriteRadio(parent.up.Opti(parent.up.II,j), parent.up.Body(parent.up.II, j))
End If
ELSE
Exit For
End If
Next
TAIL = &quot;<tr><td><td><font size=4 face=Verdana color=blue><b><span ID=MYRESULT></span></b></font><span ID=COMM>&quot;
If (parent.up.DISAB <> &quot;&quot;) Then TAIL = TAIL & &quot;<font face=Verdana color=red size=2><b>Answer:&nbsp&quot; & parent.up.Ans(parent.up.II) & &quot;</font><br><font size=2 face=Verdana color=DarkBlue><b>&quot; & parent.up.Desc(parent.up.II)
TAIL = TAIL & &quot;&nbsp;<br></span></tr></table></body></html><span ID=SELE></span><span ID=ENGL></span><input type=hidden name=myChkbx>&quot;
document.write HEAD & SUBJ & &quot;<P>&quot; & ITEMS & TAIL
If (InStr(parent.up.JJ, &quot;[&quot; & parent.up.II & &quot;]&quot;)>0) Then
parent.up.ShowHint()
End If
End Sub

Sub WriteDown()
DOWN = &quot;<html><head></head>&quot; &_
&quot;<BODY background='./images/bg1.gif' leftmargin=0 topmargin=0 rightmargin=0>&quot; &_
&quot;<table border=0 cellspacing=0 cellpadding=0><tr><td width=230><font face=Verdana style='font-size:16px'><nobr><b>&nbsp;&nbsp;&nbsp;&nbsp;<span name='numbers' ID='numbers'></span><td><font face=Verdana style='font-size:16px' color=black><b><nobr>Correct:&nbsp;<font color=blue><span ID='right'>0</span></font>&nbsp;,&nbsp;Incorrect:&nbsp;<font color=red><span ID='wrong'>0</span></font>&nbsp;, Your Score:&nbsp;<font color=blue><span ID='total'>0</span></font>/1000</tr></table>&quot; &_
&quot;<center><table border=0 width=96%>&quot; &_
&quot;<tr>&quot; &_
&quot;<td><font face=Verdana style='font-size:12px'><button name=nextt onClick=&quot;&quot;parent.side.location.href='Trandumper.htm?1'&quot;&quot; disabled>&nbsp;&nbsp;&nbsp;<font style='font-size:12px'><b>&quot; &_
&quot;<u>N</u>ext&nbsp;&nbsp;&nbsp;&nbsp;</font></button>&quot; &_
&quot;<td><font face=Verdana style='font-size:12px'><button name=prev onClick=&quot;&quot;parent.side.location.href='Trandumper.htm?2'&quot;&quot; disabled>&nbsp;&nbsp;<font style='font-size:12px'><b><u>P</u>revious</b>&nbsp;&nbsp;</font></button>&quot; &_
&quot;<td><font face=Verdana style='font-size:12px'><button name=answ onClick=&quot;&quot;if(parent.up.JJ.indexOf('['+parent.up.II+']')<0){ parent.up.JJ=parent.up.JJ + '[' + parent.up.II + ']'; parent.up.WRONGS= parent.up.WRONGS + 1; parent.down.wrong.innerHTML=parent.up.WRONGS; } parent.up.ShowHint();&quot;&quot; disabled>&nbsp;&nbsp;<font style='font-size:12px'>&quot; &_
&quot;<b><u>A</u>nswer</b>&nbsp;&nbsp;</button>&quot; &_
&quot;<td><font face=Verdana style='font-size:12px'><button disabled name=review onClick=&quot;&quot;parent.side.location.href='Trandumper.htm?review'&quot;&quot;>&nbsp;&nbsp;<font style='font-size:12px'>&quot; &_
&quot;<b><u>R</u>eview</b>&nbsp;&nbsp;&nbsp;</button>&quot; &_
&quot;<td align=right><font face=Verdana style='font-size:12px'><button name=exitt onClick=&quot;&quot;if(confirm('Are you sure to quit this exam?')){ top.hid.answermode=0;parent.location.href='Trandumper.htm?second';}&quot;&quot;> &nbsp;&nbsp;&nbsp;<font style='font-size:12px'>&quot; &_
&quot;<b><u>E</u>xit</b>&nbsp;&nbsp;&nbsp;&nbsp;</button>&quot; &_
&quot;</table></body></html>&quot;
document.write DOWN
End Sub

Function ChkAnswer(ITEM)
Dim j, i
j=0
For i=1 To Len(parent.up.Usr(ITEM))
If (InStr(parent.up.Ans(ITEM), Mid(parent.up.Usr(ITEM),i,1)) >0) Then
j=j+1
End If
Next
If (j=Len(parent.up.Ans(ITEM))) Then
ChkAnswer = True
Else
ChkAnswer = False
End If
End Function

Sub SaveWrong()
Dim fs, a, tmpStr
Dim i, j
ForAppending = 8
TristateFalse = 0
i = 0
j = 0
Set fs=CreateObject(&quot;Scripting.FileSystemObject&quot;)
If Not fs.FileExists(top.hid.FOLDER & parent.side.WRONG.value) Then
Set a = fs.CreateTextFile(top.hid.FOLDER & parent.side.WRONG.value, True)
SaveType = &quot;Saved !&quot;
Else
Set a = fs.OpenTextFile(top.hid.FOLDER & parent.side.WRONG.value, ForAppending,TristateFalse)
SaveType = &quot;Appended !&quot;
End If
For i = 1 To parent.up.MM
If (InStr(parent.up.JJ, &quot;[&quot; & i & &quot;]&quot;) > 0) Then
If (Not ChkAnswer(i)) Then
tmpStr=parent.up.Subject(i)
tmpStr=Join(Split(tmpStr,&quot;<BR>&quot;),Chr(13) & Chr(10))
a.WriteLine i & &quot;. (&quot; & Left(top.hid.AA,1) & parent.up.S(i) & &quot;)&quot; & tmpStr
For j = 1 To MAXIMJ
If parent.up.Opti(i,j) <> &quot;&quot; Then
a.WriteLine parent.up.Opti(i,j) & &quot;. &quot; & parent.up.Body(i,j)
Else
Exit For
End If
Next
a.WriteLine &quot;&quot;
a.WriteLine &quot;Answer: &quot; & parent.up.Ans(i)
tmpStr=parent.up.Desc(i)
tmpStr=Join(Split(tmpStr,&quot;<BR>&quot;),Chr(13) & Chr(10))
a.WriteLine tmpStr
a.WriteLine &quot;&quot;
a.WriteLine &quot;&quot;
End If
End If
Next
a.Close
MsgBox parent.side.WRONG.value & &quot; has &quot; & SaveType
End Sub
</script>
</html>




Any Qs please email me at info@trandumper.com

thx a lot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top