HTML标签在showModalDialog中的应用
JavaScript的showModalDialog(模態(tài)對話框)中有提交按鈕,在模態(tài)對話框中點擊按鈕會跳出新的頁面,那么我們可以設(shè)置
<base target="_self">來解決該問題.
?<base target=_blank>//在空白頁打開??
<base target=_parent>//用在框架中,在當(dāng)前頁的上一頁(父親)打開??
<base target=_search>//在瀏覽器搜索欄打開??
<base target=_self>//在當(dāng)前頁打開??
<base target=_top>//用在框架中,但是他的效果是清除框架來顯示目標(biāo)文檔。這對于從框架結(jié)構(gòu)轉(zhuǎn)向無框架結(jié)構(gòu)是很有作用的。
在IE7前的所有版本中,如果在showModalDialog中有個提交等按鈕,可以直接在showModalDialog所打開的那個頁面中的任何地方加入<base target="_self">就可以運行了,但是在IE7中必須把<base target="_self">放在<head></head>中的第一個位置。否則會點擊提交按鈕的時候會重新跳出一個新窗口。
這個屬性有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)鍵點
??? <title></title>
??? <link href="../css/mains.css" rel="stylesheet" type="text/css" />
<script>???
??? function OpenWin(ID) {
??????????? window.showModalDialog('QRZJModalDialog.aspx?ID=' + ID.ClientID, '確認注記', 'dialogLeft=380px;dialogTop=180px;dialogWidth=450px;dialogHeight=100px;');//打開模式窗口
??????????? location.reload();//點擊確認刷新父窗口
??????????? 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">
??????????????????? 注記編號:<asp:TextBox ID="ZJBH" runat="server"></asp:TextBox>
??????????????????? <asp:Button ID="QUEREN" runat="server" Text="確認" 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中的应用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 框架详解_Qt开发技术:QtCharts
- 下一篇: php intval trim,php数