styleSheet °³Ã¼ÀÇ ½ºÅ¸ÀÏ ¸í·É(rule)À» Á¦°ÅÇÏ°í, rules Ä÷º¼ÇÀÇ ÀμöµéÀ» Á¶Á¤ÇÑ´Ù.
¹Ýȯ°ªÀº ¾ø´Ù.
½ºÅ¸ÀÏ ¸í·É(rule)ÀÌ Á¦°ÅµÇ¸é ÆäÀÌÁö´Â ÀÚµ¿ÀûÀ» ´Ù½Ã Ç¥ÇöµÇÁö ¾Ê´Â´Ù.
º¯°æµÈ ³»¿ëÀÌ Ç¥ÇöµÇ°Ô ÇÏ·Á¸é ÆäÀÌÁö¸¦ ´Ù½Ã Ç¥ÇöÇϵµ·Ï ÇÏ¿©¾ßÇÑ´Ù.
¸î°¡Áö ¹æ½ÄÀ¸·Î ´Ù½Ã Ç¥ÇöÇÒ ¼ö ÀÖ´Ù.
¿¹¸¦µé¾î ÅؽºÆ®¸¦ ÀÚü¿¡ ¼³Á¤ÇϹǷμ ¿µÇâÀ» ¹ÞÀº ÅؽºÆ®¿¡¸¸ ½ºÅ¸ÀÏÀÇ º¯°æÀ» ´Ù½Ã Ç¥ÇöÇÒ ¼ö ÀÖ´Ù.
´Ù¸¥ ¹æ½ÄÀ¸·Î´Â reload ¸Þ¼µå·Î ¹®¼ ÀüüÀ» ´Ù½Ã ·ÎµùÇÒ ¼ö ÀÖ´Ù.
table¿¡¼´Â refresh ¸Þ¼µå¸¦ »ç¿ëÇÏ¿© ´Ù½Ã Ç¥ÇöÇÒ ¼ö ÀÖ´Ù.
°³Ã¼ | script | IE |
---|
ÀÌ ¹®ÀÚ¿Àº »õ·Î¿î ½ºÅ¸ÀÏÀÌ Àû¿ëµÈ´Ù.
removeRule ¸Þ¼µå·Î rules Ä÷º¼Ç¿¡¼ ÇÑ°³ÀÇ rule °³Ã¼¸¦ Á¦°ÅÇÑ´Ù.
<STYLE>p.sample {color:red;font-weight:bold;}</STYLE>
<P id=oEffectRules class=sample>ÀÌ ¹®ÀÚ¿Àº »õ·Î¿î ½ºÅ¸ÀÏÀÌ Àû¿ëµÈ´Ù.</P>
<BUTTON onclick="removeTheRule()">»õ·Î¿î ½ºÅ¸ÀÏ ¸í·ÉÀ» Á¦°ÅÇÑ´Ù.</BUTTON><BR>
¿ø·¡ <DIV id=showA style="border:solid 1 blue"> </DIV>
°á°ú <DIV id=showB style="border:solid 1 brown"> </DIV>
<SCRIPT>
str='document.styleSheets.length='+document.styleSheets.length+'<BR>';
str+='document.styleSheets[1].style.cssText='+document.styleSheets[1].cssText+'<BR>';
str+='document.styleSheets[1].rules.length='+document.styleSheets[1].rules.length+'<BR>';
showA.innerHTML=str;
function removeTheRule(){
document.styleSheets[1].removeRule(0); // 0Àº Á¦ÀÏ ¸ÕÀúÀÇ ruleÀÌ´Ù.
if (document.styleSheets[1].rules.length > 1){
showA.innerHTML=oEffectRules.innerHTML;
}
str='document.styleSheets.length='+document.styleSheets.length+'<BR>';
str+='document.styleSheets[1].style.cssText='+document.styleSheets[1].cssText+'<BR>';
str+='document.styleSheets[1].rules.length='+document.styleSheets[1].rules.length+'<BR>';
showB.innerHTML=str;
butObj.disabled=true;
}
</SCRIPT>