ここにコードを入力してください `私はpaypalに行くリンクを作ろうとしていますが、チェックボックスがチェックされていればリンクが機能します。これは私のコードです:利用規約を確認した後、JavaScriptを使用してリンクを確認します
HTML
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MDSGURBJXF5K6" onclick="return buy_link(this)">Buy hard copy</a>
Javascriptを
function buy_link(link){
agree_check = oForm.elements["agree"].value;
if(agree_check === true){
window.location = link.href;
}else{
alert("You must agree to the terms and conditions before purchasing.");
}
return false;
}
ちょうど起こるものは何でもリンクするように見えますか? window.location()関数をコメントアウトすると、イベントが発生します。どんな考えがどこに間違っているの?
私は 'checked'プロパティを調べるべきです。 – user278064