Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to ask user for filename and display a text file with same name 1

Status
Not open for further replies.

JerMyster

IS-IT--Management
Mar 17, 2003
49
US
(I'm new forgive me)
I want to have a webpage that asks a user to type in a file name i.e.: text.txt then press a button that will then go to a directory i.e.: c:\textfiles then display the text file they named in a text area.

Thanks for the help.
 
How will the user know what file names are available?


Keith
studiosoft.co.uk
 
it is the same as there phone number i.e."3237080325.txt"

BTW - what would you reccomend to read to get better at web building, not the graphics part the functionality.

Also, I have FrontPage and Dreameweaver, which is better, or would you reccomend something different.

Thanks
 
The files will always be there, they will be updated from time to time.
 
this will load the txt files if they reside in the same location as the html thats calling them.
else add the path like this
window.open("files/"+txtfile+".txt")

<html>
<head>
<title>load file demo</title>

<script language=javascript>
function LoadFile()
{
var txtfile =document.filemenu.file.value;
window.open(txtfile+".txt")
}
</script>

</head>
<body>
<form name="filemenu">
<p><input type="text" name="file" size="20"><input type="button" onclick="LoadFile()" value="Load"></p>
</form>
</body>
</html>


Aaron Taylor
John Mutch Electronics
 
Aaron,

Thanks for the code, it looks great but I haven't figured out why the javascript doesn't work for me yet, will this work in FP?

What would you suggest I read for javascript functions, commands, etc. ?

Thanks again
 
i didnt test it within fp
i saved it and ran it as a html file.

i havent read anything myself on javascript.
but theres plenty of stuff in bookstores or on the web.

Aaron Taylor
John Mutch Electronics
 
Use a Program like Dreamweaver to create a java effect you want and then study the code it produces. Try changing some of the values etc. If you are stuck Google the command word.
Hope this helps
Keith

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top