SlideShare uma empresa Scribd logo
1 de 11
Andrew Chalkley UI Developer
The Proper Way CSS Ye Olde Way Tables Obtrusive
CSS evangelists told us that there should be a separation  of layout from markup. JavaScript evangelists tell us today that there should be the separation of behavior from markup.
Bad <a href=“javascript:window.open(‘somepage.html’)”>Some Page</a> <a href=“#” onclick=“window.open(‘somepage.html’); return false;”>Some Page</a> Better <a href=“somepage.html” onclick=“window.open(‘somepage.html’); return false;”>...</a> Best <a href=“somepage.html” class=“new_window”>Some Page</a>
JavaScript Implementation window.onload = function() { } var anchors = document.getElementsByTagName(‘a’); 	for (vari = 0, anchor;  i <  anchors.length; i++) { 	} 		if (anchor.className ==  “new_window”) { anchor.onclick = function() { varhref = this.href; window.open(href); 				return false; 			} 		}
But wait… ,[object Object]
 it overrides any existing load or click handlers
 cannot handle class=“new_windowexternal_link”
 it leaks memory in IE6The Answer…
[object Object]
 Cross-browser support

Mais conteúdo relacionado

Mais procurados

The next step is... Bootstrap by Omar Qunsul
The next step is... Bootstrap by Omar QunsulThe next step is... Bootstrap by Omar Qunsul
The next step is... Bootstrap by Omar QunsulRails Girls MUC
 
From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutesedill3484
 
Building high-fidelity interactive prototypes with jQuery
Building high-fidelity interactive prototypes with jQueryBuilding high-fidelity interactive prototypes with jQuery
Building high-fidelity interactive prototypes with jQueryDavid Park
 
Burroughs_Tabitha_IgnitePresentationSlides
Burroughs_Tabitha_IgnitePresentationSlidesBurroughs_Tabitha_IgnitePresentationSlides
Burroughs_Tabitha_IgnitePresentationSlidestabithaburroughs
 
Standards.Next: Canvas
Standards.Next: CanvasStandards.Next: Canvas
Standards.Next: CanvasMartin Kliehm
 
Build an App with JavaScript and jQuery - LA - July 18 Pasadena
Build an App with JavaScript and jQuery - LA - July 18 PasadenaBuild an App with JavaScript and jQuery - LA - July 18 Pasadena
Build an App with JavaScript and jQuery - LA - July 18 PasadenaThinkful
 

Mais procurados (8)

The next step is... Bootstrap by Omar Qunsul
The next step is... Bootstrap by Omar QunsulThe next step is... Bootstrap by Omar Qunsul
The next step is... Bootstrap by Omar Qunsul
 
From jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 MinutesFrom jQuery to App Store in 30 Minutes
From jQuery to App Store in 30 Minutes
 
Web performance101
Web performance101Web performance101
Web performance101
 
Building high-fidelity interactive prototypes with jQuery
Building high-fidelity interactive prototypes with jQueryBuilding high-fidelity interactive prototypes with jQuery
Building high-fidelity interactive prototypes with jQuery
 
MGT- CLUB
MGT- CLUB MGT- CLUB
MGT- CLUB
 
Burroughs_Tabitha_IgnitePresentationSlides
Burroughs_Tabitha_IgnitePresentationSlidesBurroughs_Tabitha_IgnitePresentationSlides
Burroughs_Tabitha_IgnitePresentationSlides
 
Standards.Next: Canvas
Standards.Next: CanvasStandards.Next: Canvas
Standards.Next: Canvas
 
Build an App with JavaScript and jQuery - LA - July 18 Pasadena
Build an App with JavaScript and jQuery - LA - July 18 PasadenaBuild an App with JavaScript and jQuery - LA - July 18 Pasadena
Build an App with JavaScript and jQuery - LA - July 18 Pasadena
 

Destaque

千呼萬喚始出來的Java SE 7
千呼萬喚始出來的Java SE 7千呼萬喚始出來的Java SE 7
千呼萬喚始出來的Java SE 7javatwo2011
 
Pimp your site with jQuery!
Pimp your site with jQuery!Pimp your site with jQuery!
Pimp your site with jQuery!Elliott Kember
 
