![](/img/trans.png)
[英]Is this a good code to redirect parent window to a url instead of the popup and close the popup?
[英]Create window popup with custom content instead of url?
任何人都讓我想一想實現窗口彈出窗口和訪問父窗口的js
變量到彈出窗口的自定義內容。
<div id="modeltext" style="display:none">
<p id="linker" ></p>
<script type="text/javascript">
var news = "http://google.com";
jQuery(document).ready(function() {
jQuery('#linker').html("<a href="+news+">"+news+"</a>");
});
</script>
This is for testing according to the concept.
</div>
<a href="#" id="testing" >Open a popup window</a>
JS:
jQuery('#testing').click(function() {
var w = window.open($('', "", "width=600, height=400, scrollbars=yes"));
alert(news);
var $w = $(w.document.body);
$w.html($('#modelText').html());
});
例如:
讓我們考慮一下我有一套段落和簡單的html格式。 如果有人點擊父母的鏈接(Open in New Window)
。 而不是url,我想加載自定義內容,我也無法訪問彈出窗口的js變量值。 不確定是否有任何建議會很好。 我嘗試提供js小提琴,但彈出窗口不起作用。 有沒有一種方法可以顯示自定義內容而不是url並使用js變量從主窗口顯示到彈出窗口?(如何在父窗口中獲取窗口彈出負載)。 小提琴無法正常工作,但這是代碼http://jsfiddle.net/6cpup/11/
編輯:
我認為這是因為你錯誤地打開了窗戶,看看這個jsFiddle
var w = window.open('', "", "width=600, height=400, scrollbars=yes");
//alert(ICJX_JXPath);
var html = $("#modeltext").html();
$(w.document.body).html(html);
對於帶有自定義HTML的彈出窗口 ,請查看此答案在JavaScript中打開HTML並插入HTML
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.