0
ページのiframeを動的に作成するための2つのスクリプトがありますが、最後のものだけを使用します。ここで2つのJavascriptは2つのiframeを作成できません。最後のjavascriptのみiframeを作成します
<script id='vr_NTgtLxxx'>
window.options = {
api_key: 'NTgtLxxx',
height: '100%',
width: '100%',
min_height: '1000px'
};
var s = document.createElement('script');
s.src = "http://www.example.com/embed.js";
s.async = true;
document.body.appendChild(s);
</script>
<script id='vr_My0tNxxx'>
window.options_search = {
api_key_search: 'My0tNxxx',
height: '100%',
width: '100%',
min_height: '1000px',
'title': 'search'
};
var sa = document.createElement('script');
sa.src = "http://www.example.com/embed-search.js";
sa.async = true;
document.body.appendChild(sa);
</script>
のiframe建物コードここ
window.onload=function(){
var container_s=document.createElement("div");
container_s.setAttribute("id", "div_");
var span_s =document.createElement("span_s");
span_s.setAttribute("id", "span_s_");
span_s.style.fontFamily="arial";
span_s.style.fontWeight="bold";
span_s.style.textAlign="center";
span_s.style.display ="Block";
var loader_message_s = document.createTextNode("....");
span_s.appendChild(loader_message_s);
container_s.appendChild(span_s);
var ifrm_s = document.createElement("iframe");
ifrm_s.setAttribute("src","SRC_URL");
ifrm_s.style.width = "100%";
ifrm_s.style.minHeight = "1000px";
ifrm_s.frameBorder=0;
if(window.options_search.width){
ifrm_s.style.width = window.options_search.width;
}
ifrm_s.style.height = "100%";
if(window.options_search.height){
ifrm_s.style.height = window.options_search.height;
}
if(window.options_search.min_height){
ifrm_s.style.minHeight = window.options_search.height;
}
if(window.options_search.border){
ifrm_s.style.border = window.options_search.border;
}
ifrm_s.setAttribute("id", key_search_s);
ifrm_s.setAttribute("onload", 'frameload_s("span_s_'+key_search_s+'")');
container_s.appendChild(ifrm_s);
var s_s = document.getElementById("vr_"+key_search_s);
s_s.parentNode.insertBefore(container_s, s_s);
}
である私はwindow.onload
関数定義をオーバーライドして、問題のリレーをIFRAME
何を使用していない作業溶液
。私にはうまく見えます。私は 'embed.js'と' embed-search.js'の両方を調べます。サードパーティAPIのファイルですか? –
@AdamAzad、jsファイルは第三者として考えることができますが、私は両方のファイルを作成しました。両方のファイルは異なっており、変数は – user2428249
になります。少なくとも部分は 'iframe'を作成します –