使用Hudson打造屬於你自己的軟體建構機器人
使用Hudson打造屬於你自己的軟體建構機器人使用Hudson打造屬於你自己的軟體建構機器人
使用Hudson打造屬於你自己的軟體建構機器人javatwo2011
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Twiggy - let's get our widget on!
Twiggy - let's get our widget on!Twiggy - let's get our widget on!
Twiggy - let's get our widget on!Elliott Kember
 
What's Next in Growth? 2016
What's Next in Growth? 2016What's Next in Growth? 2016
What's Next in Growth? 2016Andrew Chen
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your BusinessBarry Feldman
 

Destaque (7)

千呼萬喚始出來的Java SE 7
千呼萬喚始出來的Java SE 7千呼萬喚始出來的Java SE 7
千呼萬喚始出來的Java SE 7
 
Pimp your site with jQuery!
Pimp your site with jQuery!Pimp your site with jQuery!
Pimp your site with jQuery!
 
使用Hudson打造屬於你自己的軟體建構機器人
使用Hudson打造屬於你自己的軟體建構機器人使用Hudson打造屬於你自己的軟體建構機器人
使用Hudson打造屬於你自己的軟體建構機器人
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Twiggy - let's get our widget on!
Twiggy - let's get our widget on!Twiggy - let's get our widget on!
Twiggy - let's get our widget on!
 
What's Next in Growth? 2016
What's Next in Growth? 2016What's Next in Growth? 2016
What's Next in Growth? 2016
 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
 

Semelhante a jQuery SUG Group Introduction

Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax componentsIgnacio Coloma
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009Ralph Whitbeck
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone InteractivityEric Steele
 
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]Chris Toohey
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesLincoln III
 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint DevZeddy Iskandar
 
Google Analytics: Measuring for results, a practical guide
Google Analytics: Measuring for results, a practical guideGoogle Analytics: Measuring for results, a practical guide
Google Analytics: Measuring for results, a practical guideMatter Solutions
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet ApplicationsSubramanyan Murali
 
J Query Presentation
J Query PresentationJ Query Presentation
J Query PresentationVishal Kumar
 
Discovery Education streaming and Google Earth
Discovery Education streaming and Google EarthDiscovery Education streaming and Google Earth
Discovery Education streaming and Google EarthMike Bryant
 
Wai Aria - An Intro
Wai Aria - An IntroWai Aria - An Intro
Wai Aria - An IntroMatt Machell
 
Scti 2011 minicurso jquery
Scti 2011 minicurso jqueryScti 2011 minicurso jquery
Scti 2011 minicurso jqueryciberglo
 

Semelhante a jQuery SUG Group Introduction (20)

Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
10 Things You're Not Doing [IBM Lotus Notes Domino Application Development]
 
Html5
Html5Html5
Html5
 
GWT
GWTGWT
GWT
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
 
jQuery for Sharepoint Dev
jQuery for Sharepoint DevjQuery for Sharepoint Dev
jQuery for Sharepoint Dev
 
Google Analytics: Measuring for results, a practical guide
Google Analytics: Measuring for results, a practical guideGoogle Analytics: Measuring for results, a practical guide
Google Analytics: Measuring for results, a practical guide
 
Basics of Rich Internet Applications
Basics of Rich Internet ApplicationsBasics of Rich Internet Applications
Basics of Rich Internet Applications
 
J Query Presentation
J Query PresentationJ Query Presentation
J Query Presentation
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
 
Discovery Education streaming and Google Earth
Discovery Education streaming and Google EarthDiscovery Education streaming and Google Earth
Discovery Education streaming and Google Earth
 
Front End on Rails
Front End on RailsFront End on Rails
Front End on Rails
 
Ajax
AjaxAjax
Ajax
 
Jquery 1
Jquery 1Jquery 1
Jquery 1
 
Wai Aria - An Intro
Wai Aria - An IntroWai Aria - An Intro
Wai Aria - An Intro
 
Mobile web with jQuery Mobile
Mobile web with jQuery MobileMobile web with jQuery Mobile
Mobile web with jQuery Mobile
 
