Object expected question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Gabi Gabriel
    New Member
    • May 2011
    • 2

    Object expected question

    Hi,
    I'm a beginner with JavaScript and i can't figure out why i get this error: "Object Expected". I have the following code:
    Code:
    <html>
    <head>
    <SCRIPT language="Javascript" type=”text/javascript”>
    function adunare(){
    alert('please work');
    }
    </SCRIPT>
    </head>
    <body>
    <form name="form1">
    	<H3 align="center"><B>Formular</B></H3>
    	<P>Nume&nbsp;<INPUT type="text" name="nume"/></P>
    	<P>Prenume&nbsp;<INPUT type="text" name="prenume"/></P>
    	<P>Gender&nbsp<INPUT type="radio" name="gender">Male</INPUT>
    	<INPUT type="radio" name="gender">Female</INPUT></P>
    	<P><INPUT type="text" name="first">Number1</INPUT></P>
    	<P><INPUT type="text" name="second">Number2</INPUT></P>
    	<P><INPUT type="button" value="+" name="addButton" onClick="adunare()"/>
    	<INPUT type="button" value="-" name="subButton"/></P>
    	<P><TEXTAREA name="txtarea" rows="20"></TEXTAREA></P>
    	<P><INPUT type=submit name=submit value="Submit"/></P>
    </form>
    </body>
    </html>
    I get the error on the 18th line (after i click the "addButton" ). At this point, it should only display a message (in the future, it will do something else). Please, tell me if you know why i get the error.
    Thank you.
  • johny10151981
    Top Contributor
    • Jan 2010
    • 1059

    #2
    Check carefully
    Code:
    <SCRIPT language="Javascript" type=”text/javascript”>
    function adunare(){
    alert('please work');
    }
    </SCRIPT>
    your type attribute it was suppose to be contain either single quote or double quote. nothing else. I guess you are using multi-byte text. when you typed you probably typed keeping other language on. as a result your double quote is not double quote something else. Fix it. All will be fixed

    Comment

    • Gabi Gabriel
      New Member
      • May 2011
      • 2

      #3
      Thank you, i just copied the type attribute from a book and i didn't notice it doesn't use double quotes. Now it works.

      Comment

      Working...