Jump to content

hacknsack

Members
  • Posts

    183
  • Joined

  • Last visited

Everything posted by hacknsack

  1. You're welcome.Glad it was helpful.Thanks,
  2. hacknsack

    Javascript

    The first question is, are you asking from the client or server(asp) perspective.Here's an example of a client side connection using ActiveX.Planet Source CodeThanks,
  3. Here are some ideas that might help.You can create an array and loop through and add the values for each product: <html><head> <title></title><script type="text/javascript">var tm = null;var prev_total; //kills flickervar fields = ['Item1', 'Item2'];var m = [12.25, 14.50];function tally(){var form = document.forms['orderform'];var total = 0; for(var j = 0; j < fields.length; j ++){ var f_field_v = form.elements[fields[j]].value; total += (parseInt(f_field_v)|| 0) * m[j]; } if(total != prev_total){ prev_total = total; form.elements['Total'].value = '$' + total.toFixed(2); } }function start(){tm = setInterval('tally()', 100);}</script></head><body onload="start()"><center><h1>Order Form</h1></center><form method="post" name="orderform"><input type=hidden name=to value="Myemailaddress"><table border="0"> <tr><td colspan="4"></tr><tr><td colspan="2"> </td><tr><td><input type="text" name="Item1" size="3" /> P1 Cost ea. $12.25<br /><input type="text" name="Item2" size="3" /> P2 Cost ea. $14.50</tr><tr><td> Total <input type="text" name="Total" readOnly="yes" value="$0" size="7" /></td></tr><table></body></html> Post back if it needs tweaking.Thanks,
  4. Testing doesn't indicate that for me, 55555 and 5aaa5 both fail.Ideally the "test()" method should be used though: <html><head><script type="text/javascript">function ckField(){var errmsg = '';var OfferIDPat = /^[0-9]{1,3}[a-z]{1,2}[0-9]? \(exp: [0-9]{1,3}[a-z]{1,2}[0-9]?\)$/i; if (!OfferIDPat.test(document.OrderForm.a_Offer_ID.value)) { errmsg = errmsg + "\n" + "Zonet Rebate OfferID format #AA (ie. 5JA)"; document.OrderForm.a_Offer_ID.focus(); alert (errmsg); return false; }return true; }</script></head><body><form name="OrderForm" onsubmit="return ckField()"><input type="text" name="a_Offer_ID" size="20" /><br /><input type="submit"></form></body></html> Try this page and let us know how it works out.You also want to make sure your javascript is enabled :)Thanks,
  5. If I understand your post this should work, you'll need to test all your variations. <script type="text/javascript">function ckField(){var errmsg = '';var OfferIDPat = /^[0-9]{1,3}[a-z]{1,2}[0-9]? \(exp: [0-9]{1,3}[a-z]{1,2}[0-9]?\)$/i;var matchArray=document.OrderForm.a_Offer_ID.value.match(OfferIDPat); if (matchArray==null) { errmsg = errmsg + "\n" + "Zonet Rebate OfferID format #AA (ie. 5JA)"; document.OrderForm.a_Offer_ID.focus(); alert (errmsg); return false; }return true; }</script> Post back if you need more help.Thanks,
  6. There are a couple zip files here that are good to have on your desktop:http://soluveb.com/devedgedownloads/Thanks,
  7. Nice use of the "here doc".You could format a string and pass it to the js split(): #set the PERL var$array_str = '1,2,3,4,5';print header;print start_html(-title=>'JS->PERL CGI');print h2("Here's a PERL variable:");print <<HTML;<table border="1"> <tr> <script type="text/javascript"> var myStr = '$array_str'; var js_array = myStr.split(","); for(var j = 0; j < js_array.length; j++){ document.write("<td>" + js_array[j] + "</td>"); } </script> </tr></table>HTML Thanks,
  8. hacknsack

    IE probs

    From what I see it's working just like you should expect. Since IE tests "true" at 'if(document.all)' it never checks the 'else if'.You could invert your test.Thanks,
×
×
  • Create New...