Entry
How can I replace prompt with a self made dialog?
Apr 24th, 2000 07:23
Martin Honnen,
IE allows that easily with the showModalDialog function explained in
http://www.faqts.com/knowledge-base/view.phtml/aid/876/fid/124/lang/en.
Here is an example dialog replacing a prompt:
<HTML>
<HEAD>
<SCRIPT>
</SCRIPT>
</HEAD>
<BODY ONLOAD="var answer = document.forms[0].answer; answer.focus();
answer.select();">
<FORM ONSUBMIT="window.returnValue = this.answer.value;
window.close();
return false;">
<TABLE WIDTH="100%" HEIGHT="100%">
<TR>
<TD VALIGN="middle" ALIGN="center">
<SCRIPT>
document.write(window.dialogArguments.question);
document.write('<BR>');
document.write('<INPUT TYPE="text" SIZE="40" NAME="answer"' +
'VALUE="' + window.dialogArguments.defaultAnswer + '">');
</SCRIPT>
<BR>
<DIV ALIGN="right">
<INPUT TYPE="submit" VALUE=" OK ">
<INPUT TYPE="button" VALUE="Cancel"
ONCLICK="window.returnValue = null;
window.close();"
>
</DIV>
</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
which you call as follows in another page:
showModalDialog('nameOfAboveDialogPage.html',
{question: 'Who is GOD?', defaultAnswer: 'Kibo'});