HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

28
HTML for Beginners & HTML for Beginners & JavaScript Magic JavaScript Magic - Step By Step - - Step By Step - Thrandur Arnthorsson Thrandur Arnthorsson thrandur.net thrandur.net

Transcript of HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Page 1: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

HTML for Beginners &HTML for Beginners &JavaScript MagicJavaScript Magic

- Step By Step -- Step By Step -

Thrandur ArnthorssonThrandur Arnthorssonthrandur.netthrandur.net

Page 2: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

My SBI Story...My SBI Story...

• ThrandurThrandur– Programmer, project Programmer, project

managermanager– Alfatungl (Elfen Moon) Alfatungl (Elfen Moon)

company 2002company 2002– Started Started

4x4OffRoads.com 4x4OffRoads.com Christmas 2003Christmas 2003

– Quit JOB early 2006Quit JOB early 2006• 4x4OffRoads.com4x4OffRoads.com

– Popular off road sitePopular off road site– ~8000 guests pr. day~8000 guests pr. day– >6000 subscribers>6000 subscribers– In Google Top 10!In Google Top 10!

Page 3: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

OverviewOverview• HTML for BeginnersHTML for Beginners

– HTML TablesHTML Tables– SBI IncludesSBI Includes– HTML ResourcesHTML Resources

• JavaScript MagicJavaScript Magic– Bookmark this Site Bookmark this Site – A-B Split Testing AdSenseA-B Split Testing AdSense– Random PictureRandom Picture– JavaScript Resources JavaScript Resources – CSS Menu StructureCSS Menu Structure

Page 4: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

HTML for BeginnersHTML for Beginners

• Keep it simple!Keep it simple!

• Learn only what you NEEDLearn only what you NEED

• Use Microsoft Expression Web, Use Microsoft Expression Web, DreamWeaver or other WYSIWYG DreamWeaver or other WYSIWYG editoreditor

• Think “boxes” or “building blocks”Think “boxes” or “building blocks”

Page 5: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

HTML BasicsHTML Basics

• HyperText Markup LanguageHyperText Markup Language• Tags Tags

– Make this <b>BOLD</b>Make this <b>BOLD</b>

• Links:Links:– <a href=<a href=www.sitesell.comwww.sitesell.com>SiteSell</a>>SiteSell</a>

– httphttp://sbitips.sitesell.com/creating-links.html://sbitips.sitesell.com/creating-links.html– http://http://sbitips.sitesell.com/tags.htmlsbitips.sitesell.com/tags.html

Page 6: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

<table><tr>

<td>a</td>

<td>b</td>

</tr><tr>

<td>c</td>

<td>d</td>

</tr></table>

HTML tablesHTML tables

• Great for simple controlGreat for simple control

• Example 1Example 1: Picture index: Picture index• Example 2: AdSense in ContentExample 2: AdSense in Content

Page 7: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

SBI IncludesSBI Includes

Page 8: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Step 1 - Make a draft of the L&F you want Step 1 - Make a draft of the L&F you want using tables with the graphics and everything using tables with the graphics and everything leaving space for the NAVBAR on the left.leaving space for the NAVBAR on the left.

Page 9: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Step 2 – Make include files for the Header, Step 2 – Make include files for the Header, Left column and Footer. Left column and Footer.

Step 3 - Plan other possibilities like Step 3 - Plan other possibilities like advertising include blocks - so you can make advertising include blocks - so you can make global changes to things like AdSense L&F.global changes to things like AdSense L&F.

Remember:• Have them all same width (800 pixels wide)

Page 10: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Step 4 - Finally make a template using all Step 4 - Finally make a template using all these include files and use that as the these include files and use that as the starting point for all pages.starting point for all pages.

<HTML><HEAD>...</HEAD><BODY ...>

***4x4-header.shtml***

<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" width=“800" bgcolor="#FFFFFF"><tr><TD valign="top" bgcolor="#FFFFFF" width="180">***left-column.shtml***...</TABLE>

***4x4-footer.shtml***

</BODY>

Page 11: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

HTML ResourcesHTML Resources

• www.htmlgoodies.comwww.htmlgoodies.com

• www.htmlhelp.comwww.htmlhelp.com

• Bulletproof Web Design – Dan Bulletproof Web Design – Dan CederholmCederholm

• Creating COOL WEB SITES – Dave Creating COOL WEB SITES – Dave TaylorTaylor

Page 12: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

JavaScript MagicJavaScript Magic

• Keep it simple!Keep it simple!

• Learn only what you NEEDLearn only what you NEED

• Make sure it works...Make sure it works...

• Test, test & testTest, test & test

Page 13: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Bookmark this SiteBookmark this Site

<a href="javascript:window.external.AddFavorite('http://www.4x4offroads.com', '4x4OffRoads.com')" style="text-decoration: underline; color: rgb(0, 0, 255);"> Bookmark this Site</a>

• Inline JavaScriptInline JavaScript

• Always good to have people Always good to have people bookmark your sitebookmark your site

Page 14: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

A-B Split Testing AdSenseA-B Split Testing AdSense

• A simple method to test AdSense A simple method to test AdSense performanceperformance

• Test color and ad formats for Test color and ad formats for performanceperformance

<script type="text/javascript"><!--google_ad_client = " pub-xxxxxxxxxxxxxxxxxxx ";//200x200, ATF created 12/23/07google_ad_slot = "5192878482";google_ad_width = 200;google_ad_height = 200;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

Page 15: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

