'Alert'에 해당되는 글 1건

  1. 2008.10.29 JavaScript Alert,Confirm, Prompt 사용 예제

alert()은 다이알로그 박스에 메시지를 나타낼 때 사용

confirm()은 메시지를 나타내고 확인을 할 때 사용(OK/Cancel)

prompt()는 메시지를 나타내고 문자열의 입력을 받을 때 사용


<예>

<HTML>
<HEAD><TITLE>Alerts, Confirmations, and Prompts</TITLE>
</HEAD>
<BODY>
 <H1>Alerts, Confirmations, and Prompts</H1>
 <HR>
  Use the buttons below to test dialogs in JavaScript.
 <HR>
 <FORM NAME="winform">
  <INPUT TYPE="button" VALUE="Display an Alert"
  onClick="window.alert('This is a test alert.');  ">
  <P><INPUT TYPE="button" VALUE="Display a Confirmation"
  onClick="temp = window.confirm('Would you like to confirm?');
  window.status=(temp)?'confirm: true':'confirm: false'; ">
  <P><INPUT TYPE="button" VALUE="Display a Prompt"
  onClick="var temp = window.prompt('Enter some Text:','This is the default value');
  window.status=temp;  ">
 </FORM>
 <BR>Have fun!
 <HR>
</BODY>
</HTML>

Posted by 철냄비짱
,