FireCracker
06-16-2005, 04:18 PM
Hello everyone, I am new here, but this seems like a rather good, active forum. I"m battling with some JavaScript, a language that I've had very limited use of until recently. I'm atempting to build an HTML editor that is based in PHP; however, I am currently working on the "Preview HTML" function which will open a new window, and write the HTML from the textarea in the form to that new window. I'm following an example off of the HTML Goodies website.
As of right now I can get the window to open; however, I am unable to get the code to write to the textarea. I'm pretty sure that there is some common n00b mistake in it, and a little bit of help would be great.
Here is my current code:
<head>
<script language="JavaScript">
//The function to create the window in the head
function openPreview()
{
var OpenWindow=window.open("", "newwin");
OpenWindow.document.write(document.htmledit.flie_conts.value);
}
</script>
</head>
<form name="htmledit" method="post" action="savefile.php">
<input type="hidden" name="file_name" value="index.html">
<textarea rows="10" cols="60" wrap="off" name="file_conts"><? echo $file; ?></textarea><br>
<input type="submit" name="submit" value="Save File"><input type="button" name="Preview" value="Priview HTML" onClick="openPreview()">
</form>
The error that I am recieving from IE is as follows:
document.htmledit.flie_conts.value is null or not an object
Thank you all very much for your help
As of right now I can get the window to open; however, I am unable to get the code to write to the textarea. I'm pretty sure that there is some common n00b mistake in it, and a little bit of help would be great.
Here is my current code:
<head>
<script language="JavaScript">
//The function to create the window in the head
function openPreview()
{
var OpenWindow=window.open("", "newwin");
OpenWindow.document.write(document.htmledit.flie_conts.value);
}
</script>
</head>
<form name="htmledit" method="post" action="savefile.php">
<input type="hidden" name="file_name" value="index.html">
<textarea rows="10" cols="60" wrap="off" name="file_conts"><? echo $file; ?></textarea><br>
<input type="submit" name="submit" value="Save File"><input type="button" name="Preview" value="Priview HTML" onClick="openPreview()">
</form>
The error that I am recieving from IE is as follows:
document.htmledit.flie_conts.value is null or not an object
Thank you all very much for your help