Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to load the text in another textarea where the textarea is within iframe
    text
    copied!<p>in the below code plz tell me how to load the text in textarea where the textarea path is parent.frame_name1.iframe_name1.form_name1.textarea_name1 </p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Language" content="en-us"&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt; &lt;title&gt;Local File I/O&lt;/title&gt; &lt;script type="text/javascript"&gt; &lt;!-- // Begin var ForReading = 1, ForWriting = 2, ForAppending = 8; var objFSO = new ActiveXObject("Scripting.FileSystemObject"); function checkText(fld, btn) { btn.disabled = false; fld.onkeypress = null; return true; } function checkFile(obj, div, btn, btn2, fld) { div.innerHTML = '&lt;p&gt;&lt;b&gt;File:&lt;/b&gt;&lt;br&gt;&lt;b&gt;Size:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;Last Modified:&lt;/b&gt;&lt;/p&gt;'; btn.disabled = true; btn2.disabled = true; fld.value = ''; fld.onkeypress = new Function("return checkText(" + "document." + fld.form.name + "." + fld.name + "," + "document." + btn2.form.name + "." + btn2.name + ")"); // // if (obj.value.indexOf(":") != 1) { // alert("Local file name must include a drive letter."); // return false; // } var ary = obj.value.split("\\"); if (ary.length &lt; 2) { alert("Local file name must include a path."); return false; } if (!/(\.txt)$/i.test(obj.value)) { alert("Local file name must include the '.txt' extension."); return false; } // try { objFile = objFSO.GetFile(obj.value); } catch (e) { if (e.message != "File not found") { alert(e.message); return false; } else { try { if (confirm(obj.value + "\n" + "does not exist. Click 'Ok' to create it.")) { objFile = objFSO.CreateTextFile(obj.value); objFile.Close(); objFile = objFSO.GetFile(obj.value); } else { return false; } } catch (e) { alert(e.message); return false; } } } fileSpecs(div, btn); objFile = null; return true; } function fileSpecs(div, btn) { if (objFile.Size &gt; 0) { btn.disabled = false; } else { btn.disabled = true; } var str = '&lt;p&gt;'; str += '&lt;b&gt;File:&lt;/b&gt; ' + objFile.Path + '&lt;br&gt;'; str += '&lt;b&gt;Size:&lt;/b&gt; '; if (objFile.Size &lt; 1024) { str += objFile.Size + ' bytes'; } else { str += (objFile.Size / 1024).toFixed(1) + ' Kbytes'; } str += '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'; str += '&lt;b&gt;Last Modified:&lt;/b&gt; ' + objFile.DateLastModified; str += '&lt;/p&gt;'; div.innerHTML = str; } function loadFile(btn, obj, div, fld) { objFile = objFSO.GetFile(obj.value); objStream = objFile.OpenAsTextStream(ForReading); fld.value = objStream.ReadAll(); objStream.Close(); objStream = null; fileSpecs(div, btn); objFile = null; return true; } function saveFile(btn, obj, div, fld, btn2) { btn.disabled = true; objFile = objFSO.GetFile(obj.value); objStream = objFile.OpenAsTextStream(ForWriting); objStream.Write(fld.value); objStream.Close(); objStream = null; objFile = objFSO.GetFile(obj.value); fileSpecs(div, btn2); objFile = null; fld.value = ''; fld.onkeypress = new Function("return checkText(" + "document." + fld.form.name + "." + fld.name + "," + "document." + btn.form.name + "." + btn.name + ")"); return true; } // End --&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;form name="myForm" onsubmit="return false;"&gt; &lt;table width="720"&gt; &lt;tr&gt; &lt;td colspan="4"&gt; &lt;div id="fileSpec"&gt; &lt;p&gt;&lt;b&gt;File:&lt;/b&gt;&lt;br&gt;&lt;b&gt;Size:&lt;/b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;b&gt;Last Modified:&lt;/b&gt;&lt;/p&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="3" width="580" align="center" valign="top"&gt; &lt;textarea rows="25" name="fileArea" cols="70" onkeypress="return checkText(this, btnSave);"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;td rowspan="2" width="140" valign="top"&gt;&lt;p&gt;This is a simple demonstration of a browser-based local text file editor.&amp;nbsp; Begin by clicking the &lt;b&gt;Browse&lt;/b&gt; button to select an existing text file from your local hard drive.&amp;nbsp; (In the Browse dialog, you may type in a new file name if desired.)&amp;nbsp; The selected file information is then displayed at the top of the page.&amp;nbsp; For an existing file, click the &lt;b&gt;Load&lt;/b&gt; button next.&amp;nbsp; After editing, click the &lt;b&gt;Save&lt;/b&gt; button to complete the demonstration.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left"&gt; &lt;input type="file" name="fileName" size="50" onchange="return checkFile(this, document.getElementById('fileSpec'), btnLoad, btnSave, fileArea);"&gt; &lt;/td&gt; &lt;td align="center"&gt; &lt;input type="button" name="btnLoad" value="Load" disabled onclick="return loadFile(this, fileName, document.getElementById('fileSpec'), fileArea);"&gt; &lt;/td&gt; &lt;td align="center"&gt; &lt;input type="button" name="btnSave" value="Save" disabled onclick="return saveFile(this, fileName, document.getElementById('fileSpec'), fileArea, btnLoad);"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload