FlashDance
10-03-2011, 08:40 AM
How come this isn't working?
document.getElementById('glance').style.display='block'.color='gold';
document.getElementById('glance').style.display='block'.color='gold';
|
||||
Changing colour on clickFlashDance 10-03-2011, 08:40 AM How come this isn't working? document.getElementById('glance').style.display='block'.color='gold'; rangana 10-03-2011, 09:09 AM ...because that is technically erroneous. You should use: document.getElementById('glance').style.display='block'; document.getElementById('glance').style.color='gold'; ...or a less verbose: document.getElementById('glance').setAttribute('style','display:block;color:gold'); Hope that helps. Kor 10-03-2011, 09:20 AM You should better create a separate CSS class and change rather the class name than each property line by line. element.onclick=function(){this.className='newClass'} Dormilich 10-04-2011, 10:06 AM ...or a less verbose: document.getElementById('glance').setAttribute('style','display:block;color:gold'); … or document.getElementById('glance').style.cssText = "display:block; color:gold"; |
| |||
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum