Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "image problem" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). The Classic ASP forum is for ASP/VBScript and ASP/JScript applications.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old June 6th, 2008, 12:42 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default image problem

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
%>
can someone tell me what i am doing wrong
Reply With Quote
Sponsored Links
  #2  
Old June 6th, 2008, 12:52 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 809
Thanks: 19
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft Windows Microsoft .Net Microsoft SQL Server Classic ASP 
Total Awards: 4

Default

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
Reply With Quote
  #3  
Old June 6th, 2008, 01:00 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default

tried it like this

Code:
totalquestions="18"
widthofimage=noofanswers/totalquestions

<img src="images/finalprogress.gif" height="20" width="<%=widthofimage%>"/>
doesnt work just shows the %

todd
Reply With Quote
  #4  
Old June 6th, 2008, 01:04 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 809
Thanks: 19
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft Windows Microsoft .Net Microsoft SQL Server Classic ASP 
Total Awards: 4

Default

Are you sure noofanswers has a value?

Also, assign actual numbers to your variables, not strings:

Code:
totalquestions="18"
should be:

Code:
totalquestions = 18
Reply With Quote
  #5  
Old June 6th, 2008, 01:05 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default

i even tried it like this

widthofimage=noofanswers/totalquestions*100

todd
Reply With Quote
  #6  
Old June 6th, 2008, 01:10 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default

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
Reply With Quote
  #7  
Old June 6th, 2008, 01:15 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 809
Thanks: 19
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft Windows Microsoft .Net Microsoft SQL Server Classic ASP 
Total Awards: 4

Default

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) %>"/>
Reply With Quote
  #8  
Old June 6th, 2008, 01:20 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default

wow one step closer

it displays the image now but its HUGE HUGE

any idea

todd
Reply With Quote
  #9  
Old June 6th, 2008, 01:23 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 809
Thanks: 19
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft Windows Microsoft .Net Microsoft SQL Server Classic ASP 
Total Awards: 4

Default

Which way is it huge? width or height? You should set the height using 20px not just 20.

Comments on this post
sbenj69 agrees: another happy customer
Reply With Quote
  #10  
Old June 6th, 2008, 01:28 PM
Barn Frequenter

 
Join Date: Mar 2008
Posts: 197
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
todd2006 is an unknown quantity at this point
Default

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
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -4. The time now is 09:07 AM.



Content Relevant URLs by vBSEO 3.2.0