0

I have a form on which there is a textbox for entering mobile number. Below this I have a check box saying 'Verify number' on selecting which user gets sms for validation code. Now on the update panel I have to show the textbox for mobile in readonly form and display message next to it saying 'Verification pending' or 'Verified' depending on the status. Also I have given a link called 'Edit' on clicking which text box for mobile will become editable and the message will disappear; instead again the check box for verify number will be displayed. I need help to change the display of message and check box.

3
Contributors
8
Replies
10
Views
8 Years
Discussion Span
Last Post by adaykin
0

I've used following code and it works fine with IE but not with fire fox.

function editmobile()
{	
	document.getElementById("mobile").readOnly=false;
	document.getElementById("mcncode").readOnly=false;
	document.getElementById('mobile').style.background ="#FFFFFF";
	document.getElementById('mcncode').style.background ="#FFFFFF";
	document.getElementById('divsms').innerHTML="<font color=blue><input type='checkbox' name='smsalert' value='1' >Verify mobile number.</font>"
	document.getElementById('divmobileedit').innerHTML="<a href='javascript:canceleditmobile()' >Cancel</a>"
}
function canceleditmobile()
{	
	document.getElementById("mobile").readOnly=true;
	document.getElementById("mcncode").readOnly=true;
	document.getElementById("mobile").value=document.myfrm.originalmobile.value;
	document.getElementById("mcncode").value=document.myfrm.originalmcncode.value;
	document.getElementById('mobile').style.background ="#F4F4F4";
	document.getElementById('mcncode').style.background ="#F4F4F4";
	document.getElementById('divsms').innerHTML=document.myfrm.strmconf.value;
	document.getElementById('divmobileedit').innerHTML="<a href='javascript:editmobile()' >Edit</a>"
}
0

Firefox comes with a pre-packaged feature called Error Console (Tools -> Error Console) which highlights all the Javascript errors on your web page. You can also grab hold of Firebug, an advanced Javascript debugging utility which is a Firefox plugin.

0

Interesting I tried doing something similar, and in the web developer plugin debug console in firefox I got a message saying that the element is null. Mine was working in ie too, but not in firefox.

0

well I did solve it using names I can post code if you want...my point is use both. Were you able to solve it dips?

0

Just because it works doesn't mean it is correct and will surely always work. IE has a peculiar habit of working with NAME when it doesn't find an element with a given ID. So document.getELementById('someId') will first look for an element with an ID of ' someId ' and failing to find so will look for an element having NAME ' someId '. That's why it *works* in IE in your case. It it worked with NAME , don't you wonder why they kept the name of the function as getElementById ?

0

Just because it works doesn't mean it is correct and will surely always work. IE has a peculiar habit of working with NAME when it doesn't find an element with a given ID. So document.getELementById('someId') will first look for an element with an ID of ' someId ' and failing to find so will look for an element having NAME ' someId '. That's why it *works* in IE in your case. It it worked with NAME , don't you wonder why they kept the name of the function as getElementById ?

I think you are a little confused....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.