![]() | Source code below from: JavaScript + Css + DOM Magic (With CD-ROM) By Makiko Itoh Published 15 June, 2002 Average rating
Powells
Alibris
|
var productname = new Array(); productname[0] = "Classic Red Pull Wagon"; productname[1] = "1940s Tricycle"; productname[2] = "Rocket Flyer Bicycle"; productname[3] = "Scooter"; productname[4] = "Croquet Set"; productname[5] = "Sandcastle Building Set"; productname[6] = "Tool Set"; var productdesc = new Array(); productdesc[0] = "This traditional design was first created by the XYZ Company in the 1920s. Welded construction, hard-baked enamel finish."; productdesc[1] = "Based on a classic design from the 1940s. Welded steel construction with hard fired enamel finish."; productdesc[2] = "This streamlined bike was first introduced in 1955. The design is reminiscent of the cars of the period. Welded steel construction will never bend or warp. Uses standard bicycle tires."; productdesc[3] = "Scooters are back in style, and we've brought back a classic design from the past."; productdesc[4] = "Croquet, anyone? Associated with polite English society, croquet has been around since the early 19th century. Great fun for a party! This hand-turned hardwood set should last a lifetime and more."; productdesc[5] = "The perfect set of tools for building that architectural masterpiece in the sand. Includes a pail, shovel, rake, and hoe/smoother. Sturdy plastic is guaranteed for 10 years."; productdesc[6] = "The perfect make-believe construction kit for small children. Includes a wrench, spanner, screwdriver, hammer, pincers and gauge."; var origprice = new Array(); origprice[0] = "$250.00"; origprice[1] = "$350.00"; origprice[2] = "$525.00"; origprice[3] = "$400.00"; origprice[4] = "$150.00"; origprice[5] = "$25.00"; origprice[6] = "$20.00"; var saleprice = new Array(); saleprice[0] = "$225.00"; saleprice[1] = null; saleprice[2] = null; saleprice[3] = "$350.00"; saleprice[4] = "$125.00"; saleprice[5] = null; saleprice[6] = null; var moredesc = new Array(); moredesc[0] = "Carts or wagons of this type made of steel have been made for more than 80 years, but the classic design looks as contemporary as if it were made yesterday. The original designs were inspired by the sleek Art-Deco superliners and trains of the 1920s and 30s.Our interepretation of this classic adds some new features, such as a length-adjustable handle and cushioned wheels. The cart itself can support up to 200 lbs. A hard-fired powder enamel finish makes a virtually scratch-proof surface on both the cart and the handle. Wheels can be removed and replaced." moredesc[1] = "The sleek design of this tricycle was doubtlessly inspired by the jet fighters of World War II. First introduced in 1949 to cater to the baby boom generation, this model was in production until 1965. We've updated the construction of this tricycle with comfortably padded rubber coated handles, inflatable tires, and a padded seat. Recommended for children age 3 to 5. The tricycle can support up to 100 lbs." moredesc[2] = "One your child graduates from the Tricycle, what better choice than this stylish bike? The Rocket Flyer was designed and manufactured by the Acme Bicycle Company from 1955 well into the 1970s, and was one of the most popular designs in their line. It's easy to see why - on this bike, your child will have the most stylish ride on the block.We have updated the construction in subtle ways, by exchanging the original hard seat to a spring-cushioned one, upgrading the single gear to three gears, and making it possible to attach training wheels to the back wheel. Recommended for children age 5 through 8. Supports up to 150 lbs."; moredesc[3] = "Scooters were first introduced in the 1940s. This design dates back to 1962. The one-piece construction is extremely strong, and can support up to 200 lbs. We have modified the handle to be height-adjustable, so it can be ridden by the whole family. The graceful curving line of the handle to the base is sure to turn heads as your child - or even you - scoot down the street. Classic powder-blue finish is high-fired enamel and will never chip." moredesc[4] = "This classic Croquet set is based on one manufactured by the Burton and Sons Company of London, England around the turn of the century. We've even replicated the presentation box it came in, printed with Edwardian-era pictures. Each piece is hand turned in beech, a hard wearing wood. Painted with non-toxic paint. The stakes are rustproof."; moredesc[5] = "We were dissatisfied with the cheap quality of the plastic beach toys being manufactured today, and again went back to the past for inspiration. We found this in a 1950s catalog and fell in love with the sturdiness of the design. The handle of the pail will withstand even the toughest tug-of-wars, and the handles of the tools will not break even if you try. (We tried hard in our test labs and could only bend them a little!) This set is guaranteed for 10 years, and hours of creative fun in the sun."; moredesc[6] = "What boy - or girl for that matter - doesn't want to emulate Dad in the workshop? With this fully functional, yet safe, tool set, he or she can.r The tools are sized for small hands, and are constructed of a special hard-wearing plastic. Recommended for children aged 2 1/2 and up."; var smallimg = new Array(); smallimg[0] = new Image(100,94); smallimg[0].src = "images/photos/cart-sm.jpg"; smallimg[1] = new Image(100,98); smallimg[1].src = "images/photos/tricycle-sm.jpg"; smallimg[2] = new Image(100,99); smallimg[2].src = "images/photos/bicycle-sm.jpg"; smallimg[3] = new Image(100,101); smallimg[3].src = "images/photos/scooter-sm.jpg"; smallimg[4] = new Image(100,95); smallimg[4].src = "images/photos/croquet-sm.jpg"; smallimg[5] = new Image(100,91); smallimg[5].src = "images/photos/sandset-sm.jpg"; smallimg[6] = new Image(100,97); smallimg[6].src = "images/photos/toolset-sm.jpg"; var largeimg = new Array(); largeimg[0] = "images/photos/cart-lg.jpg"; largeimg[1] = "images/photos/tricycle-lg.jpg"; largeimg[2] = "images/photos/bicycle-lg.jpg"; largeimg[3] = "images/photos/scooter-lg.jpg"; largeimg[4] = "images/photos/croquet-lg.jpg"; largeimg[5] = "images/photos/sandset-lg.jpg"; largeimg[6] = "images/photos/toolset-lg.jpg"; var largeimgHt = new Array(); largeimgHt[0] = 317; largeimgHt[1] = 333; largeimgHt[2] = 252; largeimgHt[3] = 436; largeimgHt[4] = 301; largeimgHt[5] = 273; largeimgHt[6] = 254; function createProductDesc(num) { var headnum = "head" + num; var picsrc = "img" + num; var descnum = "p" + num; var pricenum = "pr" + num; var header = document.getElementById(headnum); var newheadtext = document.createTextNode(productname[num]); var oldheadtext = header.childNodes[0]; header.replaceChild(newheadtext, oldheadtext); var desc = document.getElementById(descnum); var newdesctext = document.createTextNode(productdesc[num]); var olddesctext = desc.childNodes[0]; desc.replaceChild(newdesctext, olddesctext); var price = document.getElementById(pricenum); var newpricetext = document.createTextNode("Price: "+ origprice[num]); var oldorigpricetext = price.childNodes[0]; price.replaceChild(newpricetext,oldorigpricetext); if (saleprice[num] != null) { var newsalepricetext = document.createTextNode(".....On Sale for "+saleprice[num]); var oldsalepricetext = price.childNodes[1]; price.replaceChild(newsalepricetext,oldsalepricetext); } var imagenum = "img" + num; document.getElementById(imagenum).src = smallimg[num].src; } function ProductList() { for (i=0; i < productname.length; i++) { createProductDesc(i) } } function showdetail(num) { var detailnum = "detail" + num; var detail = document.getElementById(detailnum); var detailtext = document.createTextNode("::: "+ moredesc[num]); var lastNodeValue = detail.lastChild.nodeValue; if (lastNodeValue == null || lastNodeValue == "") { detail.appendChild(detailtext) } } function showcase(num) { var header = document.getElementById('featurehead'); var newheadtext = document.createTextNode(productname[num]); var oldheadtext = header.childNodes[0]; header.replaceChild(newheadtext, oldheadtext); var desc = document.getElementById('featuredesc'); var newdesctext = document.createTextNode(productdesc[num]); var olddesctext = desc.childNodes[0]; desc.replaceChild(newdesctext, olddesctext); var desc = document.getElementById('featuremore'); var newdesctext = document.createTextNode(moredesc[num]); var olddesctext = desc.childNodes[0]; desc.replaceChild(newdesctext, olddesctext); var price = document.getElementById('featureprice'); var newpricetext = document.createTextNode("Price: "+ origprice[num]); var oldorigpricetext = price.childNodes[0]; price.replaceChild(newpricetext,oldorigpricetext); if (saleprice[num] != null) { var newsalepricetext = document.createTextNode(".....On Sale for "+saleprice[num]); var oldsalepricetext = price.childNodes[1]; price.replaceChild(newsalepricetext,oldsalepricetext); } var productPicObj = document.createElement("IMG"); productPicObj.id = "picture"; productPicObj.width = 400; productPicObj.height =largeimgHt[num]; productPicObj.src = largeimg[num]; document.getElementById('productpic').appendChild(productPicObj); } //obtain a random number between n and m var randomNum; function randomize(n, m) { randomNum = Math.floor(Math.abs(Math.random() * (m - n + 1) - 0.0000000001)) + n; return randomNum; } function randomshowcase() { randomize (0, productdesc.length-1); showcase(randomNum); }