本文介绍了如何使用javascript将文本写入html文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好


Hi all


function Open(str) {
            debugger;
            var userName = document.getElementById('tdFormat').outerHTML;
            var newPage = str;
            var j = window.open('HTMLPage.htm')
            j.document.clear();
            j.document.write(newPage );            
            j.document.close();
            j.close();

        }




我正在尝试通过javascript向html文件中写入内容,我已经使用上述功能进行了写入,但是我没有在目标htmlpage.htm中找到任何更改.


请帮助我
tx




Hi I am trying to write something to html file through javascript , I have used above function to write, but i did''t find any changes in the target htmlpage.htm


pls help me
tx

推荐答案


myWindow = window.open("", "tinyWindow", 'toolbar,width=150,height=100')
myWindow.document.write("Welcome to this new window!")
myWindow.document.bgColor="lightblue"
myWindow.document.close()







Or

function exitpop()
{
    my_window = window.open("", "mywindow1", "status=1,width=350,height=150");
    my_window.document.write('<h1>Popup Test!</h1>');
}


<SCRIPT LANGUAGE="JavaScript">
function openindex()
      {
OpenWindow=window.open("", "newwin", "height=250, width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Title Goes Here</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=pink>")
OpenWindow.document.write("<h1>Hello!</h1>")
OpenWindow.document.write("This text will appear in the window!")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")

OpenWindow.document.close()
self.name="main"
     }
</SCRIPT>


这篇关于如何使用javascript将文本写入html文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-21 00:02