Results 1 to 2 of 2

Thread: Object Expected!! how to solve?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2005
    Posts
    840

    Object Expected!! how to solve?

    anyone can help me find the problem of this code. i hv check several time and didn't found any error or wrong spelling!!

    the color part is the line that exists error!!

    <html>
    <head>
    <script language ="JavaScript">



    function GradeLevel(){

    var mark = parseInt(document.form1.txtMark.value);


    if (mark > 69) && (mark < 101){
    document.writeln("<h1>You get grade A</h1>");

    } else{
    if (mark > 59) && (mark < 70){
    document.writeln("<h1>You get grade B</h1>");

    } else{
    if (mark > 49) && (mark < 60){
    document.writeln("<h1>You get grade C</h1>");

    } else{
    if (mark > 39) && (mark < 50){
    document.writeln("<h1>You get grade D</h1>");

    } else{
    if (mark < 40) && (mark >= 0){
    document.writeln("<h1>You get grade E</h1>");

    } else{
    document.writeln("<h1>Please enter the correct mark</h1>");
    }
    }
    }
    }
    }
    }

    </script>

    <title>untitle</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body>
    <form name = "form1" method = "post" action ="">
    <table width="444" height="52" border="1">
    <tr>
    <td width="164"><div align="center">Mark</div></td>
    <td width="264"><input name="txtMark" type="text" id="txtMark"></td>
    </tr>
    <tr>
    <td><div align="center">
    <input name="cmdResult" type="button" id="cmdResult" value="Result" OnClick="GradeLevel()">
    </div></td>
    <td><input name="cmdClear" type="Reset" id="cmdClear" value="Clear"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Object Expected!! how to solve?

    You have too many curly braces at the end of the function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width