°³Ã¼ÀÇ À¯Áö(persist) µ¥ÀÌÅÍ¿¡ Áñ°Üã±â »çÀÌÆ®¸¦ °¡´ÉÇÏ°ÔÇÑ´Ù.

script object.style.behavior="url('#default#saveFavorite')";
object.addBehavior("#default#saveFavorite");
HTML <ELEMENT style="behavior:url('#default#saveFavorite')" id=idVal>
XML <prefix:CustomTag id=idVal style="behavior:url('#default#saveFavorite')" />
Àμö
prefix CustomTag°ú ¿¬°üµÈ XML namespace Á¢µÎ¾îÀÌ´Ù. HTML ű׿¡¼­ xmlns ¾ÖÆ®¸®ºäÆ®·Î ¼³Á¤ÇÑ´Ù.
CustomTag ÀÛ¼ºÀÚ°¡ Á¤ÀÇÇÏ¿© »ç¿ëÇϴ ű×ÀÌ´Ù.
idVal °³Ã¼À» ´ëÇ¥ÇÏ´Â À¯ÀÏÇÑ ÀνÄÀÚ ¹®ÀÚ¿­ÀÌ´Ù.
Ư±â

saveFavorite ºñÇìÀ̹ö´Â »ç¿ëÀÚ°¡ ÆäÀÌÁö¸¦ Áñ°Üã±â ¸Þ´º¿¡ Ãß°¡ÇÒ ¶§ ÇöÀç ÆäÀÌÁöÀÇ »óŸ¦ ÀúÀåÇÑ´Ù.
»ç¿ëÀÚ°¡ ±× ÆäÀÌÁö·Î µ¹¾Æ¿À±â À§Çؼ­ Áñ°Üã±â ¸Þ´º¿¡ ÇØ´ç Áñ°Üã±â¸¦ Ŭ¸¯Çϸé ÀúÀåµÇ¾ú´ø °ªÀÌ È¸º¹(restore)µÈ´Ù.

saveFavorite ºñÇìÀ̹ö´Â ¸ðµç ¼¼¼Ç¿¡¼­ °¢ °³Ã¼ÀÇ userData ÀúÀå Áß Çϳª¸¦ »ç¿ëÇÏ¿© À¯Áö(persist)ÇÑ´Ù. µÎ °³Ã¼¸¦ °°Àº ¾ÖÆ®¸®ºäÆ®·Î Àû¿ëÇÏ·Á¸é °¢ ¿¤·¹¸àÆ®ÀÇ userData¿¡ µÑ ´Ù À¯ÁöµÈ´Ù. saveFavorite UserData ÀúÀåÀÌ Áñ°Üã±â.ini ÆÄÀÏ¿¡ ÀúÀåµÇ°í, ±× ÆÄÀÏ¿¡´Â ¹®¼­ÀÇ ÁÖ¼Ò(URL)¿Í »ç¿ëÀÚ µ¥ÀÌÅÍ(UserData) ÀúÀåÀ» Æ÷ÇÔÇÑ´Ù, ¹®¼­°¡ ´ÜÃàÅ°³ª Áñ°Üã±â ¸Þ´º¿¡¼­ ·ÎµùµÇ¸é, ±× ÆäÀÌÁö¸¦ °®´Â ºê¶ó¿ìÀú°¡ ´ÝÇôÀ־ ±× ÆÄÀÏ·Î ºÎÅÍ »ç¿ëÀÚ µ¥ÀÌÅÍ(UserData) ÀúÀå µ¥ÀÌÅÍ°¡ ·ÎµùµÈ´Ù.

¿¹¸¦µé¾î ÇÑ ÆäÀÌÁö°¡ ź·ÂÀûÀ¸·Î ¿©·¯ ½ºÅ¸ÀÏ·Î ¾÷µ¥ÀÌÆ®µÈ °æ¿ì, ÀÌµé ¾÷µ¥ÀÌÆ®µÈ ½ºÅ¸ÀϵéÀº onsave À̺¥Æ®Ã³¸®ÀÚ·Î ÀúÀåµÇ°í onload À̺¥Æ®·Î ·ÎµùµÈ´Ù. ½ºÅ¸ÀÏ°ªµéÀº ¾ÖÆ®¸®ºäÆ® °ªµé·Î ÀúÀåµÇ°í, ·ÎµùµÈ´Ù.

