473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

open file script

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.
Jul 23 '05 #1
1 8756
William Starr Moake wrote:
<snip>
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.


try this (a function was removed from body onload to test this code):

<SCRIPT type="text/javascript">
function whatfile() {
document.frames['iView'].location.href= document.form1.cmuds.value;
}
</script>

.....

<body>
[Note: this places iframe in IE design mode]
<br>
<br>
<form name="form1" method="get">
<p>Select File to Load <input type="file" name="cmuds">
<p>Load Document in Iframe <input type="button" value="Open File"
onclick="whatfile()">
</form>
<br>
<br>
<iframe src="frame1.htm" name="iView" id="iView" width="400"
height="300"></iframe>
</body>

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Derek Basch | last post by:
Hello, I have a CGI script which uses anydb.open() to create a DBM. However I get this traceback: /usr/lib/python2.3/bsddb/__init__.py in hashopen(file='/var/www/bp/predictor/tools.dbm',...
29
by: wayne | last post by:
Hey there... I'm having some problems passing url parameters with an open.window command. I'm not terribly familiar with java script but here is the code below. When executed it opens the...
2
by: kevinm3574 | last post by:
So, I'm doing the following in a php script so that I can fire a download dialogue AND redirect the page (after clicking submit in a form). I'm doing it this way because of the problem with...
0
by: Santhosh.A.N | last post by:
Hi, I have a problem to be solved yet. Following is the problem: I have a MSProject saved in SQLServer using ODBC, which automatically generates tables relevant to data. My requirement is to open...
18
by: len.hartley | last post by:
Hi, I am trying to pop-up a window when the user clicks on an image. The problem is that when the user clicks on the image and the window pops up OK, but the window underneath also proceeds to...
4
by: DyslexicAnaboko | last post by:
Hello, I have a module that is part of larger project that is giving me trouble, so I setup an example. Brief ===== I simply want to open a text file and make the contents avaliable...
13
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
0
by: Ofelia | last post by:
Hi, I'm new to this forum and to Perl language but I would like to ask for your help. I'm working in Linux and the files I need to process are in the format “file.gz”. I created a script which...
2
by: LayneMitch via WebmasterKB.com | last post by:
Hello. I posted this earlier with the full code of the JavaScript file I'm trying to open. I'm posting this again, because the file is not the problem. I seem to be having a 'windows' problem...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.