Click to See Complete Forum and Search --> : save?


Justin
08-04-2003, 10:28 AM
I am makeing a javascript html generator. i was wondering is there a way to make it so when you click the "next"button it will thake the value in the textarea and save it as a .html

it comes upwith a html document in the box. they can preview it, next to the preview button is the next button. i want to take what is in the boxand save it as a html document.(the user gets to choose which folder, clicks save and there done.

goofball
08-04-2003, 11:57 AM
I think the answer is no. The JavaScript that runs in your browser is restricted by certain security features that don't allow you to read/write files to the hard disk. You would need to code a different kind of program - like in Java or C++ - that is run as an executable from the hard disk to get that kind of read/write access.

(could be wrong ... somebody let me know if I am)

spufi
08-04-2003, 10:59 PM
I'm thinking you are. I believe JS does have the ability to access a person's computer and thus it can be really annoying if I person wants it to be. Java, at least, was written so this wouldn't happen.

PeOfEo
08-04-2003, 11:21 PM
The problem with java is it is very hard to provide an interface, I just started anyway but the only way I can think to do that is by somehow useing it with vb. I would say vb alone would be the easyest to use for such a task becasue it can run like a normal program it does not have to open in a dos prompt like java c++

Justin
08-05-2003, 07:25 AM
is there a way to get a form or something that will take that varibule and send it to the program.

goofball
08-05-2003, 09:25 AM
spufi:
I have to say I'm really skeptical - I don't think JavaScript in a browser can access your hard drive for read/write operations at all. If it can, then plz post the code. Java has some of the same security restrictions - but only when it's being run as an Applet in your web browser.

PeOfEo:
Yeah, Java is a tough language because it's so particular about syntax. I have a heck of a time with it myself. Do you know of a way for VB script to perform read/write access to the hard drive? I think that language has similar restrictions to JavaScript. ...?... But anyway, what I meant by using C++ is that you can write & compile a program in that language. The person using the finished HTML generator would have to run it as an .exe file from his own system - no command prompt needed.

Justin:
I think the best thing to do if you really want to write an HTML generator in JavaScript is to include instructions for the user to copy/paste the HTML code after it's generated. I know you can use javascript to perform copy/paste actions from any text field ...

toicontien
08-05-2003, 12:35 PM
Javascript can access your computer's hard drive only for setting and reading cookies. Other than that, you are SOL.

goofball's suggestion is easiest and the most practical for users.

You could program it in Java and let the user download the whole program in a .jar file that would run on the Java Runtime Environment if it's installed on the users' machines. The HTML editor, Arachnophilia is now a Java program, instead of a standalone application.

PeOfEo
08-05-2003, 02:08 PM
Originally posted by goofball


PeOfEo:
Yeah, Java is a tough language because it's so particular about syntax. I have a heck of a time with it myself. Do you know of a way for VB script to perform read/write access to the hard drive? I think that language has similar restrictions to JavaScript. ...?... But anyway, what I meant by using C++ is that you can write & compile a program in that language. The person using the finished HTML generator would have to run it as an .exe file from his own system - no command prompt needed. vb and vb script are different sisual basic is its own program I have visual basic 6 enterprise on this comp, it uses vb the language to create appllications like a .exe with a user interface vb script is similar to vb the language in syntax but it is a web language and it isnt use to make computer aps. Also I wanted to learn c++ but my class was switched from c++ to java by colledge board so I got screwed.

goofball
08-06-2003, 07:36 AM
Oh- yeah... My brain must have been on the fritz. I know about Visual Basic - I just failed to make the connection when you said "vb". I just had a mental picture of the <script language="VBScript"> tag and assumed we were talking about the script. my bad

- kindof a side note: I'm learning C++ also, and I found that my brief experience trying to learn Java actually helps me understand it better. All the classes & variable declarations - and just the way you have to set everything up in the code are a lot like Java, but somehow seem easier. Maybe getting "screwed" by Java could be turned into a positive thing with you as well...

Good luck with it, & cheers

PeOfEo
08-06-2003, 10:00 AM
I tend to thing that c++ would have been more useful.

goofball
08-06-2003, 10:07 AM
agreed.
It's not as "portable" to various platforms, but you don't need an extra interpreter for it, either. Java may be "portable", but to me it seems like more of a pain.

PeOfEo
08-06-2003, 10:19 AM
C++ is portable too, You can use C++ on a mac or linux, you might have to do some things differently but its not like it only works on windows based boxes.

goofball
08-06-2003, 10:30 AM
cool. there's another reason for me to keep learning C++ while that Java book stays on the shelf :cool: