Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
the images aren't displaying when pressing the button
  <head>   
    <script type="javascript/css">
      var die1Image,die2Image,die3Image,die4Image;
      function start(){
        var button=document.getElementById("rollButton");
        button.addEventListener("click",rollDice,false);
        die1Image=document.getElementById("die1");
        die2Image=document.getElementById("die2");
        die3Image=document.getElementById("die3");
        die4Image=document.getElementById("die4");
      }
      function rollDice(){
        setImage(die1Image);
        setImage(die2Image);
        setImage(die3Image);
        setImage(die4Image);
      }
      function setImage(dieImg){
        var dieValue=Math.floor(1+Math.random()*6);
        dieImg.setAttribute("src","die"+dieValue+".png");
        dieImg.setAttribute("alt","die image with "+dieValue+" spot(s)");
      }
      window.addEventListener("load",start,false);
    </script>
</head>
  <body>
    <form action="#">
      <input id="rollButton" type="button" value="Roll Dice">
    </form>
    <ol>
      <li><img id="die1" src="blank.png" alt="die 1 image"></li>
      <li><img id="die2" src="blank.png" alt="die 2 image"></li>
      <li><img id="die3" src="blank.png" alt="die 3 image"></li>
      <li><img id="die4" src="blank.png" alt="die 4 image"></li>
    </ol>
  </body>

whenever I click the roll button, the blank.png photos stay and die photos don't display in their places. the die images are named (die1.png->die6.png) correctly.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

<script type="text/javascript"> and not "javascript/css"

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!