SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Int -> Text

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Int -> Text

    Thanks for looking,

    I'm struggling with something rather simple. I have a table that displays a list of integer values: 20, 50, or 70. These are used in calculations and represent percentages (so actually .2, .5, .7). I would like the table itself to print out "Low", "Medium", or "High" according to which number is in the cell.

    I have the following:

    Code:
     
    
    function getWord(probability){
    		switch (probability){
    			case 0.2:
    			   return "high";
    				}
    				}
    I'm not too sure how to implement it within the <td></td> element. Thanks again for your time.

  2. #2
    SitePoint Enthusiast
    Join Date
    Jun 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nevermind - I got it.

    Code:
    <td width = 65px><script type  = "text/javascript"> getWord(<%= project.probability %>)</script></td>
    Those are ruby tags in there.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •