Login | Register | FAQ


+ Post a reply

2 posts Page 1 of 1


by tqmd1 » Thu Dec 15, 2011 10:14 am

Dear Experts

Please help me to locate the error in my codes

Code: Select all


<form name="thisform">
<input name=text1 type=text value="Pakistan"><br>
Result<br><input name=text3 type=text value="" disabled=true><br>
<input name=button8 type=button value="IndexOf"

<input name=reset type=reset value="Clear" onclick="thisform.text1.focus()">

User avatar


  • Posts: 51
  • Joined: Fri Oct 28, 2011 11:05 am

Re: IndexOf

by mariaantonietta » Thu Dec 15, 2011 11:18 am

Hi, I think the mistake was in the spelling of onclick (you wrote OnClick) and of indexOf (you wrote thisform.text1.value.IndexOf('e')). This is my version of your code: it works on this end, try it out:

Code: Select all
<form name="thisform">
    <input name="text1" type="text" value="Pakistan"><br />
    Result<br /><input name="text3" type="text" value=""  disabled="true" /><br />
    <input name="button8" type="button" value="IndexOf" onclick="thisform.text3.value = thisform.text1.value.indexOf('e')" />
    <input name="reset" type="reset" value="Clear" onclick="thisform.text1.focus()" />

Remember that JavaScript is case sensitive.
User avatar


  • Posts: 64
  • Joined: Mon Oct 31, 2011 7:23 pm

+ Post a reply

Page 1 of 1