JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old March 9th, 2005, 12:11 AM
mattyb_1978 mattyb_1978 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 3 mattyb_1978 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 47 m 41 sec
Reputation Power: 0
Exclamation Redirecting using a variable

I'm having trouble redirecting my page using javascript. I want to read the value of a file field using javascript then, after checking the format is valid, open the file that has been entered in a new window.

My code is currently as such:

var orderForm = document.uploadForm.fileType.value;
window.open(orderForm);

where the value of document.uploadForm.fileType.value is 'myFile.htm'

This produces an error on page.

If I then change this to:

window.open('orderForm');

It takes the value absolute 'orderForm' and opens the window URL: http://myDomain/orderForm

I can then get even closer and use:

window.open('""'+orderForm);

which gives me URL: http://myDomain/""C:/myFile.htm

What I want to do is open the window locally with the URL being: c:/myFile.htm which is generated from a user input.

Is there any way to do this using Javascript?

Thanks in advance...

Reply With Quote
  #2  
Old March 9th, 2005, 08:05 AM
Anibal Anibal is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 176 Anibal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 4 h 20 m 48 sec
Reputation Power: 4
Hey mattyb! Does it produce a javascript error, or simply does not open the wanted page in the new window? If your problem is the second, check that the file exists (I mean the var has the correct file name) and also, that the name is in the same directory as the page (if the filename had no path before it).

Good Luck...


Anibal.

Reply With Quote
  #3  
Old March 9th, 2005, 08:34 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
How about something like this?

To simply open a local file on the client's computer:
Code:
<script language="JavaScript"><!--
function myOpen(what) {
    window.open("file://"+what);
}
//--></script>

<form name="myform">
<input type="file" name="myfile">
<input type="button" value="Test" onClick="myOpen(this.form.myfile.value)">
</form>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Redirecting using a variable


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway