Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4

Thread: Percentage Bar

  1. #1
    Senior Member ULTiMATE's Avatar
    Join Date
    Nov 2002
    Location
    England
    Posts
    124
    Member #
    308
    Well i'm making a submission system on my forums, and i'm adding a percentage rating system, is there anyway i can turn the numbers 1-100% into a graphical bar, or by images, say each 10% equals one image

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    This would depend on the programming language the forum was in. The pseudo-code would (at least to me) be as follows:

    Obtain percentage
    Create two 1x1 GIFs (a transparent one and a single coloured one)
    Stretch width of coloured gif to (width of bar x percentage) and width of transparent gif to (width of bar x (1 - percentage))

    Again though, this depends on the programming language you use.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Senior Member ULTiMATE's Avatar
    Join Date
    Nov 2002
    Location
    England
    Posts
    124
    Member #
    308
    well i used php for this, so just putting in $frating would call up the number between 1-100

  5. #4
    Senior Member rjahrman's Avatar
    Join Date
    Feb 2003
    Posts
    180
    Member #
    705
    The width of the first image would be:
    $frating*($totalwidth/100)

    The second image:
    $totalwidth-$firstimagewidth

    Then you could put a table around it with cellpadding=1, cellspacing=0, and a black background; this would put a black border around it.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 09:37 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com