473,626 Members | 3,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="windo w.open(this.opt ions[this.selectedIn dex].value,'iView') ">
<option>TEMPLAT ES</option>
<option value="template 1.htm">Template 1</option>
<option value="template 2.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="JavaS cript">
<!-- Begin
function whatFile() {
window.location = 'file:///' + document.form1. cmuds.value,'iV iew';
}
// 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"><i nput type="button" value="Open
File" onclick="whatFi le()"></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 8783
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="whatfi le()">
</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
3083
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', flag='c', mode=438, pgsize=None, ffactor=None, nelem=None, cachesize=None, lorder=None, hflags=0) 190 if ffactor is not None: d.set_h_ffactor(ffactor) 191 if nelem is not None: d.set_h_nelem(nelem)
29
4994
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 window properly but does not pass the parameter. (this is part of a coldfusion template) <a href="##"
2
1844
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 headers and such and server-side vs client-side issues: $dir = "somedir"; $file = "somefile"; print(" <script language=\"JavaScript\">
0
1288
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 this project in client machine in MSProject application as read or readwrite file. I tried using "Microsoft Project 9.0 object library" to create an instance in some button click event in server side. It gives the following error: "Call was Rejected...
18
3323
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 the image. The desired behavior is that when the pop-up is invoked, I want the underlying window to stay put. I don't have this problem when I run the code on my local computer but I do have it when I run the code on geocities.
4
6454
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 through stdin that way a bourne shell script I wrote will execute
13
3541
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 some javascript code that calls window.open. I pass the resource url of page B to Page A's window.open call. Page B is then loaded and executed but none of the server-side code is rendered. If I view the source of the page, the code (and page...
0
2656
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 should decompress, open and then delete nearly 400 files. To do so I use "open FILEPT, "zcat $filename|"". In the beginning the script works fine, but after about 300 files processed I get an error on Open function: “proc: Could not open file...
2
12722
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 w/ Window Script Host. While this is more of a computer support based problem, I was hoping that someone had any knowledge on how to resolve this situation. The error message I'm getting is:
0
8199
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4092
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.