open file script

  • Thread starter William Starr Moake
  • Start date
W

William Starr Moake

Another problem with the browser-based WYSIWYG editor I'm trying to
assemble using IE's design mode.

This opens the selected page in the editor iframe named iView:

<select name="template"
onChange="window.open(this.options[this.selectedIndex].value,'iView')">
<option>TEMPLATES</option>
<option value="template1.htm">Template 1</option>
<option value="template2.htm">Template 2</option>
etc.

But I also want a button to open any html file selected from the
user's hard drive. This opens the browse-selected page in a whole new
window rather than in the iframe of the editor:

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function whatFile() {
window.location = 'file:///' + document.form1.cmuds.value,'iView';
}
// End -->
</script>
</head>
<body onLoad="Init()"> [Note: this places iframe in IE design mode]
<form name="form1" method="get">
<p><input type="file" name="cmuds"><input type="button" value="Open
File" onclick="whatFile()"></form>
<iframe src="frame1.htm" name="iView" width="400"
height="300"></iframe>

I've tried substituting window.open for window.location or placing it
elsewhere in the script, but nothing works to open the browse-selected
page in the iframe. I suspect the solution is relatively simple -- an
extra line or two of script -- but I'm such a javascript dummy I can't
find it using my muddling trial-and-error method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top