C
Coder
Hi I have the following code in java script, it is not giving proper
output in FIREFOX but running fine in IE... can anybody help me out to
make this run in FIREFOX .
<script language="JavaScript">
var cntlName;
var eleTarget = document.getElementById('hiding');
function showOrHide(){
alert ("hi");
var eleSource = event.srcElement;
if (event.srcElement) {
//for IE
var eleSource = event.srcElement;
}
else {
//for Firefox
var eleSource = event.target;
}
if (eleSource.value == 'MGRPAY') {
//for IE
eleTarget.style.display = 'block';
}
else {
eleTarget.style.display = 'none';
}
}
for(var i=0; i<preProcessControlArray.length; i++){
cntlName = eval(preProcessControlArray);
if (cntlName.m_oSubmit.name.toLowerCase() == 'p_par_rad_role'){
if (cntlName.m_oForm.length) {
for( var j=0; j<cntlName.m_oForm.length; j++ ){
if (j == 0) {
cntlName.m_oForm[j].focus();
cntlName.m_oForm[j].click();
if (cntlName.m_oForm[j].value == 'MGRPAY') {
eleTarget.style.display = 'block';
}
else {
eleTarget.style.display = 'none';
}
}
//For IE
if(cntlName.m_oForm[j].attachEvent)
cntlName.m_oForm[j].attachEvent('onpropertychange',
showOrHide);
//for firefox
else
cntlName.m_oForm[j].addEventListener('onchange',
showOrHide,false);
}
}
else {
cntlName.m_oForm.focus();
cntlName.m_oForm.click();
if (cntlName.m_oForm.value == 'MGRPAY') {
eleTarget.style.display = 'block';
}
else {
eleTarget.style.display = 'none';
}
}
}
}
</script>
output in FIREFOX but running fine in IE... can anybody help me out to
make this run in FIREFOX .
<script language="JavaScript">
var cntlName;
var eleTarget = document.getElementById('hiding');
function showOrHide(){
alert ("hi");
var eleSource = event.srcElement;
if (event.srcElement) {
//for IE
var eleSource = event.srcElement;
}
else {
//for Firefox
var eleSource = event.target;
}
if (eleSource.value == 'MGRPAY') {
//for IE
eleTarget.style.display = 'block';
}
else {
eleTarget.style.display = 'none';
}
}
for(var i=0; i<preProcessControlArray.length; i++){
cntlName = eval(preProcessControlArray);
if (cntlName.m_oSubmit.name.toLowerCase() == 'p_par_rad_role'){
if (cntlName.m_oForm.length) {
for( var j=0; j<cntlName.m_oForm.length; j++ ){
if (j == 0) {
cntlName.m_oForm[j].focus();
cntlName.m_oForm[j].click();
if (cntlName.m_oForm[j].value == 'MGRPAY') {
eleTarget.style.display = 'block';
}
else {
eleTarget.style.display = 'none';
}
}
//For IE
if(cntlName.m_oForm[j].attachEvent)
cntlName.m_oForm[j].attachEvent('onpropertychange',
showOrHide);
//for firefox
else
cntlName.m_oForm[j].addEventListener('onchange',
showOrHide,false);
}
}
else {
cntlName.m_oForm.focus();
cntlName.m_oForm.click();
if (cntlName.m_oForm.value == 'MGRPAY') {
eleTarget.style.display = 'block';
}
else {
eleTarget.style.display = 'none';
}
}
}
}
</script>