Guest alek_mil Posted March 16, 2006 Share Posted March 16, 2006 Hi,I've come across the following code. function html_disableItem(nd,a){var lEl = document.getElementById(nd);if (lEl && lEl != false){ if(a){ lEl.disabled = false; lEl.style.background = '#ffffff'; }else{ lEl.disabled = true; lEl.style.background = '#cccccc';}}return true;} It should disable a form on a page. In general it's quite understandable to me but I just can't figure out what's that if (lEl && lEl != false) is and how it works. Link to comment Share on other sites More sharing options...
aspnetguy Posted March 16, 2006 Share Posted March 16, 2006 That is just check to see if the object exists and that if it doe sit is not set to false Link to comment Share on other sites More sharing options...
scott100 Posted March 16, 2006 Share Posted March 16, 2006 Why did they do: if (lEl && lEl != false)why not just: if (lEl != false)??? Link to comment Share on other sites More sharing options...
aspnetguy Posted March 16, 2006 Share Posted March 16, 2006 Why did they do: if (lEl && lEl != false)why not just: if (lEl != false)??? <{POST_SNAPBACK}> perhaps it was to accomidate an older browser?!? That's all I can think of. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now