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&Sea/Sea&Land">Land&Sea/Sea&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&Sea/Sea&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
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.
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>>">
<input type="reset" name="Reset" id="button" value="Reset">
</form>
</body>
</html>
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks