DeveloperBarn Forums

Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

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 (permalink)  
Old June 6th, 2008, 12:42 PM
Contributing Member

 
Join Date: Mar 2008
Posts: 188
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 (permalink)  
Old June 6th, 2008, 12:52 PM
jmurrayhead's Avatar
Your Lord & Master

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 543
Thanks: 14
Thanked 41 Times in 40 Posts
Blog Entries: 2
Rep Power: 1
jmurrayhead will become famous soon enough

Awards Showcase
Microsoft SQL Server Microsoft Windows Microsoft .Net 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
Did I help you out? Make me popular by clicking the icon!

If you found a post helpful, please click the button in the lower right-hand corner of the post.

Powered by ASP.Net
Reply With Quote
  #3 (permalink)  
Old June 6th, 2008, 01:00 PM
Contributing Member

 
Join Date: Mar 2008
Posts: 188
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 (permalink)  
Old June 6th, 2008, 01:04 PM
jmurrayhead's Avatar
Your Lord & Master

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 543
Thanks: 14
Thanked 41 Times in 40 Posts
Blog Entries: 2
Rep Power: 1
jmurrayhead will become famous soon enough

Awards Showcase
Microsoft SQL Server Microsoft Windows Microsoft .Net 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 (permalink)  
Old June 6th, 2008, 01:05 PM
Contributing Member

 
Join Date: Mar 2008
Posts: 188
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 (permalink)  
Old June 6th, 2008, 01:10 PM
Contributing Member

 
Join Date: Mar 2008
Posts: 188
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 (permalink)  
Old June 6th, 2008, 01:15 PM
jmurrayhead's Avatar
Your Lord & Master

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 543
Thanks: 14
Thanked 41 Times in 40 Posts
Blog Entries: 2
Rep Power: 1
jmurrayhead will become famous soon enough

Awards Showcase
Microsoft SQL Server Microsoft Windows Microsoft .Net 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 (permalink)  
Old June 6th, 2008, 01:20 PM
Contributing Member

 
Join Date: Mar 2008
Posts: 188
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 (permalink)  
Old June 6th, 2008, 01:23 PM
jmurrayhead's Avatar
Your Lord & Master

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 543
Thanks: 14
Thanked 41 Times in 40 Posts
Blog Entries: 2
Rep Power: 1
jmurrayhead will become famous soon enough

Awards Showcase
Microsoft SQL Server Microsoft Windows Microsoft .Net 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 (permalink)  
Old June 6th, 2008, 01:28 PM
Contributing Member

 
Join Date: Mar 2008
Posts: 188
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


Sponsored Links

ASP.NET Resource Index
a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer.

Free Web Directory
Including Chats and Forums Resources, Offer automatic, instant and free directory submissions.
URLZ Web Directory
URLZ Web Directory

Free Web Directory - Add Your Link
The Little Web Directory
Free Web Directory
Pegasus free web directory is a free directory organised by categories.

Web Directory & SEO Services
dirroot web directory


All times are GMT -4. The time now is 12:43 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 2008 DeveloperBarn.com

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46