º¸¾È °æ°í : ÀÌ ºñÇìÀ̹ö¸¦ ¿Ã¹Ù¸£Áö ¾Ê°Ô »ç¿ëÇÏ¸é º¸¾È ¹®Á¦°¡ ¾ß±âµÉ ¼ö ÀÖ´Ù. ÀÌ ºñÇìÀ̹ö´Â ¾ÏȣȭµÇÁö ¾ÊÀº UserData ÀúÀåÀ» »ç¿ëÇϹǷΠ¾ÈÀüÇÏÁö ¾Ê´Ù. ¾î´À Àû¿ëÀÌ´ø UserData¿¡ Á¢¼ÓÇÏ´Â °æ¿ì ÀúÀåµÇ´Â µå¶óÀ̺꿡 Á¢¼ÓÀ» Á¦°øÇϹǷÎ, ½Å¿ëÄ«µå ¹øÈ£°°Àº º¸¾ÈÀ» ÇÊ¿ä·Î ÇÏ´Â µ¥ÀÌÅÍ´Â À¯ÁöÇÏÁö ¾Ê´Â °ÍÀÌ ÁÁ´Ù.

ÆäÀÌÁöÀÇ »óŸ¦ ºê¶ó¿ìÀúÀÇ Áñ°Üã±â ¸Þ´º¿¡ À¯ÁöÇϱâ À§Çؼ­´Â ¸ÕÀú saveFavorite ºñÇìÀ̹ö¿¡ Àû¿ëÇÒ ½ºÅ¸ÀϽ¬Æ®(CSS) ½ºÅ¸ÀÏÀ» ¼³Á¤ÇÏ¿©¾ß ÇÑ´Ù. ±× ´ÙÀ½ À¯ÁöµÇ¾î¾ß ÇÒ ³»¿ëÀÇ Å±׿¡ ±× ½ºÅ¸ÀÏÀ» Àû¿ëÇÑ´Ù.

ÇÊ¿äÇÑ styleÀº ÀζóÀÎÀ̳ª ¹®¼­ÀÇ head ºÎºÐ¿¡ ¼³Á¤ÇÒ ¼ö ÀÖ´Ù.