<script type="text/javascript">var random_number = Math.random();if (random_number < .5){google_ad_client = "pub-xxxxxxxxxxxxxxxxxxx";//200x200, ATF created 12/23/07google_ad_slot = "5192878482";google_ad_width = 200;google_ad_height = 200;//-->} else {google_ad_client = " pub-xxxxxxxxxxxxxxxxxxx";//200x200, ATF B created 12/23/07google_ad_slot = "3181910664";google_ad_width = 200;google_ad_height = 200;//-->}</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

Page 16: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Random PictureRandom Picture

• Use for Rolling Ads, Decoration and Use for Rolling Ads, Decoration and moremore

• Begin by uploading the picsBegin by uploading the pics– Create a bunch of picturesCreate a bunch of pictures– Name them something like “keyword-Name them something like “keyword-

1.jpg”, “keyword-2.jpg” ... “keyword-1.jpg”, “keyword-2.jpg” ... “keyword-100.jpg”100.jpg”

– Make a page graphics.html with all the pics Make a page graphics.html with all the pics and upload it and the pictures and upload it and the pictures

Page 17: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

<SCRIPT language="JavaScript"> <!--

pic_width=60; /*change to match the height of all your images */pic_height=48; /* change to match the width of all your images */border_size=0; /* change to the border size you want on the images */alignment=1; /* 0=left,1=center */webpath="http://www.4x4offroads.com/image-files/keyword-"

if (alignment==1) { cent_it="<CENTER>"; cent_it2="<\/CENTER>"; }else { cent_it=""; cent_it2=""; }

Page 18: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

function get_random(maxNum){ if (Math.random && Math.round) { var ranNum= Math.round(Math.random()*(maxNum-1)); ranNum+=1; return ranNum; } else { today= new Date(); hours= today.getHours(); mins= today.getMinutes(); secn= today.getSeconds(); if (hours==19) hours=18; var ranNum= (((hours+1)*(mins+1)*secn)%maxNum)+1; return ranNum; }}

Page 19: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

function get_Image(){ if (document.images) { var choose_one= get_random(106);

pics = webpath + choose_one + ".jpg"; document.write(cent_it+"<IMG SRC='"+pics+"' alt='4x4' width='"+pic_width+"' border='"+border_size+"'>"+cent_it2); }}

</script>

Page 20: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Use The PictureUse The Picture

• Place this code wherever you want...Place this code wherever you want...

<SCRIPT language="JavaScript"><!--

get_Image()//--></SCRIPT>

Page 21: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

BONUS: CSS Menu StructureBONUS: CSS Menu Structure

<style type="text/css"><style type="text/css">

@import url("support-files/digital-@import url("support-files/digital-photo-web.css");photo-web.css");

</style></style>

Page 22: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

<div id="navcontainer"> <b><ul id="navlist">

<li><a href="index.html">Home</a></li><li><a href="pro-photo.html">Pro Photo</a></li><li><a href="photo-journals.html">Photo

Journals</a></li><li><a href="best-web-hosting.html">Best Web

Hosting</a></li><li><a href="digital-cameras.html">Digital

Cameras</a></li>...

</ul></b></div>

Page 23: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

#navcontainer{background: #D0E0FF;width: 150px;margin: 0 auto;padding: 0em 0;font-family: Verdana, Arial, Eyechart, Geneva, Helvetica, sans-serif;font-size: 12px;text-align: center;}

ul#navlist{text-align: center;font-size: 12px;list-style: none;padding: 0;margin: 0;width: 140px;}

Page 24: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

ul#navlist li{display: block;margin: 0 auto;padding: 0;}

ul#navlist li a{display: block;width: 100%;padding: 0.5em 0 0.5em 0.5em;border-width: 1px;border-color: #ffe #aaab9c #ccc #fff;border-style: solid;color: #ffffff;text-decoration: none;background: #000080;}

Page 25: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

#navcontainer>ul#navlist li a { width: auto; }

ul#navlist li#active a{background: #D0E0FF;color: #FFFF00;}

ul#navlist li a:hover, ul#navlist li#active a:hover{color: #000080;background: transparent;border-color: #aaab9c #fff #fff #ccc;}

Page 26: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

JavaScript ResourcesJavaScript Resources

• www.javascript.comwww.javascript.com//• http://javascript.internet.com/http://javascript.internet.com/• www.js-x.com/www.js-x.com/

• Search Google!Search Google!

• http://sbi-help.easy-online-money.nethttp://sbi-help.easy-online-money.net//

• Professional JavaScript for Web Developers – Professional JavaScript for Web Developers – Nicholas C. Zakas - WroxNicholas C. Zakas - Wrox

Page 27: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

Thanks!Thanks!

Page 28: HTML for Beginners & JavaScript Magic - Step By Step - Thrandur Arnthorsson thrandur.net.

My Definition Of Success:My Definition Of Success:

• I have enough hands off income to pay all I have enough hands off income to pay all expensesexpenses

• I live in a house I ownI live in a house I own• I continue to grow in knowledge and wisdom and I continue to grow in knowledge and wisdom and

help my family do the samehelp my family do the same• I make mistakes and use them to change courseI make mistakes and use them to change course• I keep fit and healthyI keep fit and healthy• I add value to the worldI add value to the world• I control my own time and can choose to sleep late I control my own time and can choose to sleep late

whenever I likewhenever I like• I meet interesting people and learn more from I meet interesting people and learn more from

each oneeach one• I outsource things that starts to look like workI outsource things that starts to look like work• I collect experience and share by writing and I collect experience and share by writing and

publishingpublishing