Scti 2011 minicurso jquery
Scti 2011 minicurso jqueryScti 2011 minicurso jquery
Scti 2011 minicurso jquery
 

Mais de Andrew Chalkley

Best Practices for Testing Open Source Projects
Best Practices for Testing Open Source ProjectsBest Practices for Testing Open Source Projects
Best Practices for Testing Open Source ProjectsAndrew Chalkley
 
Hardware Hacking for Thrify, Modern JavaScript Developers
Hardware Hacking for Thrify, Modern JavaScript DevelopersHardware Hacking for Thrify, Modern JavaScript Developers
Hardware Hacking for Thrify, Modern JavaScript DevelopersAndrew Chalkley
 
What I've Learned Developing for iOS
What I've Learned Developing for iOSWhat I've Learned Developing for iOS
What I've Learned Developing for iOSAndrew Chalkley
 
Building iPhone/Andriod Apps with Titanium Appcelerator for a Rails Backend
Building iPhone/Andriod Apps with Titanium Appcelerator for a Rails BackendBuilding iPhone/Andriod Apps with Titanium Appcelerator for a Rails Backend
Building iPhone/Andriod Apps with Titanium Appcelerator for a Rails BackendAndrew Chalkley
 

Mais de Andrew Chalkley (6)

Best Practices for Testing Open Source Projects
Best Practices for Testing Open Source ProjectsBest Practices for Testing Open Source Projects
Best Practices for Testing Open Source Projects
 
Hardware Hacking for Thrify, Modern JavaScript Developers
Hardware Hacking for Thrify, Modern JavaScript DevelopersHardware Hacking for Thrify, Modern JavaScript Developers
Hardware Hacking for Thrify, Modern JavaScript Developers
 
What I've Learned Developing for iOS
What I've Learned Developing for iOSWhat I've Learned Developing for iOS
What I've Learned Developing for iOS
 
Ruby On Rails Ecosystem
Ruby On Rails EcosystemRuby On Rails Ecosystem
Ruby On Rails Ecosystem
 
Building iPhone/Andriod Apps with Titanium Appcelerator for a Rails Backend
Building iPhone/Andriod Apps with Titanium Appcelerator for a Rails BackendBuilding iPhone/Andriod Apps with Titanium Appcelerator for a Rails Backend
Building iPhone/Andriod Apps with Titanium Appcelerator for a Rails Backend
 
Spring Integration
Spring IntegrationSpring Integration
Spring Integration
 

Último

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 

Último (20)

DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

jQuery SUG Group Introduction

  • 1. Andrew Chalkley UI Developer
  • 2. The Proper Way CSS Ye Olde Way Tables Obtrusive
  • 3. CSS evangelists told us that there should be a separation of layout from markup. JavaScript evangelists tell us today that there should be the separation of behavior from markup.
  • 4. Bad <a href=“javascript:window.open(‘somepage.html’)”>Some Page</a> <a href=“#” onclick=“window.open(‘somepage.html’); return false;”>Some Page</a> Better <a href=“somepage.html” onclick=“window.open(‘somepage.html’); return false;”>...</a> Best <a href=“somepage.html” class=“new_window”>Some Page</a>
  • 5. JavaScript Implementation window.onload = function() { } var anchors = document.getElementsByTagName(‘a’); for (vari = 0, anchor; i < anchors.length; i++) { } if (anchor.className == “new_window”) { anchor.onclick = function() { varhref = this.href; window.open(href); return false; } }
  • 6.
  • 7. it overrides any existing load or click handlers
  • 8. cannot handle class=“new_windowexternal_link”
  • 9. it leaks memory in IE6The Answer…
  • 10.
  • 12. Compatibility mode (DWR, Prototype, etc)
  • 13. Executes when DOM is ready (before images have loaded)
  • 14.
  • 15. window.onload = function() { } var anchors = document.getElementsByTagName(‘a’); for (vari = 0, anchor; i < anchors.length; i++) { } if (anchor.className == “new_window”) { anchor.onclick = function() { varhref = this.href; window.open(href); return false; } }
  • 16. $(function() { }); $(“a.new_window”).click(function() { }); window.open( $(this).attr(“href”) ); return false;
  • 17. DEMO