Re: Languages/scripting for use in HTML pages

by "Paul Wilson" <webgooru(at)gte.net>

 Date:  Mon, 3 Jul 2000 14:22:31 -0500
 To:  <hwg-languages(at)hwg.org>
 References:  aol com
  todo: View Thread, Original
I have a question for you Javascript types.  I have been using a script to
examine a shopping cart FORM selection.  Up til now we were happy to just
tell the customer when they forgot to make a selection.  The script below
does this fine, if they don't make a selection - a JavaScript alert pops up
telling them to check the size.

We now find we also need to tell the customer what they selected with an
alert.  We tried a simple alert just saying "please check your selections"
but that was not specific enough, some people still don't check it.  We feel
an alert telling them what they picked would be better.  I have tried
figuring it out, but I am no programmer.  Here's the script I am using,
borrowed from wsabstract.com.  Thanks in advance.

=====================================================================

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: wsabstract.com -->

<!-- Begin
function checkthis(which) {
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,4)=="Size") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please select SIZE");
return false;
}
else
return true;
}
//  End -->
</SCRIPT>


Here is the drop-down selector I am using.

<SELECT NAME="Size">
<OPTION SELECTED> Select SIZE</OPTION>
<OPTION VALUE="Small">Small</OPTION>
<OPTION VALUE="Medium">Medium </OPTION>
<OPTION VALUE="Large">Large </OPTION>
</SELECT>

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA