Click to See Complete Forum and Search --> : I got some error in javascript


switlana
March 20th, 2008, 12:12 PM
The javascript statement ***if(document.getElementById('ctl00_MasterFolio_txtcvv').value != '')*** is working fine in Internet Explorer but not working in Mozilla Firefox. I want a statement which will work in both browser and if possible all latest browsers.

PeejAvery
March 20th, 2008, 02:21 PM
[ moved ]

PeejAvery
March 20th, 2008, 02:22 PM
There is nothing wrong with that statement. What does the Error Console in Firefox say is wrong?

switlana
March 25th, 2008, 08:42 AM
Refered control is a asp.net textbox.
The error in Mozilla Firefox is :

document.getElementById('ctl00_MasterFolio_txtcvv') has no properties.

It works properly in internet explorer.

PeejAvery
March 25th, 2008, 08:47 AM
That is the biggest problem with JavaScript...sometimes it is a pain to get things to work cross-browser.

Anyway, it sounds as though the getElementById() is being called before the HTML element has been created. Is this called within a function onload? Can you post the relevant JavaScript as seen by the client-side?

switlana
March 26th, 2008, 02:50 PM
I hav got the solution. Actually id of textbox is 'ctl00_MasterFolio_txtCVV' , but I was using 'ctl00_MasterFolio_txtcvv' . Notice the difference in case of cvv. It means internet Explorer has no problem with case of control's id but this is not the case with mozilla.

Thanx for ur help.