<STYLE>.favoriteClass {behavior:url(#default#saveFavorite);}</STYLE>

id ¼Ó¼ºÀº ¼±ÅÃÀûÀÌÁö¸¸ À¯Áö¸¦ ¿Ã¹Ù¸£°Ô Çϱâ À§Çؼ­´Â id°¡ ÇÊ¿äÇÏ´Ù.

saveFavorite ºñÇìÀ̹ö´Â IE5ÀÇ Win32¿Í Unix Ç÷§Æ®Æû¿¡¼­ Áö¿øµÈ´Ù.


attribute property ¼³¸í
XMLDocument XMLDocument °³Ã¼¿¡ ¹Ý¿µµÈ XML DOM(Document Object Model)ÀÇ ÂüÁ¶¸¦ ¹ÝȯÇÑ´Ù.

¸Þ¼­µå ¼³¸í
getAttribute ÁöÁ¤µÈ ¾ÖÆ®¸®ºäÆ®ÀÇ °ªÀ» ¹ÝȯÇÑ´Ù.
removeAttribute ÁöÁ¤µÈ ¾ÖÆ®¸®ºäÆ®¸¦ Á¦°ÅÇÑ´Ù.
setAttribute ÁöÁ¤µÈ ¾ÖÆ®¸®ºäÆ®ÀÇ °ªÀ» ¼³Á¤ÇÑ´Ù.

À̺¥Æ® ¼³¸í
onload ÆäÀÌÁö°¡ ´Ù½Ã ·ÎµùµÇ¸é À¯Áö(persistent) ¿¤·¹¸àÆ®·ÎºÎÅÍ ¹ß»ýÇÑ´Ù.
onsave À¥ÆäÀÌÁö°¡ ÀúÀåµÇ°Å³ª ºÏ¸¶Å©(bookmark)µÇ°Å³ª »ç¿ëÀÚ°¡ ºê¶ó¿ìÀú·Î ÆäÀÌÁö·ÎºÎÅÍ ´Ù¸¥°÷À¸·Î Ç×ÇØÇϸé À¯Áö(persistent) ¿¤·¹¸àÆ®·ÎºÎÅÍ ¹ß»ýÇÑ´Ù.

Àû¿ë
°³Ã¼ IE
<ELEMENT style="behavior:url('#default#saveFavorite')" id=idVal> IE5(win32,unix)
A ACRONYM ADDRESS AREA B BIG BLOCKQUOTE BUTTON CAPTION CENTER CITE CODE DD DEL DFN DIR DIV DL DT EM FONT FORM hn HR I IMG INPUT type=button INPUT type=checkbox INPUT type=file INPUT type=hidden INPUT type=image INPUT type=password INPUT type=radio INPUT type=reset INPUT type=submit INPUT type=text KBD LABEL LI LISTING MAP MARQUEE MENU OBJECT OL OPTION P plainText PRE Q S SAMP SELECT SMALL SPAN STRIKE STRONG SUB SUP TABLE TEXTAREA TT U UL VAR XMP

onsave·Î Áñ°Üã±â¿¡ ÀúÀåµÇ°í onload À̺¥Æ®Ã³¸®ÀÚ·Î ¹®¼­·Î ·ÎµùµÈ´Ù. setAttribute ¸Þ¼­µå·Î ´Ù¸¥ °³Ã¼µéÀ» Æ÷ÇԾƿ© ÀÔ·Â °³Ã¼¿Í ±× °ªÀ» Áñ°Üã±â¿¡ À¯Áö¸¦ ¼³Á¤ÇÑ´Ù. °ªÀÌ À¯ÁöµÇ±â À§Çؼ­´Â Ŭ¶ó½º·Î ÁöÁ¤µÈ class="saveFavorite"À̾î¾ß ÇÑ´Ù.

<BUTTON
  onclick="window.open('../behavior/exp/wsaveFavorate.html','_new','width=500,height=300,menubar=yes')">¿¹Á¦ º¸Á¶Ã¢ ¿­±â
</BUTTON>
exp/wsaveFavorate.html ÄÚµå
<!DOCTYPE html public "-//w3c//dtd html 4//en">
<HTML>
<HEAD>
<TITLE>¾ð¾î ÂüÁ¶ - Javascript - ºñÇìºñ¾î(behavior) - saveFavorite ¿¹Á¦</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=euc-kr">
<LINK rel="stylesheet" type="text/css" href="../../public/jscript.css">
<META name="save" content="saveFavorite">
<STYLE>.favoriteClass {behavior:url(#default#saveFavorite);}</STYLE>
<SCRIPT>
function dosaveFavorite(){
  if (formName.oPersistText.value==''){
    alert('ÀÔ·ÂÇʵ忡 ¹®ÀÚ¿­À» ÀÔ·ÂÇ϶ó.');
  } else formName.oPersistText.setAttribute('sPersistText',formName.oPersistText.value);
}
function doLoadsaveFavorite(){
  formName.oPersistText.value=formName.oPersistText.getAttribute('sPersistText');
}
</SCRIPT></HEAD>

<BODY>
<TABLE width=500>
<TR><TD>
<DIV style="border:solid 1 blue;background:fff;text-align:center;width:100%;margin:5">
<H3><SPAN class=titleblue><SPAN class=behavior>saveFavorite</SPAN> ¿¹Á¦</SPAN></H3>
</DIV>
<SPAN class=gray><SCRIPT>document.write(document.location)</SCRIPT></SPAN><BR><BR>
<FORM name="formName">
Á¤º¸ ÀÔ·Â 1: <INPUT type="text" id="oPersistText" class="favoriteClass"
  onsave="dosaveFavorite()" onload="doLoadsaveFavorite()">(À¯ÁöµÈ´Ù.)<BR>
Á¤º¸ ÀÔ·Â 2: <INPUT type="text" id="oPersistNone">(À¯ÁöµÇÁö ¾Ê´Â´Ù.)
</FORM><BR>
<P align=center style="background:ffa;padding:10">
ÀÔ·ÂÇÏ°í Áñ°Üã±â¿¡ Ãß°¡ÇÑ ÈÄ, Áñ°Üã±â¿¡¼­ È£ÃâÇÏ¿© º¸¶ó.</P><BR>
<TABLE cellpadding=8 align=center style="border:solid 1 blue">
<TR><TD align=center><BUTTON onClick="self.close()">ÇöÀç º¸Á¶Ã¢ ´Ý±â</BUTTON></TD></TR>
</TABLE>
</TD></TR></TABLE>
</BODY>
</HTML>