قم بإنشاء صفحة نافذة الوالدين الجديدة:
أضف البرنامج النصي التالي
نسخة الكود كما يلي:
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "server">
<title> الأول </title>
</head>
<script type = "text/javaScript">
وظيفة showdialog (url)
{
var iwidth = 560 ؛ // عرض نافذة مشروط
var iheight = 300 ؛ // ارتفاع نافذة المشرف
var itop = (window.screen.height-iheight-100)/2 ؛
var ileft = (window.screen.width-iwidth)/2 ؛
var returnvalue = window.showmodaldialog (url ، "newWindow" ، "dialogheight:"+iheight+"px ؛ dialogwidth:"+iwidth+"px ؛ شريط الأدوات: no ؛ menubar: no ؛ scrollbars: no ؛ no ؛ no ؛ no ؛ station: no ؛ left: top: top: 100px ؛
document.getElementById ("textbox1"). innertext = returnValue ؛
}
</script>
<body>
<form id = "form1" runat = "server">
<input id = "button1" type = "button" value = "button" onClick = "showDialog ('./ second.aspx')" />
<div> <asp: textbox id = "textbox1" runat = "server" width = "67px"> </asp: textbox> </viv>
</form>
</body>
</html>
إنشاء صفحة ثانية. html:
نسخة الكود كما يلي:
<html xmlns = "http://www.w3.org/1999/xhtml">
<head runat = "server">
<title> الثاني </title>
<!-<base target = "_ self"> </pase>->
</head>
<script language = "javaScript">
وظيفة مغلقة ()
{
window.opener = null ؛
window.close () ؛
}
وظيفة موافق ()
{
var value = document.getElementSbyName ("myradio") ؛
لـ (var i = 0 ؛ i <value.length ؛ i ++)
{
إذا (القيمة [i]. تحقق)
{
window.RETURNVALUE = القيمة [i]. value ؛
window.close () ؛
}
آخر
{
document.getElementById ("lab_info"). innertext = "لا يوجد عنصر محدد ، الرجاء تحديد!" ؛
}
}
}
</script>
<body>
<form id = "form1" runat = "server">
<viv>
<asp: dataGrid id = "dgsjygl" runat = "server" leftPaging = "true" autogenerateColumns = "false"
backColor = "White" font-size = "9pt" pagesize = "5" width = "100 ٪" height = "127px" onItemDatAbound = "dgsjygl_itemdatabound">
<وضع PagerStyle = "numericpages" />
<ListenringItemStyle BackColor = "Gainsboro" />
<itemStyle backColor = "#eeeeeee" predicolor = "black" theorizontalalign = "center" />
<أعمدة>
<ASP: TemplateColumn>
<HeaderTemplate>
<label> حدد </label>
</headertemplate>
<EtemTemplate>
<type type = "radio" id = "myradio" name = "myradio" value = '<٪# databinder.eval (container.dataitem ، "id") ٪>'>
</itemTemplate>
<headerstyle font-bold = "true" faptontalalign = "center" width = "60px" />
<itemStyle FenizontalAlign = "Center" />
</ASP: TemplateColumn>
<asp: boundColumn DataField = "id" HeaderText = "no.">
<headersstyle font-bold = "true" width = "75px" horizontalalign = "center"/>
</ASP: BoundColumn>
<asp: boundColumn DataField = "MC" HeaderText = "Name">
<headersstyle font-bold = "true" width = "90px" horizontalalign = "center"/>
<itemStyle FenizontalAlign = "Center" />
</ASP: BoundColumn>
<asp: boundColumn DataField = "BT" HeaderText = "title">
<headersstyle font-bold = "true" أفقي = "المركز"/>
</ASP: BoundColumn>
</أعمدة>
<headersstyle backcolor = "#7481ba" predoLor = "Yellow" font-bold = "false" font-iTalic = "false" font-overline = "false" font-strikeout = "false" font-line = "false" fals-size = "small" />
</asp: datagrid>
</div>
<viv>
<input id = "btn_ok" type = "button" onClick = "OK ()" value = "ok"/>
<input id = "btn_cancel" type = "button" onClick = "clickDiag ()" value = "cancel" />
</div>
</form>
</body>
</html>
ما سبق هو كل شيء عن تنفيذ هذه الوظيفة البسيطة. أشعر أنه يجب أن يكون هناك طريقة أكثر ملاءمة. إذا كنت تعرف ، يرجى ترك رسالة لشرح.