Download presentation
Presentation is loading. Please wait.
Published bySheryl Lyons Modified over 9 years ago
1
Creating Web Documents Questions on JavaScript (lecture, text)? Work on JavaScript examples and/or Project III Calculations Homework: experiment, research on search engines
2
Getting to your site People (your audience) get to your web site through –Off-line information –Links on other sites (paid or not-paid) portals –Search ‘engines’ Yahoo (now uses google) Google Metacrawler Ask Jeeves Overture –(Guessing at name)
3
Search /portal sites Some require registration –Some take money for ads or special placement. Some use programs to find sites (bots, spiders). These make use of –meta tags (see next) –titles (titles are also what gets put in book marks) –words on page (visible and not visible) –words on links to page
4
Meta tags Go in head section. Various types. One use is for browsers and search engines.
5
Calculations Form input: calculate bill –simple one using text (no special formatting) –one using select & radio buttons PLUS formats money Need to extract, do calculations, and then display values.
6
Computation test function total(f) { var chocolateprice = 2.50; var cocoaprice = 3.00; var chocolatecost = chocolateprice * f.choc.value; var cocoacost = cocoaprice*f.cocoa.value; var taxrate =.06; var totalcost = chocolatecost + cocoacost; var totalpay = totalcost + taxrate*totalcost; var totals = "Total is " + totalcost + " with tax is " + totalpay; f.cost.value=totalcost; f.wtax.value=totalpay; return false; }
7
Application Form for Chocolate Enter number of goods in each category. Boxes of Chocolate: Boxes of Cocoa: Total:
8
More complex example Need to extract the select value and the radio checked value What if the calculated total is: 2.7 or 4.85603? UGLY!!!
9
Calculation function addup(f) { var total; var taxrate =.08; var drinkbase; opts=f.drink; drinkbase = f.drink[opts.selectedIndex].value; var sizefactor; var i; var totals; var dp; for (i=0;i<f.sizef.length;i++) { if (f.sizef[i].checked) { sizefactor = f.sizef[i].value; } }
10
total = sizefactor * drinkbase; total = total*(1 + taxrate); f.label.value="Total with tax"; f.totalf.value=total; totals = f.totalf.value + "00"; dp = totals.indexOf("."); if (dp<0) { f.totalf.value = "$" + f.totalf.value+".00"; } else {totals = "$" + totals.substr(0,dp+3); f.totalf.value = totals; } return false; }
11
Coffee shop Coffee Hot Cocoa Chai Tall Grand Super
12
Money formatting The code looks for a decimal point (".") dp = totals.indexOf("."); If there isn't one (dp<0 indicates none found, then code adds a dollar sign and ".00" to what was placed in f.totalf.value If there is one, then code places a dollar sign plus the string up to and including where the decimal point is plus 2 more places. The code says dp+3 because dp gives the index, not the length and substr expects length.
13
Money formatting Note: the example as posted doesn't check all the cases for money--that is, the case of whole dollars won't occur. rachel.ns.purchase.edu/~Jeanine/chocolatesimple.html rachel.ns.purchase.edu/~Jeanine/chocolate.html
14
Homework Identify two topics (with more than one keyword) –One corresponding to your project 2 or project 3 –An academic or personal (not too personal) interest Research / find sites using two different search engines (your favorite and one you haven’t used very much) Determine how the search engines get their lists, determine hit order Report on CourseInfo
15
Project III Make posting on topic, team. Include purpose & audience. Use keywords & (terse) description. Review style text. Work on quality of layout. Remember –Project III must have multiple uses of JavaScript and use of form for visitor feedback. –Include also at least one use of tables and one use of frames –Include image map or image slicing –An animation (animated gif) –Use lists (ul or ol), centering, changes of text size, as appropriate, images and links –use of styles (to be discussed more. Read in text.) –use of meta tags (keywords and description) –Sign your project, including e-mail link
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.