|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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... |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
||||
|
||||
|
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>
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Redirecting using a variable |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|