返回列表 發帖

我點選送出後卻沒反應,是有哪邊寫錯嗎??麻煩各位了!!

想請問一下 我點選送出後卻沒反應,是有哪邊寫錯嗎??麻煩各位了!!



<script type="text/javascript" language="javascript1.1">
function radio(){
var itemDay ;
var tmp12day = document.getElementById("12day");
var tmp14day = document.getElementById("14day");
var tmp15day = document.getElementById("15day");
var tmp17day = document.getElementById("17day");
        if(tmp12day.checked){
        //alert(tmp12day.value);
        itemDay = parseInt (tmp12day.value);
        }else if (tmp14day.checked){
        //alert(tmp14day.value);
        itemDay = parseInt (tmp14day.value);
        }else if (tmp15day.checked){
        //alert(tmp15day.value);
        itemDay = parseInt (tmp15day.value);
        if (tmp17day.checked){
        //alert(tmp17day.value);
        itemDay = parseInt (tmp17day.value);
        {
        //anything that does not match
        alert("Please choose a tour..");
                }

var dayOfPayment ;
var tmp1Aug = document.getElementById("1Aug");
var tmp131Aug = document.getElementById("131Aug");
var tmp130Sep = document.getElementById("130Sep");
var tmp30Sep = document.getElementById("30Sep");
        if(tmp1Aug.checked){
        //alert(tmp1Aug.value);
        dayOfPayment = parseInt (tmp1Aug.value);
        }else if (tmp131Aug.checked){
        //alert(tmp131Aug.value);
        dayOfPayment = parseInt (tmp131Aug.value);
        }else if (tmp130Sep.checked){
        //alert(tmp130Sep.value);
        dayOfPayment = parseInt (tmp130Sep.value);
        }else if (tmp30Sep.checked){
        //alert(tmp30Sep.value);
        dayOfPayment = parseInt (tmp30Sep.value);
        }else{
        //anything that does not match
        alert("Please choose the date of payment..");
        }

var airfare = document.getElementById("airfare");       
if(airfare.checked){
var totalCost = dayOfPayment - itemDay + 400;
alert("Total cost of purchase is $" +totalCost);
}else {       
var totalCost = dayOfPayment - itemDay;
alert("Total cost of purchase is $" +totalCost);
}       

} //endfunction

</script>
</head>

<body>
<h1>New Zealand Holiday Price Calculator</h1>
<p>
Compelete the form below to calculate the cost of your New Zealand holiday.
</p>
<form method="post" action="">
<p>
Tour type:
<br/>
<input type="radio"  name="newZealand" value="1500"/><label for="12day">12-day New Zealand Escape Tour</label>
<br/>
<input type="radio" name="newZealand" value="1600"/><label for="14day">14-day New Zealand Panorama Tour</label>
<br/>
<input type="radio"  name="newZealand" value="1750"/><label for="15day">15-day New Zealand South to North Tour</label>
<br/>
<input type="radio"  name="newZealand" value="2100"/><label for="17day">17-day Best of New Zealand Tour</label>
</p>

<p>
Payment date:
<br/>
<input type="radio"  name="discounts" value="200"/><label for="1august">Before 1st August 2010</label>
<br/>
<input type="radio"  name="discounts" value="150"/><label for="131august">Between 1st and 31st August 2010</label>
<br/>
<input type="radio"  name="discounts" value="100"/><label for="130september">Between 1st and 30th September 2010</label>
<br/>
<input type="radio"  name="discounts" value="0"/><label for="30september">After 30 September 2010</label>
</p>

<p>
<label for="airfare">Click here if you want include an airfare from Sydney, Brisbane or Melbourne:</label><input type="checkbox"/>
</p>
<!--=====================================Buttom====================-->
<p>
<input type="button" value="Calculate" onclick="radio()"  />
<input type="Reset" />
</p>
</form>

你的 JavaScript 有問題,先把程式碼縮排整理好,應該就會發現囉~
To infinity and beyond!

TOP

返回列表 回復 發帖