PDA

View Full Version : JavaScript form parser


Del
02-05-1999, 04:10 AM
Okay, maybe someone will remember a while back I was asking about how to parse form input with JavaScript. Well, I found it out http://www.aota.net/ubb/smile.gif Here's the URL to my little tweak page, http://www.downinit.com/stuff/parse.html .

Just punch whatever you like into the boxes and hit the button, it'll write out what you entered. I think the reason I did it was just because I was curious, as I can't really figure out any real use for it as of yet. May be handy in dynamicly generating pages from pre-defined files without generating hardly any extra load on the server (as with PHP, Perl, etc...). I dunno. Anyway, if you like it, use it. Just please keep my snappy, well thought out copyright thingus up top http://www.aota.net/ubb/wink.gif If you find something that seems broken, please let me know.



------------------
Del
www.downinit.com (http://www.downinit.com)

da da da

Justin
02-05-1999, 04:32 AM
Now that is cool! I never knew that you could pass arguments to an HTML page! Wow. I've never seen that done before. I'm very impressed.

I think that would be a great alternative to using Perl/CGI/PHP, as there is no server load. Of course, it helps to find something useful to use it for, but heck, you could even use that on a Geocities page. No special server add-ons or anything - just a 4.x browser, which most sites now require anyway, with CSS and everything else...

Ok, I'm just in awe right now. Actually, I'm Justin Nelson, but that's beside the point...

Me

Del
02-05-1999, 04:51 AM
I think the main drawback is it can't really do anything with the info it receives. JS isn't powerful enough (yet anyway) to be able to write to files. I guess you could use it to set up a single page site, full of dynamic content depending on the query string. EG index.html?view=bob, then (similar to)
if(view == bob){
document.write('blah blah blah associated with bob');
}else{
document.write('blah associated not with bob');
}

Not that doing it that way would be beneficial in any way I can see. However, it would be kind of a snazzy thing to be able to tell people about (people who understand anyway. I was talking about javascript a while back in front of my mom... hehehe)

Another thing you could do...
Use CGI to build/maintain whatever style flat-file text database you need (pipe, csv, etc...), then have it saved as a blah.js file. Use <script src=blah.js></script>, and it'll all be included in the page (well, for most browsers). Then, you could use JavaScript to perform a searching function on it. Yet again saving wear and tear on the server. (I might just think about doing that one... hehehe)

Okay, yet again enough rambling.

G'nite



------------------
Del
www.downinit.com (http://www.downinit.com)

da da da

Justin
02-05-1999, 05:32 AM
One other thing I forgot about - the user can see exactly what was done just by viewing source. That's one thing I like about Perl/Php/etc. That's also one thing I don't like, though, because I learned what little JavaScript that I know from viewing source (HTML, for that matter, and CSS). With the others, you have to be an "insider" I guess... That sounded dumb. You know what I mean, though.

Of course, now that I've moved on from the view-->source days, and I know where to look for documentation, then I guess it's better that other's can't directly see how I did whatever the heck I did.

I must be tired... I'm sounding a little off today. Oh, well, I'll get over it. Wierd mood.

Justin

Del
02-05-1999, 07:19 PM
Justin,
Speaking of the view->source thing, I've got another snazzy little JS thing too. It still needs lots of work, as currently it only works with Netscape 4+ on a PC. Anyway, what it does is deny the right click popup menu when a user right clicks on the document.

I don't have a real demo of it up yet, but you can see it 'in action' on my chat script. Go to http://chat.downinit.com/eileen2/eileen2.cgi . Make your way into any chatroom (use guest/guest as user/pass). Then, when the page loads, right click on the bottom frame (next to the message box). It should work properly if you meet the above requirements (PC and Nut4+).

I think it's neat anyway http://www.aota.net/ubb/smile.gif



------------------
Del
www.downinit.com (http://www.downinit.com)

da da da