HTML标签在showModalDialog中的应用
JavaScript的showModalDialog(模態(tài)對(duì)話框)中有提交按鈕,在模態(tài)對(duì)話框中點(diǎn)擊按鈕會(huì)跳出新的頁(yè)面,那么我們可以設(shè)置
<base target="_self">來(lái)解決該問(wèn)題.
?<base target=_blank>//在空白頁(yè)打開(kāi)??
<base target=_parent>//用在框架中,在當(dāng)前頁(yè)的上一頁(yè)(父親)打開(kāi)??
<base target=_search>//在瀏覽器搜索欄打開(kāi)??
<base target=_self>//在當(dāng)前頁(yè)打開(kāi)??
<base target=_top>//用在框架中,但是他的效果是清除框架來(lái)顯示目標(biāo)文檔。這對(duì)于從框架結(jié)構(gòu)轉(zhuǎn)向無(wú)框架結(jié)構(gòu)是很有作用的。
在IE7前的所有版本中,如果在showModalDialog中有個(gè)提交等按鈕,可以直接在showModalDialog所打開(kāi)的那個(gè)頁(yè)面中的任何地方加入<base target="_self">就可以運(yùn)行了,但是在IE7中必須把<base target="_self">放在<head></head>中的第一個(gè)位置。否則會(huì)點(diǎn)擊提交按鈕的時(shí)候會(huì)重新跳出一個(gè)新窗口。
這個(gè)屬性有IE6與IE7之分。
注:
1、如果你是IE6,你將<base target="_self"/>加入到<head>標(biāo)簽里就可以了。
2、如果你是IE7,你必須將<base target="_self"/>加入到<head>的中間位置。
代碼示例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
??? <base target="_self" />//關(guān)鍵點(diǎn)
??? <title></title>
??? <link href="../css/mains.css" rel="stylesheet" type="text/css" />
<script>???
??? function OpenWin(ID) {
??????????? window.showModalDialog('QRZJModalDialog.aspx?ID=' + ID.ClientID, '確認(rèn)注記', 'dialogLeft=380px;dialogTop=180px;dialogWidth=450px;dialogHeight=100px;');//打開(kāi)模式窗口
??????????? location.reload();//點(diǎn)擊確認(rèn)刷新父窗口
??????????? return false;
??????? }</script>
</head>
<body>
??? <form id="form1" runat="server">
????????? <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#c7bebc">
??????????? <tr class="line-odd">
??????????????? <td align="center">
??????????????????? 注記編號(hào):<asp:TextBox ID="ZJBH" runat="server"></asp:TextBox>
??????????????????? <asp:Button ID="QUEREN" runat="server" Text="確認(rèn)" OnClick="QUEREN_Click" />
??????????????? </td>
??????????? </tr>
??????? </table>
??? </form>
</body>
</html>
轉(zhuǎn)載于:https://www.cnblogs.com/ZhangGuiHai/archive/2011/08/04/2127019.html
總結(jié)
以上是生活随笔為你收集整理的HTML标签在showModalDialog中的应用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 框架详解_Qt开发技术:QtCharts
- 下一篇: 针对谷歌浏览器Chrome的CSS ha