Click to See Complete Forum and Search --> : save as....


xataku_nakusute
07-25-2003, 04:57 PM
ok, i made a script for an advanced html editor is js, right?

now i put a button at the bottom of the page that saves the html inserted in the texarea(this textarea is where the html markup goes for the suers webpage) as an html document

the save works perfectly, but after you save the document, it, for some reazn, submits the html markup again and displays what the page would look like
however, when this happens, instead of being displayed in a new window, it shows it in the main window!

when you press the View button to open up the new window with your page, i add a button and a header at the bottom of the page
-the header shows "yourname's webpage"
-the button closes the popup and redisplays the editor page

however, after saving it, it displays it in the same window and the button and header are both taken away!!! pleaz help!!!!!!!!!!:(

xataku_nakusute
07-25-2003, 05:16 PM
PLEAZ PLEAZ PLEAZ PLEAZ PLEAZ HELP ME!!!!!!:( :( :(

pyro
07-25-2003, 05:30 PM
You have a few problems with your save function, namely the fact that docuemnt.open should be window.open, and then when referencing that window's document after, you need to use mydoc.document.write() etc...

Try this function out:

function save(){
str = document.forms[0].input.value;
mydoc = window.open();
mydoc.document.write(str);
mydoc.document.execCommand("saveAs",true,".html");
mydoc.close();
return false;
}

xataku_nakusute
07-25-2003, 05:36 PM
THANX!! IT WORKS LIKE A CHARM!!

pyro
07-25-2003, 05:40 PM
You're welcome... :)