js 點(diǎn)擊按鈕彈出另一頁,選擇值后,返回到當(dāng)前頁
更新時(shí)間:2010年05月26日 21:56:01 作者:
js 點(diǎn)擊按鈕彈出另一頁,選擇值后,返回到當(dāng)前頁,其實(shí)主要用于cms系統(tǒng)中,相關(guān)文章的搜索,要在已上傳目錄中選擇一些圖片等。
1。 效果圖:

2。 主頁面的代碼:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function open_windows_and_get_selectedinfo(openwindow, control, control2) {
var str = window.showModalDialog(openwindow, window, "dialogWidth=740px;dialogHeight=600px;center=yes;help=no;resizable=no;status=no");
if (!str)
return;
document.getElementById(control).value = str[0];
document.getElementById(control2).value = str[1];
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="autosuggest" style="width:160px;font-size:12px;"><ul></ul></div>
<div>
<input id="txtActive" runat="server" readonly="readonly" />
<input type="button" id="selectActive" runat="server" onclick="javascript:open_windows_and_get_selectedinfo('TestEdt.aspx','hfActive','txtActive')" value="..." />
<asp:HiddenField ID="hfActive" runat="server" />
</div>
</form>
</body>
</html>
3。 彈出頁面的代碼:
<html xmlns="http://www.w3.org/1999/xhtml">
<base target="_self">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
function dbclick_return_and_close(strid, strvalue) {
alert("執(zhí)行該方法!");
var str = new Array(strid, strvalue);
window.returnValue = str;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="#" onclick="javascript:dbclick_return_and_close( '1', 'aaaaaaa');">點(diǎn)擊這一行,帶值返回到原頁面</a>
</div>
</form>
</body>
</html>

2。 主頁面的代碼:
復(fù)制代碼 代碼如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function open_windows_and_get_selectedinfo(openwindow, control, control2) {
var str = window.showModalDialog(openwindow, window, "dialogWidth=740px;dialogHeight=600px;center=yes;help=no;resizable=no;status=no");
if (!str)
return;
document.getElementById(control).value = str[0];
document.getElementById(control2).value = str[1];
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div id="autosuggest" style="width:160px;font-size:12px;"><ul></ul></div>
<div>
<input id="txtActive" runat="server" readonly="readonly" />
<input type="button" id="selectActive" runat="server" onclick="javascript:open_windows_and_get_selectedinfo('TestEdt.aspx','hfActive','txtActive')" value="..." />
<asp:HiddenField ID="hfActive" runat="server" />
</div>
</form>
</body>
</html>
3。 彈出頁面的代碼:
復(fù)制代碼 代碼如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<base target="_self">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">
function dbclick_return_and_close(strid, strvalue) {
alert("執(zhí)行該方法!");
var str = new Array(strid, strvalue);
window.returnValue = str;
window.close();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<a href="#" onclick="javascript:dbclick_return_and_close( '1', 'aaaaaaa');">點(diǎn)擊這一行,帶值返回到原頁面</a>
</div>
</form>
</body>
</html>
您可能感興趣的文章:
- JavaScript實(shí)現(xiàn)返回頂部按鈕案例
- JavaScript 監(jiān)控微信瀏覽器且自帶返回按鈕時(shí)間
- 基于Javascript實(shí)現(xiàn)返回頂部按鈕
- javascript返回頂部的按鈕實(shí)現(xiàn)方法
- javascript中返回頂部按鈕的實(shí)現(xiàn)
- JavaScript阻止瀏覽器返回按鈕的方法
- javascript實(shí)現(xiàn)博客園頁面右下角返回頂部按鈕
- JS返回上一頁實(shí)例代碼通過圖片和按鈕分別實(shí)現(xiàn)
- JavaScript 彈出窗體點(diǎn)擊按鈕返回選擇數(shù)據(jù)的實(shí)現(xiàn)
- JavaScript實(shí)現(xiàn)返回頂部按鈕
相關(guān)文章
純js實(shí)現(xiàn)瀑布流展現(xiàn)照片(自動(dòng)適應(yīng)窗口大小)
用瀑布流來展現(xiàn)照片再好不過了,我的思路大概是一張一張的圖片插入,當(dāng)這一行的圖片保持長寬比例不變并且高度低于250時(shí)就完成一個(gè)了循環(huán),即這一行插入進(jìn)去了2013-04-04
BootStrap注意事項(xiàng)小結(jié)(五)表單
這篇文章主要介紹了BootStrap注意事項(xiàng)小結(jié)(五)表單的相關(guān)資料,非常不錯(cuò),具有參考借鑒價(jià)值,,需要的朋友可以參考下2017-03-03
JavaScript幾種常見循環(huán)遍歷使用和區(qū)別
這篇文章主要介紹了JavaScript幾種常見循環(huán)遍歷使用和區(qū)別,文章圍繞主題展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-09-09
js實(shí)現(xiàn)適用于素材網(wǎng)站的黑色多級(jí)菜單導(dǎo)航條效果
這篇文章主要介紹了js實(shí)現(xiàn)適用于素材網(wǎng)站的黑色多級(jí)菜單導(dǎo)航條效果,涉及javascript鼠標(biāo)事件及頁面元素樣式的動(dòng)態(tài)切換技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-08-08
Javascript打印網(wǎng)頁部分內(nèi)容的腳本
有時(shí)候我們只需要打印部分內(nèi)容,因?yàn)楝F(xiàn)在的頁面中廣告和一些相關(guān)內(nèi)容很多,所有用下面的方法,就可以了2008-11-11
js實(shí)現(xiàn)從右往左勻速顯示圖片(無縫輪播)
這篇文章主要為大家詳細(xì)介紹了js實(shí)現(xiàn)從右往左勻速顯示圖片,無縫輪播,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-06-06
JavaScript?ES6模塊導(dǎo)入和導(dǎo)出的方法
ES6在語言標(biāo)準(zhǔn)的層面上實(shí)現(xiàn)了模塊功能,而且實(shí)現(xiàn)的相當(dāng)簡單,完全可以取代CommonJS和AMD規(guī)范,成為瀏覽器和服務(wù)器通用的模塊解決方案,下面這篇文章主要給大家介紹了關(guān)于ES6模塊導(dǎo)入和導(dǎo)出的方法,需要的朋友可以參考下2022-07-07

