ÁöÁ¤µÈ °Ôü¿¡ Ç¥Çö½ÄÀ» ¼³Á¤ÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
sPropName

ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç¥Çö½Ä sExpressionÀÌ Ãß°¡µÉ ¼Ó¼ºÀÇ À̸§À» ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.

sExpression

ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ¼¼¹ÌÄÝ·Ð(;)À̳ª µû¿ÈÇ¥(',") ¾øÀÌ À¯È¿ÇÑ ½ºÅ©¸³Æ®(Script, JavaScript, VBSCript) ¹®ÀåÀ¸·Î ÀÛ¼ºÇÑ Ç¥Çö½ÄÀÌ´Ù. ÀÌ ¹®ÀÚ¿­Àº ÇöÀç ÆäÀÌÁöÀÇ ´Ù¸¥ ¼Ó¼ºµéÀÇ ÂüÁ¶¸¦ Æ÷ÇÔÇÒ ¼ö ÀÖ´Ù. ½ºÅ©¸³Æ® ¼Ó¿¡ Æ÷ÇÔµÈ °³Ã¼ÀÇ ¼Ó¼ºµé¿¡´Â ¹è¿­º¯¼ö ÂüÁ¶¸¦ Çã¿ëÇÏÁö ¾Ê´Â´Ù.

sLang
¼±ÅÃÀûÀÎ ¿ä¼ÒÀ̸ç, ¾ð¾î¸¦ ÁöÁ¤ÇÏ´Â ¹®ÀÚ¿­ÀÌ´Ù.
JScript µðÆúÆ®À̸ç, JScript ¾ð¾îÀÌ´Ù.
VBScript VBScript ¾ð¾îÀÌ´Ù.
JavaScript JavaScript ¾ð¾îÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ªÀº ¾ø´Ù.

Ư±â

setExpression ¸Þ¼­µå´Â Áö¿øµÇ´Â CSS ¼Ó¼ºµé(Cascading Style Sheets)°úÀбâ/¾²±â DHTML ¼Ó¼ºµé¿¡ Ç¥Çö½ÄÀ» ¼³Á¤Çϴµ¥ »ç¿ëµÈ´Ù.
setExpression ¸Þ¼­µå¿¡ ÀÇÇÏ¿© ¼³Á¤µÈ Ç¥Çö½ÄÀ» Á¦°ÅÇϱâ À§ÇÏ¿©, removeExpression ¸Þ¼­µå¸¦ »ç¿ëÇÑ´Ù.

´ÙÀ½ ¹®¹ýÀº CSS ¼Ó¼ºµé(Cascading Style Sheets)°ú DHTML ¼Ó¼ºµé¿¡¼­ Ç¥Çö½ÄÀ» Á¦°ÅÇÏ´Â ¹æ½ÄÀ» º¸¿©ÁØ´Ù.

sLang ÆĶó¸ÞÅÍ¿¡ ÀÇÇÏ¿© ÁöÁ¤µÈ ¾ð¾î·Î Ç¥ÇöµÈ µ¥ÀÌÅÍ Çü½ÄÀº Ç¥Çö½Ä sExpression¿¡ Çã¿ëµÈ ÇϳªÀÇ °¡´ÉÇÑ °ª¿¡ ¸Â¾Æ¾ß ÇÑ´Ù.

óÀ½ ÆĶó¸ÞÅÍ¿¡ ÀÇÇÏ¿© ÁöÁ¤¿Þ ¼Ó¼ºÀ̳ª ¾ÖÆ®¸®ºäÆ®°¡ ¹®ÀÚ¿­À» ÇÊ¿ä·Î ÇÏ´Â °æ¿ì¿¡´Â, µÎ¹ø° ÆĶó¸ÞÅÍÀÇ µ¥ÀÌÅÍ Å¸ÀÔÀº ¹®ÀÚ¿©À̾î¾ß ÇÑ´Ù. ¾Æ´Ï¸é setExpression ¸Þ¼­µå¸¦ ¼öÇàÇϱâ Àü¿¡ µÎ¹ø° ÆĶó¸ÞÅÍ°¡ ÆÇÁ¤µÇ°í, Ç¥Çö½ÄÀÌ ÆÇÁ¤ÀÇ °á°ú¿¡µû¶ó ¼³Á¤µÇµµ·Ï ÇÑ´Ù.

Ç¥Çö½Ä ¼Ó¿¡¼­ °³Ã¼ÀÇ uniqueID ¼Ó¼ºÀ» »ç¿ëÇÏ´Â °ÍÀº °³Ã¼¸¦ ÂüÁ¶ÇÏ°Ô ÇÑ´Ù. Ç¥Çö½Ä¿¡¼­ uniqueIDÀÇ »ç¿ëÀº °³Ã¼¸¦ ÂüÁ¶Çϴµ¥ »ç¿ëÇÏ´Â id ´ë½Å¿¡ ÇÏ¿© »ç¿ëÇÏ´Â ¹æ½ÄÀÌ´Ù.

cssText ¼Ó¼ºÀº ź·ÂÀû ¼Ó¼ºµéÀÌ  ¬¿ëµÇÁö ¾Ê´Â ÇϳªÀÇ À¯ÀÏÇÑ ¼Ó¼ºÀÌ´Ù. cssText ¼Ó¼ºÀ» ź·ÂÀû ¼Ó¼º ¸Þ¼­µåµé °°ÀÌ »ç¿ëÇÏÁö ¸»¾Æ¾ß ÇÑ´Ù.

´ÙÀ½Àº setExpression ¸Þ¼­µå¿¡¼­ sExpression ÆĶó¸ÞÅÍ¿¡ ÀÇÇØ ¹ß»ýµÇ´Â ÀϹÝÀûÀÎ ¹®Á¦Á¡À» ¼³¸íÇÑ´Ù. ÀÌ sExpression´Â À¯È¿ÇÏÁö¸¸ ÀÛ¿ëµÇÁö ¾ÊÀ» ¼ö ÀÖ´Ù..

Àû¿ë
°³Ã¼scriptIE
ÂüÁ¶
getExpression, remove, setExpression, recalc

box1Obj + box2Obj : box2Obj.style.width

°á°ú Ç¥½Ãâ

setExpression ¸Þ¼­µå¿Í removeExpression ¸Þ¼­µå·Î div¹Ú½ºÀÇ width ¼Ó¼º Ç¥Çö½ÄÀ» ¼³Á¤ÇÏ°í, Á¦°ÅÇÏ´Â ¿¹Á¦ÀÌ´Ù.

box1Obj <INPUT type=text id=box1Obj value=50 size=3 onchange="showLength.innerText=box3Obj.style.width">+
box2Obj <INPUT type=text id=box2Obj value=50 size=3 onchange="showLength.innerText=box3Obj.style.width"> :
box2Obj.style.width <SPAN id=showLength></SPAN><BR>
<DIV id=box3Obj style="background-color:blue"></DIV><BR>
<SCRIPT>
var sExpress,bVal;
document.onlad=setexp();
function setexp(){
  box3Obj.style.setExpression('width','eval(box1Obj.value)+eval(box2Obj.value)','jscript');
  showLength.innerText=box3Obj.style.width;
}
function getexp(){
  sExpress=box3Obj.style.getExpression('width');
  str='û»ö ¹Ú½ºÀÇ widthÀÇ Ç¥Çö½ÄÀº ' + sExpress + 'ÀÌ°í,<BR>';
  str+='ÀÌ width ¼Ó¼ºÀº °ª ' + box3Obj.style.width+'À» °®´Â´Ù.';
  showA.innerHTML=str;
  showLength.innerText=box3Obj.style.width;
}
function remexp(){
  bVal=box3Obj.style.removeExpression('width');
  showA.innerHTML='Ç¥Çö½ÄÀÌ Á¦°ÅµÇ¾ú³ª? '+bVal;
}
</SCRIPT>
<INPUT type=button id=Button1 value="Ç¥Çö½Ä ³»¿ë" onclick="getexp()">
<INPUT type=button id=Button2 value="Ç¥¼Ç½Ä Á¦°Å" onclick="remexp()">
<INPUT type=button id=Button3 value="Ç¥Çö½Ä »ý¼º" onclick="setexp()"><BR>
<DIV id=showA>°á°ú Ç¥½Ãâ</DIV>

Á¦Ç°¼ö·® ´Ü°¡ÇÕ°è
¸Àµ¿»ê2 500
¾Ë»çÅÁ5 800
ÃÑ°è

tableÀÇ innerText ¼Ó¼ºÀ» ¾÷µ¥ÀÌÆ®Çϱâ À§ÇÏ¿© uniqueID ¼Ó¼º°ú setExpression ¸Þ¼­µå¸¦ »ç¿ëÇÏ¿´´Ù.

<SCRIPT>
function doCalc(){
  var iLen=oTable.rows.length-1;
  for(var i=1;i< iLen;i++){
    var oRow=oTable.rows[i];
    var oCells=oRow.cells;
    oCells(3).setExpression('innerText', 'doGetVal(' + oRow.uniqueID + ')');
  }
  var oGrand=oTable.rows(iLen).cells(1);
  oGrand.setExpression('innerText','doLineTotal()');
}
function doLineTotal(){
  var iValue=0;
  var iLen=oTable.rows.length-1;
  for(var i=1;i< ilen;i++){
    iValue+=parseFloat(oTable.rows(i).cells(3).innerText);
  }
  return iValue;
}
function doGetVal(oRow){
  var oCells=oRow.cells;
  var oPrice=oCells(2);
  var oQuantity=oCells(1);
  var sPrice;
  var sQuantity;
  if (oPrice.childNodes[0].nodeName=='#text'){
    sPrice=oPrice.innerText;
  } else{
    var vPrice=oPrice.childNodes[0].value;
    sPrice=(vPrice=='' ? '0' : vPrice);
  }
  if (oQuantity.childNodes[0].nodeName=='#text'){
    sQuantity=oQuantity.innerText;
  } else{
    var vQuantity=oQuantity.childNodes[0].value;
    sQuantity=(vQuantity=='' ? '0' : vQuantity);
  }
  var vAlg1=parseFloat(sPrice) * parseFloat(sQuantity);
  return vAlg1;
}
</SCRIPT>
<TABLE id="oTable" border=1 width=500 style="text-align:center">
<TR>
<TH>Á¦Ç°</TH><TH>¼ö·®</TH>
<TH>´Ü°¡</TH><TH>ÇÕ°è</TH>
</TR>
<TR>
<TD>¸Àµ¿»ê</TD><TD EDIT="true">2</TD>
<TD EDIT="true">500</TD><TD></TD>
</TR>
<TR>
<TD>¾Ë»çÅÁ</TD><TD EDIT="true">5</TD>
<TD EDIT="true">800</TD><TD></TD>
</TR>
<TR>
<TH COLSPAN=3>ÃÑ°è</TH><TH></TH>
</TR>
</TABLE>
<P><BUTTON onclick="doCalc()">°è»ê Àû¿ë</BUTTON></P>