这是我遇到每个人的问题的代码。自从我不懂 js 以来,这就是我已经工作了 8 个小时的工作。我从 w3school.com 网站获得了大部分内容,并且一直在尝试将所有内容拼凑在一起。呃,请帮忙
<script type="text/javascript">
var stringToMatch = 'christopher',
input = document.getElementById('text'),
div = document.getElementById('divColor1');
function toggle (switchElement){
if (this.value == stringToMatch){
div.style.display = 'block';
}
else {
div.style.display = 'none';
}
};?
</script>
<!--This is the start of the code which i want to appear-->
<h3>Coupon Redeem</h3>
<form action="test" method="post">
Please type in the Coupon Code you have recieved:
<form id='coupon' onChange="javascript: ShowMenu(document.getElementById('text').value,'divColor1');">
<input id="text" type="text">
<input type="button" id="text" value="Redeem" onClick="toggle(this)" />
</form>
<!--This is the start of the hidden field that i want to appear when the coupon code is entered correctly-->
<div id="divColor1" style="display:none;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="asjsanxci">
<input type="hidden" name="on0" value="Tokens">Tokens
<select name="os0">
<o ption value="5 tokens">5 tokens$5.00 USD</option>
<option value="10 tokens">10 tokens$10.00 USD</option>
<option value="15 tokens">15 tokens$13.00 USD</option>
<option value="20 tokens">20 tokens$18.00 USD</option>
<option value="25 tokens">25 tokens$23.00 USD</option>
<option value="30 tokens">30 tokens$27.00 USD</option>
<option value="35 tokens">35 tokens$33.00 USD</option>
<option value="40 tokens">40 tokens$38.00 USD</option>
<option value="50 tokens">50 tokens$45.00 USD</option>
</select>
<input type="hidden" name="on1" value="Username Verification">Username Verification
<input type="text" name="os1" maxlength="200">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
</form>
</div>
<br>
</form>