
In the end the will be no trees
A juggling technophile shares personal stories, challenges, humor and perhaps some political commentary.
Ramblings, often stream of conscious, journaling the events of my life.

In the end the will be no trees

View over the church
Within the next 2 hours, write a piece of javascript that based upon values in a series of pulldowns determines the price of a product using quantity, an attribute, another attribute, a third attribute, and the size of the product. There is not a mathematical basis for the price.
Update: The solution follows. This is viewable through the source otherwise I wouldn’t post it. Basically we create a class/object to hold the pricing data. When then create an array of objects to hold each permutation of pricing. Then we make a call to the database and fill the array. Finally, whenever a selection box is changed, we loop through the selections comparing values to what is stored in our objects until we find the one that has the price we want. Then we update the price field. The final product can be seen shortly at Marqiprinting.com under the products listings. Right now flyers works correctly and I’m updating code for the other products.
//define a class to hold the data
function productinfo(qty, coating, sides, tag, productsize, price) {
//initialize object properties
this.quantity = qty;
this.uvcoating = coating;
this.sides = sides;
this.tag = tag;
this.productsize = productsize;
this.price = price;
}
//create an array to hold the objects of data
var products = new Array();
<?php
$x=0;
while($line=mysql_fetch_array($productsresourceid)){
echo "products[".$x."] = new productinfo(".$line['Qty'].",".$line['Coating'].",".$line['NumSides'].",".$line['Tagline'].",'".$line['AvailableSize']."',".$line['ProductPrice'].");";
$x++;
}
?>
function updateprice(){
var pricefound = false;
for(i=0; i < products.length; i++) {
//test values here
frm = document.productselection;
//businescards = ProductSize, ProductSides, Coating, qty, tag
//brochures = ProductSize, ProductSides, Coating, qty, tag
//cdinserts = ProductSize, Coating, qty, tag, ProductSides
//flyers = ProductSize, ProductSides, Coating, qty, tag
//posters = ProductSize, ProductSides, Coating, qty, tag
if(document.getElementById('ProductSize').options[document.getElementById('ProductSize').selectedIndex].value == products[i].productsize
&& document.getElementById('ProductSides').options[document.getElementById('ProductSides').selectedIndex].value == products[i].sides
&& document.getElementById('Coating').options[document.getElementById('Coating').selectedIndex].value == products[i].uvcoating
&& document.getElementById('qty').options[document.getElementById('qty').selectedIndex].value == products[i].quantity
&& document.getElementById('tag').options[document.getElementById('tag').selectedIndex].value == products[i].tag) {
updatedivs('price','Price: $'+products[i].price.toFixed(2));
pricefound = true;
alert('price found! '+products[i].price);
}
}
if(!pricefound) updatedivs('price','Price: $----');
}
}
I dreamed last night that I was trying to pull strings to get Matthew Perry a job. The dream was very fixated on the presidential bridge that connected Knoxville and Lenior City? (perhaps Chattanooga) so that the president could go from the one city to the other on a flat service without having to deal with driving through valleys and ridges.
Student: I have a vice.
Master: You have a vice squad.
TN Lottery Results is no longer terribly embarassing!
Student: Can we really learn from our mistakes?
Master: It would be a mistake to do otherwise.

Rhys and liam sell popcorn for pack 251

Noah and chase sell popcorn for pack 251
Since nothing is better to snack on during football than popcorn Noah and I and some other scouts will be outside of Butler & Bailey (map) selling popcorn from noon to 4pm. The popcorns sales go on during October and are Pack 251’s only fundraiser. If you don’t want popcorn consider buying some as a Christmas gift or as a donation. Thank you!
Student: I grow shorter everyday.
Master: You carry too much weight.
Anyone going to any of the Microsoft MSDN or Launch events?
There are days I just don’t feel like a programmer and then there are days like today! Wahoo! Let the code flow.
Thank G*d for David Bowie!
Ariadne’s Labyrinth brings us a link to the reason (video with sound some foul language).