模式对话框传值 博客分类: 原创 HTML
程序员文章站
2024-03-19 19:39:28
...
<script language=javascript> function openDialogWin() { var currentCode = document.all.code.value; var result = window.showModalDialog("bb.html",currentCode,"dialogHeight:260px; dialogWidth:400px; status:no; help:no; scroll:no"); if (result != 'cancel'){ document.all.code.value = result; } } </script> <input type="button" value="Edit Code" name="btn" onclick="openDialogWin()" /> <input type="text" value="C" name="code" id="code" readonly="readonly"/>
<html> <head> <script language='javascript'> var selectCode = window.dialogArguments; function putSelectCode(code){ selectCode = code; } function confirm(){ window.returnValue = "a"; window.close(); } function cancel(){ window.returnValue = "cancel"; window.close(); } </script> </head> <body> <input type="radio" id="radioTag1" name="radioTag" value="1" /> <input type="radio" id="radioTag2" name="radioTag" value="2" /> <input type='button' value='Cancel' onclick='cancel()' /> <input type='button' value='Done' onclick='confirm()' /> </body> </html>