以下のhrefリンクで2つのことを達成しようとしています。まず、ポップアップウィンドウを開きたいと思います。完了しました。次に、そのポップアップウィンドウにiframeを表示したいと思います。これは容易に達成されましたまで私はiframe srcのパラメータとしてhrefリンクのテキストを渡す必要があることに気づきました。例えばのでポップアップウィンドウの動的iframe
、そのsrc="http://localhost:8080/test/document.html?OnSale"
ない限り、私のポップアップウィンドウ内のiframe文句を言わないの負荷私のhtmlページの本文にdocument.write
を作成しようとして動的なiframeのイムをプリントアウトしませんなぜ私は把握することはできませんhrefのリンクの私のfoo()関数を使用して...
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<a href="#" onclick="popup('popUpDiv')">
<img align="right" src="http://localhost:8080/test/img/close_img.png">
</a>
<script type="text/javascript">
function foo(obj)
{
test1 = "http://localhost:8080/test/document.html?"+obj.text;
document.write('<iframe height="450" allowTransparency="true" frameborder="0" scrolling="yes" style="width:100%;" src="'+test1+'" type= "text/javascript"></iframe>');
}
</div>
<a href="#" onclick="popup('popUpDiv');foo(this);">OnSale</a>
編集:ここでは は私の完全なHTMLページです。すべてtomcat7 w/win7とfirefoxでローカルに実行されています。
<html>
<head>
<script type="text/javascript" src="http://localhost:8080/test/css-popup/css-pop.js"></script>
<link href="http://localhost:8080/test/css-popup/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="blanket" style="display:none;"></div>
<div id="popUpDiv" style="display:none;">
<a href="#" onclick="popup('popUpDiv')">
<img align="right" src="http://localhost:8080/test/css-popup/x.png">
</a>
<script type="text/javascript">
function foo(obj){
test1 = "http://localhost:8080/test/document.html?"+obj.innerHTML;
document.write('<iframe height="450" allowTransparency="true" frameborder="0" scrolling="yes" style="width:100%;" src="'+test1+'" type= "text/javascript"></iframe>');
}
</script>
</div>
<a href="#" onclick="popup('popUpDiv');foo(this);">OnSale</a>
</body>
</html>
、これを試してみてください。 innerHTMLはどちらもしませんでしたが、標準ではないテキストについて学ぶのは良いです。 – Chris
@Chris、私の更新された答えをもう一度見てください。 – ocanal
ocanal、ありがとう!これは完全にiframeを開きますが、Firefoxでは新しいタブとしてポップアップウィンドウではなく開きます。 window.open(n)が新しいタブの代わりにポップアップする方法はありますか? – Chris