SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: html/javascript

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    html/javascript

    team this is my first time here and my first html/javascript
    but it doesnt wana work could someboday show me my mistake thx

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Reservation Form</title>
    </head>

    <body>
    <form action="res.php" method="post" name="pricecheck">
    <input type="text" value="Limousine" disabled="disabled" />
    <br>
    <table width="352" border="3" cellspacing="1" cellpadding="3">
    <tr>
    <td><strong>Party size/strong></td>
    <td>
    <select name="pasn" id="pasn" size="1">
    <option value="0"></option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    </select>
    </td>
    </tr>
    <tr>
    <td><strong> Trip Type/strong></td>
    <td>
    <select name="tt" id="tt" size="1">
    <option selected="">Select One</option>
    <option value="One Way">One Way</option>
    <option value="Round Trip">Round Trip</option>
    <option value="Land&amp;Sea/Sea&amp;Land">Land&amp;Sea/Sea&amp;Land</option>
    </select>
    </td>
    </tr>
    <tr>
    <td><strong>Transfare type</strong></td>
    <td>
    <script type="text/javascript">
    if(tt="One Way")
    {
    <select name="trant1" id="trant" size="1">
    <option>Select One</option>
    <option value="12">MCO To Disney</option>
    <option value="13">Disney To MCO</option>
    <option value="14">MCO To Cruis</option>
    <option value="15">Cruis To MCO</option>
    <option value="16">Disney To Cruis</option>
    </select>
    }else if (tt="Round Trip")
    {
    <select name="trant2" id="trant" size="1">
    <option>Select One</option>
    <option value="17">MCO To Disney To MCO</option>
    <option value="18">MCO To Cruis To MCO</option>
    <option value="19">Disney To Cruis To Disney</option>
    <option value="20">Dsiney To Cruis To MCO</option>
    }else (tt="Land&amp;Sea/Sea&amp;Land")
    {
    <select name="trant3" id="trant" size="1">
    <option>Select One</option>
    <option value="21">MCO To Disney to Cruis To MCO</option>
    <option value="22">MCO To Cruis To Dsiney to MCO</option>
    }
    </script>
    </td>
    </tr>
    </table>

    </form>
    </body>
    </html>

    thx again

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,338
    Mentioned
    465 Post(s)
    Tagged
    8 Thread(s)
    Hi iyhamid, welcome to SitePoint.

    I dare say, that's not much of a "script" in there. Have you studied JavaScript? Firstly, it is better off not being embedded in the HTML like that, but moreover, a script has to give a series of instructions to the browser, which do not exist there at the moment.

  3. #3
    SitePoint Member
    Join Date
    Oct 2009
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank u for the replasy..Yes i just finsh a book for js on line..and i tried it.. i know i have to do "on change" some wr to so the if statment could work so i did a little somthing but still not working i will post the new changes here.. thanks again

    *****
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Reservation Form</title>
    </head>

    <body>
    <form action="res.php" method="post" name="pricecheck">
    <script type="text/javascript">
    function showTransfareType(val){
    document.getElementById
    ('selectedTransfare').innerHTML = val;
    }
    </script>
    <input type="text" value="Limousine" disabled="disabled">
    <br>
    <table width="352" border="3" cellspacing="1" cellpadding="3">
    <tr>
    <td><strong>Party size/strong></td>
    <td>
    <select name="pasn" id="pasn" size="1">
    <option value="0"></option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    <option value="4">4</option>
    <option value="5">5</option>
    <option value="6">6</option>
    <option value="7">7</option>
    <option value="8">8</option>
    </select>
    </td>
    </tr>
    <tr>
    <td><strong> Trip Type/strong></td>
    <td>
    <select name="tt" id="tt" onChange='showTransfareType(this.value)' size="1">
    <option value="">Select value</option>
    <option value="One_Way">One Way</option>
    <option value="Round_Trip">Round Trip</option>
    <option value="lssl">LandSea/SeaLand</option>
    </select>
    </td>
    </tr>
    <tr>
    <td><strong>Transfare type</strong></td>
    <td>
    <script type="text/javascript">
    var trant = array("MCO To Disney","MCO To Disney","MCO To Cruis","Cruis To MCO","Disney To Cruis","MCO To Disney To MCO","MCO To Cruis To MCO","Disney To Cruis To Disney","Dsiney To Cruis To MCO","MCO To Disney to Cruis To MCO","MCO To Cruis To Dsiney to MCO")
    if(selectedTransfare="One_Way")
    {
    for (i=0; i<=4; i++);
    document.write(<select name="trant[i]">tran[i]</select>);
    }else if (selectedTransfare="Round_Trip")
    {
    for (i=5; i<=8; i++);
    document.write(<select name="trant[i]">tran[i]</select>);
    }else (selectedTransfare="lssl")
    {
    for (i=9; i<=10; i++);
    document.write(<select name="trant[i]">tran[i]</select>);
    }
    </script>
    </td>
    </tr>
    </table>
    <br>
    <input name="Submit" type="submit" value="Get Price&gt;&gt;">
    <input type="reset" name="Reset" id="button" value="Reset">
    </form>
    </body>
    </html>


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
  •