Results 1 to 2 of 2

Thread: Syntax help

  1. #1
    Join Date
    May 2011

    Syntax help

    i know there is no brackets in this program that is because i am not sure where to put them the program is set to calculate from the prompt how many cars sold what the commision and bonuses are
    the code is as follows:

    <script type="text/javascript">
    function show_prompt(){
    var carnum=prompt("how many cars have you sold");
    var commision = (carnum * 100)
    var bonus =((carnum - (carnum % 15) / 15)) *150
    document.write("You Sold " + carnum + 'cars')
    document.write( 'your comission is:' + commision + '<br/>');
    document.write( 'Your bonus is:' + bonus + '<br/>');
    <body onload = "show_prompt()">

    the code is solid but im not sure where i have went wrong please help

  2. #2
    Join Date
    Dec 2003
    Bucharest, ROMANIA
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <script type="text/javascript">
    function show_prompt(){
    var carnum=Number(prompt("how many cars have you sold"));
    var commision = (carnum * 100);
    var bonus =((carnum - (carnum &#37; 15) / 15)) *150;
    var div=document.getElementById('mydiv');
    var txt="You Sold " + carnum + "cars <br><br>";
    txt+="Your comission is:&#163;" + commision+"<br><br>";
    txt+="Your bonus is:&#163;" + bonus;
    <div id="mydiv50"></div>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Recent Articles