Javascript 不使用document.write将iframe插入站点

Javascript 不使用document.write将iframe插入站点,javascript,html,google-chrome,iframe,document.write,Javascript,Html,Google Chrome,Iframe,Document.write,我们的网站使用iframe显示我们提供的产品库,最近iframe停止在Google Chrome中加载,因为他们停止了支持document.write。我们需要一个解决方案,以相同的方式显示页面,但不使用document.write。我是一个新手,尝试过几种解决方案,但都没有效果 <script language="JavaScript"> <!-- var ss='<span style="font-size: small;"><b>NOTICE:&l

我们的网站使用iframe显示我们提供的产品库,最近iframe停止在Google Chrome中加载,因为他们停止了支持document.write。我们需要一个解决方案,以相同的方式显示页面,但不使用document.write。我是一个新手,尝试过几种解决方案,但都没有效果

<script language="JavaScript">
<!--
var ss='<span style="font-size: small;"><b>NOTICE:</b> If you are having 
trouble finding a pattern, try searching the first three letters of the 
pattern name in the search bar. Also, be aware that some sheers may be 
photographed with a window pane to show sheer quality.<br>If you are using 
Google Chrome and have an issue viewing the library, please switch to another 
browser.</span><br><br>'; 
var upper_limit = 500000000;

//-->
document.write(ss);
  function getIP(json) {

        document.write('<iframe frameborder="0" marginheight="0" width="100%" 
height="700" src=" ' + 'http://client.richloomfabrics.com/cgi-bin/Wdrv01?
&amp;PARPAR=CON&amp;MELMEL=ALL&amp;PTYPTY=UPH&amp;IPAIPA=' + json.ip + 
'&amp;IPACOK=' + RandomNumber(upper_limit) + '&amp;PGMPGM=WC033&amp;>
</iframe>');

          }
</script>
<script type="application/javascript" src="https://api.ipify.org?
format=jsonp&callback=getIP"></script>
我们所拥有的:

<script language="JavaScript">
<!--
var ss='<span style="font-size: small;"><b>NOTICE:</b> If you are having 
trouble finding a pattern, try searching the first three letters of the 
pattern name in the search bar. Also, be aware that some sheers may be 
photographed with a window pane to show sheer quality.<br>If you are using 
Google Chrome and have an issue viewing the library, please switch to another 
browser.</span><br><br>'; 
var upper_limit = 500000000;

//-->
document.write(ss);
  function getIP(json) {

        document.write('<iframe frameborder="0" marginheight="0" width="100%" 
height="700" src=" ' + 'http://client.richloomfabrics.com/cgi-bin/Wdrv01?
&amp;PARPAR=CON&amp;MELMEL=ALL&amp;PTYPTY=UPH&amp;IPAIPA=' + json.ip + 
'&amp;IPACOK=' + RandomNumber(upper_limit) + '&amp;PGMPGM=WC033&amp;>
</iframe>');

          }
</script>
<script type="application/javascript" src="https://api.ipify.org?
format=jsonp&callback=getIP"></script>

文件写作(ss);
函数getIP(json){

document.write(“在一个非常简单的情况下,您可以使用
body
innerHTML
属性,如下所示

<script language="JavaScript">
<!--
var ss='<span style="font-size: small;"><b>NOTICE:</b> If you are having 
trouble finding a pattern, try searching the first three letters of the 
pattern name in the search bar. Also, be aware that some sheers may be 
photographed with a window pane to show sheer quality.<br>If you are using 
Google Chrome and have an issue viewing the library, please switch to another 
browser.</span><br><br>'; 
var upper_limit = 500000000;

//-->
document.write(ss);
  function getIP(json) {

        document.write('<iframe frameborder="0" marginheight="0" width="100%" 
height="700" src=" ' + 'http://client.richloomfabrics.com/cgi-bin/Wdrv01?
&amp;PARPAR=CON&amp;MELMEL=ALL&amp;PTYPTY=UPH&amp;IPAIPA=' + json.ip + 
'&amp;IPACOK=' + RandomNumber(upper_limit) + '&amp;PGMPGM=WC033&amp;>
</iframe>');

          }
</script>
<script type="application/javascript" src="https://api.ipify.org?
format=jsonp&callback=getIP"></script>
<script language="JavaScript">
<!--
var ss='<span style="font-size: small;"><b>NOTICE:</b> If you are having 
trouble finding a pattern, try searching the first three letters of the 
pattern name in the search bar. Also, be aware that some sheers may be 
photographed with a window pane to show sheer quality.<br>If you are using 
Google Chrome and have an issue viewing the library, please switch to another 
browser.</span><br><br>'; 
var upper_limit = 500000000;

//-->
document.body.innerHTML += ss;
  function getIP(json) {

        document.body.innerHTML += '<iframe frameborder="0" marginheight="0" width="100%" 
height="700" src=" ' + 'http://client.richloomfabrics.com/cgi-bin/Wdrv01?
&amp;PARPAR=CON&amp;MELMEL=ALL&amp;PTYPTY=UPH&amp;IPAIPA=' + json.ip + 
'&amp;IPACOK=' + RandomNumber(upper_limit) + '&amp;PGMPGM=WC033&amp;>
</iframe>';

          }
</script>
<script type="application/javascript" src="https://api.ipify.org?
format=jsonp&callback=getIP"></script>

document.body.innerHTML+=ss;
函数getIP(json){

document.body.innerHTML+='也可以使用appendChild

<script language="JavaScript">
<!--
var ss='<span style="font-size: small;"><b>NOTICE:</b> If you are having 
trouble finding a pattern, try searching the first three letters of the 
pattern name in the search bar. Also, be aware that some sheers may be 
photographed with a window pane to show sheer quality.<br>If you are using 
Google Chrome and have an issue viewing the library, please switch to another 
browser.</span><br><br>'; 
var upper_limit = 500000000;

//-->
document.write(ss);
  function getIP(json) {

        document.write('<iframe frameborder="0" marginheight="0" width="100%" 
height="700" src=" ' + 'http://client.richloomfabrics.com/cgi-bin/Wdrv01?
&amp;PARPAR=CON&amp;MELMEL=ALL&amp;PTYPTY=UPH&amp;IPAIPA=' + json.ip + 
'&amp;IPACOK=' + RandomNumber(upper_limit) + '&amp;PGMPGM=WC033&amp;>
</iframe>');

          }
</script>
<script type="application/javascript" src="https://api.ipify.org?
format=jsonp&callback=getIP"></script>
var iframeElem = document.createElement('iframe');
iframeElem.src = 'https://www.google.com';
document.body.appendChild(iframeElem);

此部分是否在某个HTML元素中?如果它是具有
id=“documentWriteElement”
的元素,则可以将
document.write
替换为
document.getElementById(“documentWriteElement”).innerHTML
。但是,我建议您查看
文档.createElement
元素.appendChild
而不是
innerHTML
。感谢您的建议,很遗憾,我无法让任何建议发挥作用。事实上,当我更改这些建议的内容时,甚至连节目中的类型都没有了,所以绝对不行。这是在Squarespace网站上,我不知道这是否有什么不同。另外,我对JS真的是个新手,我知道一些CSS和HTML,但仅此而已,不幸的是,这里没有人比我更好。