最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - IE 7 expected identifier, string or number - Stack Overflow

programmeradmin15浏览0评论

Im having a problem and cant seem to find it for the life of me because my code works in all other browsers except IE7. This is the error im getting "expected identifier, string or number"

This is my code.

    function calculate() {
        var principal = document.loandata.principal.value;
        var interest = document.loandata.interest.value / 100 / 12;
        var payments = document.loandata.years.value * 12;

        var x = Math.pow(1 + interest, payments);
        var monthly = (principal*x*interest)/(x-1);

        if (!isNaN(monthly) && 
            (monthly != Number.POSITIVE_INFINITY) &&
            (monthly != Number.NEGATIVE_INFINITY)) {

            document.loandata.payment.value = round(monthly);
            document.loandata.total.value = round(monthly * payments);
            document.loandata.totalinterest.value = 
                round((monthly * payments) - principal);
        } else {
            document.loandata.payment.value = "";
            document.loandata.total.value = "";
            document.loandata.totalinterest.value = "";
        }
    }

    function round(x) {
      return Math.round(x*100)/100;
    }

    jQuery(document).ready(function ($) {
    $('#button').click(function(){
          $('#option2').animate({
         height: '365px', }, 500 );
  });
});

But the problem seem to be where I have my animate function which is...

jQuery(document).ready(function ($) {
    $('#button').click(function(){
          $('#option2').animate({
         height: '365px', }, 500 );
  });
});

any help is greatly apprecaited.

Im having a problem and cant seem to find it for the life of me because my code works in all other browsers except IE7. This is the error im getting "expected identifier, string or number"

This is my code.

    function calculate() {
        var principal = document.loandata.principal.value;
        var interest = document.loandata.interest.value / 100 / 12;
        var payments = document.loandata.years.value * 12;

        var x = Math.pow(1 + interest, payments);
        var monthly = (principal*x*interest)/(x-1);

        if (!isNaN(monthly) && 
            (monthly != Number.POSITIVE_INFINITY) &&
            (monthly != Number.NEGATIVE_INFINITY)) {

            document.loandata.payment.value = round(monthly);
            document.loandata.total.value = round(monthly * payments);
            document.loandata.totalinterest.value = 
                round((monthly * payments) - principal);
        } else {
            document.loandata.payment.value = "";
            document.loandata.total.value = "";
            document.loandata.totalinterest.value = "";
        }
    }

    function round(x) {
      return Math.round(x*100)/100;
    }

    jQuery(document).ready(function ($) {
    $('#button').click(function(){
          $('#option2').animate({
         height: '365px', }, 500 );
  });
});

But the problem seem to be where I have my animate function which is...

jQuery(document).ready(function ($) {
    $('#button').click(function(){
          $('#option2').animate({
         height: '365px', }, 500 );
  });
});

any help is greatly apprecaited.

Share Improve this question edited Jun 29, 2018 at 16:37 Mike Christensen 91.7k51 gold badges219 silver badges347 bronze badges asked Jan 12, 2012 at 18:36 user874185user874185 8532 gold badges9 silver badges15 bronze badges 1
  • Aren't your .animate object parameters inplete? What is the height value animating to? – BumbleB2na Commented Jan 12, 2012 at 18:38
Add a ment  | 

2 Answers 2

Reset to default 11

IE is confused by the extra ma:

Change:

height: '365px', }, 500 );

To:

height: '365px' }, 500 );

remove the ma after '365px'

发布评论

评论列表(0)

  1. 暂无评论