
Here a unique code which I wrote back in 2006. Ironically, it was the very first
javascript I’ve written in my entire life! Anyway, what’s this script all about?
Well…the scenario is, what happen if you have a small HTML product website and
you want a JAVASCRIPTed search engine which your visitors can look through various
products by just selecting for specs.
Your answers is…
<form name="productform">
<!--
/***************************************************************************
* Multiple Combo Selection Result (MCSR)
* --------------------------------------
* begin : Thursday, Jul 14, 2006
* copyright : © 2006 Dark Sun DeXigns [Www.Dsdexigns.Com]
* email : Andy D. Hajime [andyhajime@dsdexigns.com]
*
* $Id: MCSR,v 0.429 2006/07/14 04:31:01 Exp $
*
***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
–>
<!– BEGIN CSS –>
<style type=”text/css”>
<!–
.ds-combo-style {
font-family: Arial;
font-size: 12px;
color: #000000;
background-color: #ECECEC;
width: 120px;
}
–>
</style>
<!– BEGIN JS –>
<script type=”text/javascript”>
<!–
function getproduct()
{
var product = document.productform.product.options[document.productform.product.selectedIndex].value
var spec = document.productform.spec.options[document.productform.spec.selectedIndex].value
if (product==0)
{
if (spec==0){alert(’Please select a option’)}
if (spec==1){alert(’Please select a product’)}
if (spec==2){alert(’Please select a product’)}
if (spec==3){alert(’Please select a product’)}
}
if (product==1)
{
if (spec==0){alert(’Please select a SPEC’)}
if (spec==1){alert(’ITEM 001 / BELOW 400′)}
if (spec==2){alert(’ITEM 001 / 4000 - 6000′)}
if (spec==3){alert(’ITEM 001 / 6000 - 10000′)}
}
if (product==2)
{
if (spec==0){alert(’Please select a SPEC’)}
if (spec==1){alert(’ITEM 002 / BELOW 400′)}
if (spec==2){alert(’ITEM 002 / 4000 - 6000′)}
if (spec==3){alert(’ITEM 002 / 6000 - 10000′)}
}
if (product==3)
{
if (spec==0){alert(’Please select a SPEC’)}
if (spec==1){alert(’ITEM 003 / BELOW 400′)}
if (spec==2){alert(’ITEM 003 / 4000 - 6000′)}
if (spec==3){alert(’ITEM 003 / 6000 - 10000′)}
}
if (product==4)
{
if (spec==0){alert(’Please select a SPEC’)}
if (spec==1){alert(’ANY PRODUCT / BELOW 400′)}
if (spec==2){alert(’ANY PRODUCT / 4000 - 6000′)}
if (spec==3){alert(’ANY PRODUCT / 6000 - 10000′)}
}
}
//–>
</script>
<!– BEGIN COMBO BOX –>
<select name=”product” class=”ds-combo-style”>
<option value=”0″>Select a product</option>
<option value=”1″>» ITEM 001</option>
<option value=”2″>» ITEM 002</option>
<option value=”3″>» ITEM 003</option>
<option value=”4″>» Any Product</option>
</select>
<select name=”spec” class=”ds-combo-style”>
<option value=”0″>Select a SPEC</option>
<option value=”1″>» Below 4000</option>
<option value=”2″>» 4000 - 6000</option>
<option value=”3″>» 6000 - 10000</option>
</select>
<!– BEGIN GO BUTTON –>
<input name=”Submit” value=”Submit” onclick=”getproduct()” type=”button” />
</form>
Oh and please do acknowledge that this script is a freeware to all that uses it.
If you happened to encounter the same script somewhere else and you’ve payed for
it, please report it to me. |