Results 1 to 8 of 8

Thread: JavaScript Text Boxes

  1. #1
    Senior Member
    Join Date
    Jan 2004
    Location
    Hawaii
    Posts
    350

    Question JavaScript Text Boxes

    Okay, here's the deal. I'm working with HTML and JavaScript. I'm supposed to do a small web thing for school. Now the thing is, I have a "blog" page. So far, I open it up in Frontpage 2003, and write an entry...mainly about what I've changed on the site since I last updated. But what I'm working on now is a link to another page that has a text box. I want to be able to type in this text box, and have the entry appended to "blog.html", and possibly to a certain location in it. As of now all I've got is document.write() which creates a new page.

    Any help would be greatly appreciated.
    Thanks

    A_T
    Geek isn't just a four-letter word; it's a six-figure income.

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Posts
    786
    You're not going to be able to do this without some sort of server-side processing. Does your webhost let you use PERL/PHP/ASP, or some other server side language/standard?

    Sure document.write() can generate a page, but it generates it client side and the server never sees it and never saves it. So only you can see the page it makes. Which is useless in a blog where you want others to see what you write.



    Anyways, what can you use?

    I can think up some simple procedures to dynamically generate a blog. It would involve some sort of index.pl (PERL) and a couple of text files named in sequential order like "ent0001.txt". The PERL script would open the text files and add the text to a table of entries. Some other upload.pl would let you submit the text for the next TXT file or entry, and the main page would see it and would let you update it with that text box...

  3. #3
    Senior Member
    Join Date
    Jan 2004
    Location
    Hawaii
    Posts
    350
    I am handing this in for a school project. So it will be stored on a shared drive, and the teacher just clicks "index.html". So there is no webserver. I am stuck with basic IE6 BS. Any ideas?

    A_T

    P.S. There is no way for me to get them to run ASP/PHP/VBSCRIPT on there for me...they're incredibly lazy at my school....damn rednecks.
    <humor>
    Man you should see the Admin though...heh, his eyes are freakin buggin out of his head.
    </humor>
    Geek isn't just a four-letter word; it's a six-figure income.

  4. #4
    hmmm you could create the site in flash - it doesn't require any server side scripting and could read the entries from text files (or if you want more control over the look and feel of the text tat is loaded you could load XML files and then style them with CSS)

    check www.actionscript.org for more details on loading external files in flash

    v_Ln

  5. #5
    Senior Member
    Join Date
    Jan 2004
    Location
    Hawaii
    Posts
    350
    Im supposed to start learning Flash soon witht this class...so I suppose that would be halpful to learn. Thanks.

    AxessTerminated
    Geek isn't just a four-letter word; it's a six-figure income.

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    786
    Well, I have done a little bit of work with IE & ActiveX scripting. Basically with the MS J-Script (Not Java Script) you can do some ActiveX stuff to load/save files on a drive. Although IE pops up a window telling you the page might try something unsafe. With JavaScript and document.write I guess you could have it write the entries to the browser fairly dynamically...


    So, with IE and its J-Script/JavaScript flexibility, you should be able to use the following code to open and save files (I've bolded stuff that you need to change):

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    			<!-- Begin
    				function FileSave(form) {
    					Location = form.LOCATION.value;
    					Data = "";
    
    					var File = new ActiveXObject("Scripting.FileSystemObject");
    					var SaveFile = File.CreateTextFile(Location, true, true);
    					SaveFile.WriteLine(Data);
    					SaveFile.Close();
    				}
    			// End -->
    		</SCRIPT>
    
    
    <SCRIPT LANGUAGE="JavaScript">
    			<!-- Begin
    				function FileLoad(form) {
    					Location = form.LOCATION.value;
    
    					var ForReading = "1", Unicode = "-1";
    					File = new ActiveXObject("Scripting.FileSystemObject");
    					LoadFile = File.GetFile(Location);
    					Loaded = LoadFile.OpenAsTextStream(ForReading, Unicode);
    					Load = Loaded.ReadLine();
    					Loaded.Close();
    					
    					document.write(Load);
    				}
    			// End -->
    		</SCRIPT>
    Location - Where the file is saved/loaded from. For example, "C:\\data.txt" (Note that "\" is a special character, so you need two "\\" to make it equal "\")

    Load - The line read from the file. To read multiple lines, I forget how to do it. Note that UNICODE is specified in my above code. I don't remember how to do Plain Text.

    Data - The text to write to the file. Some sort of submit page.



    Good luck. I don't know if the code works because it is ~3 years old and I had to remove some other components of it to post it. But the original code worked well and was valid, as long as my cutting didn't break anything...

    Oh, and coding like this for the client in an HTML page is a bad idea - we're just trying to provide a makeshift environment for you. Good luck

  7. #7
    Senior Member
    Join Date
    Jan 2004
    Location
    Hawaii
    Posts
    350
    Thanks Tim_Axe, maybe i'll give that one a try as i can't find too many very basic Flash tutorials around here and wont recieve a textbook from school for another week or two.

    A_T
    Geek isn't just a four-letter word; it's a six-figure income.

  8. #8
    cant find any basic flash tuts!?

    loading XML formated text -> http://www.actionscript.org/tutorial...nt/index.shtml
    Using CSS in Flash -> http://www.actionscript.org/tutorial...sh/index.shtml
    Scrolling Text -> http://www.actionscript.org/tutorial...xt/index.shtml (or you could just use the scrollbar component in flash)
    Loading Dynamic Content -> http://www.actionscript.org/tutorial...nt/index.shtml
    XML 101 in Flash -> http://www.actionscript.org/tutorial...ML/index.shtml
    My own Preloader Tut -> http://design.unerror.com/forum/viewtopic.php?t=18

    that will take you tyhrough everything you need to know to load in external text into a flash movie

    also if you take a look at -> http://www.tutorialized.com/tutorials/Flash/1 they have alot of tuts on all ares of flash

    if you want a book which will take you through the whole design process of building a site (As well as alot of other cool wee hints and tips) pick up a copy of Foundation Actionscript by Friends of Ed (http://www.friendsofed.com/books/1590591666/)

    v_Ln

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •