À¥ÆäÀÌÁö°¡ ÀúÀåµÇ°Å³ª, ºÏ¸¶Å©µÇ°Å³ª »ç¿ëÀÚ°¡ ´Ù¸¥ ÆäÀÌÁö·Î Ç×ÇØÇØ °¥ ¶§ ¿ø·¡(persisted)ÀÇ ¿¤·¹¸àÆ®¿¡¼­ ¹ß»ýÇÑ´Ù.


À̺¥Æ® ¼Ó¼º
object.onsave=handler JScript ¸¸-
object.onsave=GetRef("handler") VBScript 5.0-
¸í¸íµÈ ½ºÅ©¸³Æ® <SCRIPT for=object event=onsave> Explorer-
À̺¥Æ® Ư¼º
Bubbles ¾øÀ½
Ãë¼Ò °¡´É
¹ß»ý ¿øÀÎ
  • À¥ÆäÀÌÁö¸¦ ÀúÀåÇÒ ¶§
  • À¥ÆäÀÌÁö¸¦ ºÏ¸¶Å©(Bookmark)ÇÒ ¶§
  • ´Ù¸¥ ÆäÀÌÁö·Î Ç×ÇØÇØ °¥¶§
µðÆúÆ® ÀÛ¿ë ÀÌ ½ºÅ©¸³Æ®¿Í ¿¬°üµÈ ÀÛ¿ëÀ» ½ÃÀÛÇÑ´Ù.

srcElement À̺¥Æ®°¡ ¹ß»ýÇÑ °³Ã¼¸¦ ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
Àû¿ë
°³Ã¼scriptHTMLIE

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>

saveHistory ¿¹Á¦

<BUTTON onclick="window.open('../behavior/exp/wsaveHistory.html','_new','width=500,height=300')">¿¹Á¦ º¸Á¶Ã¢ ¿­±â</BUTTON>
exp/wsaveHistory.html ÄÚµå
<!DOCTYPE html public "-//w3c//dtd html 4//en">
<HTML>
<HEAD>
<TITLE>¾ð¾î ÂüÁ¶ - Javascript - ºñÇìºñ¾î(behavior) - saveHistory ¿¹Á¦</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="history">
<STYLE>.sHistory {behavior:url(#default#saveHistory);}</STYLE>
<SCRIPT>
function doSave(){
  message='ÀÔ·ÂÇÏ°í ÁøÇàÇ϶ó.';
  if (oPersistForm.oPersistText.value) document.location='../../public/blank.html';
  else {
    alert(message);
    oPersistForm.oPersistText.focus();
    return false;
  }
}
</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>saveHistory</SPAN> ¿¹Á¦</SPAN></H3>
</DIV>
<SPAN class=gray><SCRIPT>document.write(document.location)</SCRIPT></SPAN><BR><BR>
<FORM name="oPersistForm">
Á¤º¸ ÀÔ·Â 1: <INPUT type=text id="oPersistText" class=sHistory>(À¯ÁöµÈ´Ù.)<BR>
Á¤º¸ ÀÔ·Â 2: <INPUT type=text id="oPersistNone">(À¯ÁöµÇÁö ¾Ê´Â´Ù.)
</FORM><BR>

<P align=center style="background:ffa;padding:10">ÀÔ·ÂÇÑ ÈÄ  
<BUTTON onClick="doSave()"
  style="background:aff;padding:1;font-size:.9em"><B>¿©±â¸¦ Ŭ¸¯</B></BUTTON>ÇÏ°í ´Ù½Ã µ¹¾Æ¿Í º¸¶ó.</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>
../../public/blank.html ÄÚµå
<!DOCTYPE html public "-//w3c//dtd html 4//en">
<HTML>
<HEAD>
<TITLE>ºó ÆäÀÌÁö</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=EUC-KR">
<LINK rel="stylesheet" type="text/css" href="../public/jscript.css">
</HEAD>

<BODY>
<CENTER>
<BR><BR><BR>
<H3>ºó ÆäÀÌÁö</H3><BR><BR>
<A href="Javascript:history.go(-1)"><IMG src="../../gif/arbackv.gif" border=0 alt="ÀÌÀü ÆäÀÌÁö·Î"></A>
<A href="Javascript:history.back()">ÀÌÀü ÆäÀÌÁö·Î</A>
<BR><BR><BR>
<SPAN class=mini><SPAN class=teal>ÀÌ ÆäÀÌÁö´Â <SCRIPT>document.write(document.location)</SCRIPT> ÀÓ</SPAN></SPAN>
</CENTER>

</BODY>
</HTML>