一段JS在IE下能正常使用,到FIREFOX下失效
<script language= "JavaScript " type= "text/JavaScript ">
<!--
function check_cart(){
var temp_customer_id;
temp_customer_id = " ";
if (temp_customer_id == "39 "){
location.href= "login.php?origin=checkout_shipping.php ";
}
if (Number(cart_quantity.hongli_post.value) > 180){
alert( "您輸入的紅利大於您所擁有的紅利點數,請重新輸入 ");
cart_quantity.hongli_post.focus();
return false;
}
var hl=cart_quantity.hongli_post.value;
location.href( "http://krusell.works.tw/checkout_shipping.php?hongli22= "+hl);
}
//-->
</script>
------解决方案--------------------location.href = "http://krusell.works.tw/checkout_shipping.php?hongli22= "+hl;
------解决方案--------------------Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.
------解决方案--------------------一个是href:
IE或者Firefox2.0.x下,可以使用window.location或window.location.href;Firefox1.5.x下,只能使用window.location
另一个是cart_quantity.hongli_post
建议用document.getElementById( "hongli_post ")
------解决方案--------------------try:
<script language= "JavaScript " type= "text/JavaScript ">
<!--
function check_cart(){
var temp_customer_id;
temp_customer_id = " ";
if (temp_customer_id == "39 "){
location= "login.php?origin=checkout_shipping.php ";
}
if (Number(document.getElementById( "hongli_post ").value) > 180){
alert( "您輸入的紅利大於您所擁有的紅利點數,請重新輸入 ");
document.getElementById( "hongli_post ").focus();
return false;
}
var hl=document.getElementById( "hongli_post ").value;
location= "http://krusell.works.tw/checkout_shipping.php?hongli22= "+hl;
}
//-->
</script>