OT Javascripting <g>

Jim Bufalini yoursignup at yahoo.com
Thu Jul 21 10:25:36 EDT 2005

Hi Chipp

I think the problem is your trying to capture an onSubmit event. Try
capturing the onClick event, and change your script like this:

<script type="text/javascript">
function checkURL(obj) {
  switch(obj.tVal.value) {
   case 'Chipp':
     document.location = 'http://www.chipp.com';
   case 'IBM':
     document.location = 'http://www.ibm.com';
     document.location = 'http://www.altuit.com';

<form name="cLogin">
<font color="white">Client Login: </font>
<input type="text" size="16" name="tVal" style="font-size: 8pt">
<input type="button" VALUE="Submit" onClick="checkURL(this.form)">

This also allows you to check multiple fields in the form (as long as you
name them).


-----Original Message-----
From: use-revolution-bounces at lists.runrev.com
[mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of Chipp
Sent: Wednesday, July 20, 2005 7:51 PM
To: Use-Revolution
Subject: OT Javascripting <g>

So, I spent over an hour today trying to write this simple bit of
javascript. The idea is to have a field on a web page, which when one
enters a string and submits, will check the string and 'go someplace'
based upon what it finds.

If anyone is interested, I finally came up with the following below.

See if you can figure out why when I remove the document.write
statements, the code below quits working.

But, the real reason for this post is (in Scott Rossi's familiar rhetoric):

**OMG WTF!!!**

How obtuse is this anyway? Geez, I'm so glad I don't have to program in
that awkward stupid language! I mean, this should be a no brainer, but I
need to do things like "document.write(' ');" (null doesn't work) just
to grab the focus back to the window! And "window.location.replace(...)
instead of just "window.location" in order to cache the history correctly.

Thank God I for Transcript!


function checkURL(obj) {
switch( obj.value )
   case 'Chipp':
     document.write(' ');
   case 'IBM':
     document.write(' ');  window.location.replace('http://www.ibm.com');
     window.location = 'http://www.altuit.com';

<form name="cLogin" onSubmit="checkURL(this.tVal)">
<font color="white">Client Login: </font>
<input type="text" size="16" name="tVal" style="font-size: 8pt"> 
use-revolution mailing list
use-revolution at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription

More information about the Use-livecode mailing list