I wrote a simple javascript function by creating a js.AWBTracking.js file.
function ChangeExpImpStatus() {
var rbtnExport;
var rbtnImport;
rbtnExport = document.getElementById('rbtnExp');
rbtnImport = document.getElementById('rbtnImp');
if(rbtnExport.checked) {
document.getElementById('lblHAWBNo').style.display = 'none';
document.getElementById('txtHAWBNo').style.display = 'none';
document.getElementById('tdAirline').style.display ='block';
}
else {
document.getElementById('lblHAWBNo').style.display = 'block';
document.getElementById('txtHAWBNo').style.display = 'block';
document.getElementById('tdAirline').style.d开发者_如何学Goisplay ='none';
}
}
and in aspx file I wrote,
but whenever I run the project, it shows the error in jsAWBTracking file, "Object required". the error is shown at line,
document.getElementById('txtHAWBNo').style.display = 'none';
please help me to get out of this... :-(
Everything looks good, I am skeptical. Are you trying to execute the script before the the HTML is rendered to the view? Please check when is your script is getting called.
Are you changing the visibility from code behind? Element with visibility false will not render as html so you are getting null object else check the id of the element to see if there is any typo.
Thanks Ashwani
精彩评论