![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| Hi, I have 18 questions for a quiz. Once one question is answered the second question is displayed when you answer the second question third question is displayed i want to show the progress bar at the bottom which shows them how many questions they answered so the progress bar will be from 0 to 100% completed i will have a gif which will expand every time a question is answered So when a user answers question one i store one in this variable noofanswers But when i display the gif image it shows me one instead of the image Code: <%
For int_Counter = 1 TO noofanswers
Response.Write("<script language=""JavaScript"">Progress.innerHTML='<img src=finalprogress.gif height=20 width=" & int_Counter * 2 & ">';</script>")
Response.Flush
Next
%>
|
| Sponsored Links |
|
#2
| ||||
| ||||
| Not sure, but first I would handle this a different way. Retrieve the total number of questions and the total number the user answered. Take the number answered and divide it by the number of questions. Then place that percentage as the width of the progress bar. So if a user has 10 questions but has only answered 4, the calculation would be 4/10 or 40%.
__________________ jmurrayhead If you agree with me... click the icon! If my post solved your problem, click the button in the lower right-hand corner of the post.Join our Folding team: DeveloperBarn Folding |
|
#3
| |||
| |||
| tried it like this Code: totalquestions="18" widthofimage=noofanswers/totalquestions <img src="images/finalprogress.gif" height="20" width="<%=widthofimage%>"/> todd |
|
#4
| ||||
| ||||
| Are you sure noofanswers has a value? Also, assign actual numbers to your variables, not strings: Code: totalquestions="18" Code: totalquestions = 18 |
|
#5
| |||
| |||
| i even tried it like this widthofimage=noofanswers/totalquestions*100 todd |
|
#6
| |||
| |||
| thanks for your reply. here is the new code Code: totalquestions=18 Response.write "Total Questions:-" & totalquestions& "<br/>" Response.write "Answered Questions:-" & noofanswers& "<br/>" widthofimage=noofanswers/totalquestions*100 widthofimage=Round(widthofimage,2) <img src="images/finalprogress.gif" height="20" width="<%=widthofimage%>"/> Same thing the outout is 5.56 after a user answered question 1 todd |
|
#7
| ||||
| ||||
| What does this output? Code: totalquestions =18 Response.write "Total Questions:-" & totalquestions& "<br/>" Response.write "Answered Questions:-" & noofanswers& "<br/>" widthOfImage = (noOfAnswers/totalQuestions) <img src="images/finalprogress.gif" height="20" width="<% =FormatPercent(widthOfImage,0) %>"/> |
|
#8
| |||
| |||
| wow one step closer it displays the image now but its HUGE HUGE any idea todd |
|
#10
| |||
| |||
| Buddy, you are awesome thanks for your help. I will have another question on this image. Let me try it first before i ask have a great day todd |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|