OT Javascripting <g>

Chipp Walters chipp at chipp.com
Thu Jul 21 01:51:22 EDT 2005


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!

-Chipp

<script>
function checkURL(obj) {
switch( obj.value )
   {
   case 'Chipp':
     document.write(' ');
     window.location.replace('http://www.chipp.com');
     break;
   case 'IBM':
     document.write(' ');  window.location.replace('http://www.ibm.com');
     break;
   default:
     window.location = 'http://www.altuit.com';
   }
}
</script>

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



More information about the use-livecode mailing list