Script is not working in IEhttp://forums.asp.net/t/1775534.aspx/1?Script+is+not+working+in+IEFri, 02 Mar 2012 04:43:10 -050017755344858727http://forums.asp.net/p/1775534/4858727.aspx/1?Script+is+not+working+in+IEScript is not working in IE <p>i have placed the script in my coding. script is not working... can any one sugest..</p> 2012-03-01T10:41:41-05:004858736http://forums.asp.net/p/1775534/4858736.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p>Oh welcome on the asp.net,</p> <p>Priyanka you have to ellaborate your question properly,</p> <p>If you taking about the javascript then It is browser dependent,</p> <p>please clear the senerio by which we can help you</p> 2012-03-01T10:47:01-05:004858739http://forums.asp.net/p/1775534/4858739.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p>Where did u add the script exactly?, in aspx file or as a seperate JS file or injected/registered via code behind?..did u check whether the script is being rendered to the client?..did u hook it to an event(s) properly?..if its in a JS file then did u add reference to it in aspx?</p> <p>I really dont expect u to answer these to me...if something is wrong with scripts then I ask these questions to myself :)</p> <p>U could check whether its rendering or not on page requests by using developer tool (if u r using IE/Chrome)/firebug (if u r using Firefox)</p> 2012-03-01T10:49:02-05:004858766http://forums.asp.net/p/1775534/4858766.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p>hi friends <br> i have placed script in my coding (i.e.,) in aspx<br> function isNumeric(e) {<br> &nbsp;var c == getKeyCode(e);<br> &nbsp;if (c !== 8 &amp;&amp; (c &lt; 48 || c &gt; 57)) {<br> &nbsp;return false;<br> &nbsp; }<br> &nbsp;return true;<br> &nbsp;}&nbsp;&nbsp; &nbsp;<br> <br> &nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&quot;txt_numeric&quot; runat=&quot;server&quot; MaxLength=&quot;2&quot;&nbsp; onkeypress=&quot;return&nbsp; isNumeric(this)&quot;Width=&quot;50px&quot;&gt;&lt;/asp:TextBox&gt;<br> <br> script to check numeric is not working....</p> 2012-03-01T11:05:48-05:004858778http://forums.asp.net/p/1775534/4858778.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p>Please replace ur textbox control with (u should pass the event obj. as parameter to&nbsp;isNumeric method and not the textbox itself)</p> <pre class="prettyprint">&lt;asp:TextBox ID=&quot;txt_numeric&quot; runat=&quot;server&quot; MaxLength=&quot;2&quot; Width=&quot;50px&quot; onkeypress=&quot;javascript: isNumeric(event);&quot;&gt;&lt;/asp:TextBox&gt;</pre> <p>Everything else looks okay to me apart from 'getKeyCode' function, is it an another custom funtion?</p> <p>Cheers,</p> <p>R</p> <p></p> 2012-03-01T11:18:46-05:004858787http://forums.asp.net/p/1775534/4858787.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <pre class="prettyprint"></pre> <pre class="prettyprint">Try this</pre> <pre class="prettyprint"> function isNumeric(e) { var c=e.keyCode? e.keyCode : e.charCode if (c !== 8 &amp;&amp; (c &lt; 48 || c &gt; 57)) { return false; } return true; } &lt;asp:TextBox ID="txt_numeric" runat="server" MaxLength="2" onkeypress="return isNumeric(event)" Width="50px"&gt;&lt;/asp:TextBox&gt; </pre> 2012-03-01T11:22:10-05:004858805http://forums.asp.net/p/1775534/4858805.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p></p> <blockquote><span class="icon-blockquote"></span> <h4>Priyanka R</h4> <p></p> <p>hi friends <br> i have placed script in my coding (i.e.,) in aspx<br> function isNumeric(e) {<br> &nbsp;var c == getKeyCode(e);<br> &nbsp;if (c !== 8 &amp;&amp; (c &lt; 48 || c &gt; 57)) {<br> &nbsp;return false;<br> &nbsp; }<br> &nbsp;return true;<br> &nbsp;}&nbsp;&nbsp; &nbsp;<br> <br> &nbsp;&nbsp;&nbsp; &lt;asp:TextBox ID=&quot;txt_numeric&quot; runat=&quot;server&quot; MaxLength=&quot;2&quot;&nbsp; onkeypress=&quot;return&nbsp; isNumeric(this)&quot;Width=&quot;50px&quot;&gt;&lt;/asp:TextBox&gt;<br> <br> script to check numeric is not working....</p> <p></p> </blockquote> <p></p> <p>it depends on what is the implmentation of getKeyCode function</p> <p>the method of getting entered key value is different in browsers like IE and firefox.... it might be that the code used in this function is not compatible with the browser u r testing in...</p> <p>try to replace the function with this code....</p> <pre class="prettyprint">function isNumeric(eventObj) { var keycode; if(eventObj.keyCode) //For IE keycode = eventObj.keyCode; else if(eventObj.Which) keycode = eventObj.Which; // For FireFox else keycode = eventObj.charCode; // Other Browser if (keycode!=8) //if the key is the backspace key { if (keycode&lt;48||keycode&gt;57) //if not a number return false; // disable key press else return true; // enable key press } }</pre> <p><a href="http://www.mindfiresolutions.com/Numeric-validation-using-Javascript-612.php">http://www.mindfiresolutions.com/Numeric-validation-using-Javascript-612.php</a></p> <p>hope this helps...</p> 2012-03-01T11:34:19-05:004859038http://forums.asp.net/p/1775534/4859038.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p>Change your code&nbsp; as below mentioned&nbsp;</p> <p><br> 1.</p> <p>function isNumeric(e) {<br> &nbsp;<strong>var c = getKeyCode(e);</strong><br> <strong>&nbsp;if (c != 8 &amp;&amp; (c &lt; 48 || c &gt; 57)) {</strong><br> &nbsp;return false;<br> &nbsp; }<br> &nbsp;return true;<br> &nbsp;}&nbsp;&nbsp; &nbsp;<br> <br> &lt;asp:TextBox ID=&quot;txt_numeric&quot; runat=&quot;server&quot; MaxLength=&quot;2&quot;&nbsp; onkeypress=&quot;return&nbsp; isNumeric(this);&quot; Width=&quot;50px&quot;&gt;&lt;/asp:TextBox&gt;</p> <p></p> <p>or for checking numeric values simply use below mentioned code in your design</p> <p>2.</p> <p>&nbsp;&lt;asp:TextBox ID=&quot;txt_numeric&quot; runat=&quot;server&quot; MaxLength=&quot;2&quot;&nbsp; onkeyup=&quot;this.value=this.value.replace(/[^0-9]/,'');&quot;&nbsp; Width=&quot;50px&quot;&gt;&lt;/asp:TextBox&gt;</p> <p>Hope it helps you!!</p> 2012-03-01T13:50:27-05:004859997http://forums.asp.net/p/1775534/4859997.aspx/1?Re+Script+is+not+working+in+IERe: Script is not working in IE <p>Thanks friends it helps me lot</p> 2012-03-02T04:43:10-05:00