How to write inline javascript in wordpress page

I am facing an issue , my inline javascript code is not added in page(Created By wordpress).

code

Read More
function check()
 {
    alert("in check");
    var mname=document.getElementByID("name").value;
    var memail=document.getElementByID("email").value;

    var mresponse=document.getElementByID("response").value
   alert("name"+mname +"length"    +mname.length+"email"+memail+"length"+memail.length+"response"+mresponse+"length"+mresponse.length);

}

</script>
<table style="border: 0px;">
 <tbody>
  <tr>
  <td style="border: 0px;">Name <span style="color: red;">*</span></td>
   <td style="border: 0px;"><input id="name" type="text" name="name" /></td>
   </tr>
   <tr>
    <td style="border: 0px;">Email-Id <span style="color: red;">*</span></td>
    <td style="border: 0px;"><input id="emailid" type="text" name="emailid" /></td>
   </tr>
   <tr>
   <td style="border: 0px;">Your Response <span style="color: red;">*</span></td>
    <td style="border: 0px;"><textarea id="response" cols="40" maxlength="50"     name="response" rows="4"></textarea></td>
   </tr>
    </tbody>
   </table>
   <input onclick="check();" type="button" value="click" />

Do i need to install any plugin for allowing java script.

P.S i am not using wordpress.com ..i am developing locally

**********Updated*****************

i just try alert box

 var mname=document.getElementById("name");
   alert("in check"+mname);

and checked in firebug got following error

SyntaxError: syntax error
alert("in check"+mname);</p>

error pointing towards that ‘p’. But i did not write that code. i don`t know why this is appended in generated code?

Related posts

Leave a Reply

3 comments

  1. Use this

    getElementById instead of getElementByID
    

    use ‘;’ after

    var mresponse=document.getElementById("response").value; //forgot ';'
    

    and use

    var memail=document.getElementById("emailid").value;   //use correct id
    

    In my system is working now.

  2. i tried inline javascript plugin and it works for me. You have to just add follwing tags between your js code

     [inline]
       your  js code
     [/inline]