我试图让网页在日期过后自动删除某些选项。当您接近特定日期时,它涉及不同数量的付款...即,总付款将于4月1日到期,但如果您从1月1日开始,您可以选择4/3/2或1付款计划,但如果您从1月2日到2月1日之间开始,只需要3/2或1个付款计划。依此类推,直到你完全付清"全额支付"上个月。
我已尝试使用div来隐藏各个部分,但只能隐藏第一部分,然后在第二个日期之后隐藏所有部分。尝试其他if语句从一开始就隐藏了所有内容!我试过设置块{{没有运气。
到目前为止,这是代码:
<!DOCTYPE html>
<html>
<head>
<meta name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org">
<title></title>
<script src="http://code.jquery.com/jquery-1.8.2.min.js" type="text/javascript">
</script>
</head>
<body>
<h1>Test Links</h1>
<hr>
<h1>End...</h1>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="GMZ4M4NXH7EM6">
<input type="hidden" name="on0" value="plan">
<div id='linkOne' style="display:none">
<hr>
<table>
<tr><td><input type="radio" name="os0" value ="option_0" checked="checked">
</td>
<td><strong>4 Payments</strong></td></tr>
<tr><td><!--Fill cell--></td><td>Number of payments 4</td></tr>
<tr><td><!--Fill cell--></td><td>Start payments At checkout</td></tr>
<tr><td><!--Fill cell--></td><td><!--Fill cell--></td></tr>
<tr><th>Due*</th><th>Amount</th></tr>
<tr><td>At checkout</td><td>$59.66 USD</td></tr>
<tr><td>Every 1 month (x 3)</td><td>$59.66 USD</td></tr>
<tr><td colspan="2">Total $238.64 USD</td></tr>
</table>
</hr>
</div>
<div id='linkTwo' style="display:none">
<hr>
<table><tr><td>
<input type="radio" name="os0" value="option_1"></td>
<td><strong>3 Payments</strong></td></tr>
<tr><td><!--Fill cell></td><td>Number of payments 3</td></tr>
<tr><td><!--Fill cell--></td><td>Start payments At checkout</td></tr>
<tr><td><!--Fill cell--></td><td>
<table>
<tr><th>Due*</th><th>Amount</th></tr>
<tr><td>At checkout</td><td>$79.44 USD</td></tr>
<tr><td>Every 1 month (x 2)</td><td>$79.44 USD</td></tr>
<tr><td colspan="2">Total $238.32 USD</td></tr>
</table></td>
</hr>
</div>
<div id='linkThree' style="display:none">
<hr>
<table><tr><td>
<input type="radio" name="os0" value="option_2"></td>
<td><strong>2 Payments</strong></td></tr>
<tr><td><!--Fill cell--></td><td>Number of payments 2</td></tr>
<tr><td></td><!--Fill cell--><td>Start payments At checkout</td></tr>
<tr><td></td><td>
<table>
<tr><th>Due*</th><th>Amount</th></tr>
<tr><td>At checkout</td><td>$119.01 USD</td></tr>
<tr><td>Every 1 month (x 1)</td><td>$119.01 USD</td></tr>
<tr><td colspan="2">Total $238.02 USD</td></tr>
</table></td>
</hr>
</div>
<div id='defaultLink' style="display:none">
<hr>
<table><tr><td>
<input type="radio" name="os0" value="option_3"></td>
<td><strong>1 Payment</strong></td></tr>
<tr><td><!--Fill cell--></td><td>Number of payments 1</td></tr>
<tr><td><!--Fill cell--></td><td>Start payments At checkout</td></tr>
<tr><td><!--Fill cell--></td><td>
<table>
<tr><th>Due*</th><th>Amount</th></tr>
<tr><td>At checkout</td><td>$237.70 USD</td></tr>
<tr><td>Total $237.70 USD</td><td></td></tr>
</table></td>
</hr>
</div>
</td></tr>
<tr><td colspan="2"><em>* We calculate payments from the date of checkout.
</em></td></tr>
</table>
<table>
<tr><td><em>Sign up for</em></td></tr>
<tr><td><input type="image" src="https://www.paypalobjects.com/en_US/i/btn
/btn_installment_plan_LG.gif"
name="submit" alt="PayPal - The safer, easier way to pay online!"></td></tr>
</table>
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr
/pixel.gif" width="1" height="1"></form>
<script type="text/javascript">
window.setInterval(function(){
var countOfLinksThatAreValid = 0;
$('#countOfLinksThatAreValid').show();
var current = new Date();
var linkOneExpirationDate = new Date("April 27, 2015 16:17:00")
var linkTwoExpirationDate = new Date("April 27, 2015 16:18:00")
var linkThreeExpirationDate = new Date("April 27, 2015 16:18:30")
if (current.getTime() <= linkOneExpirationDate.getTime()) {
$('#linkOne').show();
countOfLinksThatAreValid = countOfLinksThatAreValid + 1; }
else { $('#linkOne').hide(); }
if (current.getTime() <= linkTwoExpirationDate.getTime()) {
$('#linkTwo').show();
countOfLinksThatAreValid = countOfLinksThatAreValid + 1; }
else { $('#linkTwo').hide(); }
if (current.getTime() <= linkThreeExpirationDate.getTime()) {
$('#linkThree').show();
countOfLinksThatAreValid = countOfLinksThatAreValid + 1; }
else { $('#linkThree').hide(); }
if (countOfLinksThatAreValid === 0) {
$('#defaultLink').show(); }
else { $('#defaultLink').hide(); }
$('#Time').show();
$('#Time').text(current);
});
</script>
</body>
</html>
div之间的代码是PayPay编码所以它需要保持不变。
有什么想法吗?
答案 0 :(得分:0)
linkTwo HTML未正确关闭。最后点击了a和标签。现在linkThree是linkTwo的子项