SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    UK
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple Var Problem

    I know this is an easy question, but I don't know any Javascript.

    htmlstring"<button onclick=\"UpdateSize('survey',750,560), UpdateContent('survey',ADPcontent2), UpdatePosition('survey',10,10,0,event)\" value=\"Start Survey\">Start Survey</button></td></tr></table>"

    How do I get ADPcontent2 to have a random number between 1 & 5. e.g ADPcontent3, Adpcontent4 etc...

    Thanks,

    Rob

  2. #2
    SitePoint Zealot
    Join Date
    Nov 2001
    Location
    UK
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    fixed.

    var ran_unrounded=Math.random()*4;
    var ran_number=(Math.floor(ran_unrounded)+1);


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
  •