ÁöÁ¤µÈ ¼Ó¼ºÀÇ Ç¥Çö½ÄÀ» ¹ÝȯÇÑ´Ù.
¹Ýȯ°ª vExpressionÀº ¼Ó¼ºÀÇ Ç¥Çö½ÄÀ» ´ëÇ¥ÇÏ´Â °ªÀÌ´Ù.
var sExpression=object.getExpression(sPropertyName)
var sExpression=object.style.getExpression(sPropertyName)
°³Ã¼ | script | IE |
---|
CSS¿¡¼ getExpression ¸Þ¼µå·Î div °³Ã¼ÀÇ width ¼Ó¼ºÀ» ¹Ýȯ¹Þ´Â´Ù.
<BODY>
<DIV id="div1Obj" style="background-color:blue;color:aqua;width:400">û»ö ¹ÙÅÁ¿¡ ¹°»ö ±ÛÀÚ 400 Çȼ¿ ³Êºñ</DIV>
<DIV id="div2Obj" style="background-color:yellow;color:green;width:200">³ë¶û¹ÙÅÁ¿¡ ³ì»ö ±ÛÀÚ 100 Çȼ¿ ³Êºñ</DIV>
<DIV id="div3Obj"
style="background-color:red;color:yellow;width:expression(div1Obj.style.pixelWidth+div2Obj.style.pixelWidth)">Ç¥Çö½ÄÀÌ ÀÖ´Â ºÎºÐ</DIV>
<BUTTON onclick=showA.innerHTML=div3Obj.style.getExpression('width');>Ŭ¸¯ÇÏ¿© Ç¥Çö½ÄÀ» º¸¶ó.</BUTTON>
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>
</BODY>
setExpression ¸Þ¼µå·Î û»ö°³Ã¼ÀÇ width ¼Ó¼ºÀ» ¼³Á¤ÇÏ°í, Ç¥Çö½Ä¸¦ Àû¿ëÇϸé À§ µÎ°³Ã¼ÀÇ °ªµéÀ» ÇÕÇÑ °ªÀ¸·Î ³Êºñ¸¦ ¼³Á¤ÇÑ´Ù.
<HTML> <HEAD> <SCRIPT> function doApply(){ inObjC.style.setExpression('width','eval(inObjA.value)+eval(inObjB.value)','jscript'); } function doShow(){ str='û»ö ¹Ú½ºÀÇ ³Êºñ¿¡ ´ëÇÑ Ç¥Çö½ÄÀº <FONT color=blue>'+inObjC.style.getExpression('width')+'</FONT>ÀÌ°í,<BR>' str+='±× ³Êºñ °ªÀº(inObjC.style.width)Àº <FONT color=blue>'+inObjC.style.width+'</FONT>ÀÌ´Ù.'; inObjC.innerText=inObjC.style.width; showB.innerHTML=str; } </SCRIPT> </HEAD> <BODY> <INPUT type=text id="inObjA" value=40><BR> <INPUT type=text id="inObjB" value=60><BR> <INPUT type=text id="inObjC" style="background-color:blue;color:aqua;font-weight:bold"><BR> <INPUT type=button id="butA" onclick="doApply()" value="Ŭ¸¯ÇÏ¿© Ç¥Çö½Ä Àû¿ëÇÏ°í"><BR> <INPUT type=button id="butB" onclick="doShow()" value="Ŭ¸¯ÇÏ¿© Ç¥Çö½ÄÀ» º¸¶ó."> <DIV id=showB>°á°ú Ç¥½Ãâ</DIV> </BODY> </HTML>