Javascript可以在一个网络主机上运行,但不能在另一个主机上运行



所以我有两个网站,一个用于开发,另一个用于主网站。我有一个复选框可以解锁网站上的一个按钮,这个复选框适用于开发中的按钮,但不适用于真正的按钮,我不确定为什么。错误代码为未捕获引用错误未定义Togglelink。

这是我的代码

function toggleLink(checkBox) {
var link = document.getElementById("agreeLink");
if (checkBox.checked)
link.style.display = "inline";
else
link.style.display = "none";
}

<form class="center" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<label for="terms_and_conditions">(<span style="color: red">REQUIERED to unlock Buy Now button</span>)I have read and agree to all the terms and conditions:</label>
<input type="checkbox" id="agreeCheckbox" name="agreeCheckbox" value="agreeCheckbox" onchange="toggleLink(this);" />
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="8346JDMASY5Z6">
<table>
<tr>
<td><input type="hidden" name="on0" value="Choose an amount">Choose an amount</td>
</tr>
<tr>
<td>
<select name="os0">
<option value="1000 Cash Points =">1000 Cash Points = $10.00 USD</option>
<option value="2000 Cash Points =">2000 Cash Points = $20.00 USD</option>
<option value="3300 Cash Points =">3300 Cash Points = $30.00 USD</option>
<option value="6000 Cash Points =">6000 Cash Points = $50.00 USD</option>
<option value="13000 Cash Points =">13000 Cash Points = $100.00 USD</option>
<option value="28000 Cash Points =">28000 Cash Points = $200.00 USD</option>
<option value="45000 Cash Points =">45000 Cash Points = $300.00 USD</option>
</select>
</td>
</tr>
</table>
<input type="hidden" name="currency_code" value="USD">
<input type="image" id="agreeLink" style="display:none;" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">

您的javascript似乎被转义了,使用CDATASection

更改:


<![CDATA[
function toggleLink(checkBox)
{
var link = document.getElementById("agreeLink");
if (checkBox.checked)
link.style.display = "inline";
else
link.style.display = "none";
}
]]>

对此:


function toggleLink(checkBox)
{
var link = document.getElementById("agreeLink");
if (checkBox.checked)
link.style.display = "inline";
else
link.style.display = "none";
}

相关内容

  • 没有找到相关文章

最新更新