Cascading Style Sheets Tutorial

Links (HREF elements), click method

  Keyword: javascript, href, click, the method 

  For HTML pages on the hyperlinks (HREF), not all browsers support its click method. 

  In the IE browser (version 4.0 and above), we can use the method to simulate a click hyperlinks click operation.    For example: 

  Document.links [someLinkIndex]. Click (); 

  First click method trigger elements onclick events; return true if onclick events will continue to open the hyperlink pointing URL. 

  But in other browsers (such as NS, firefox, etc.), does not provide such a method.    But you can be the adoption of the following javascript code for the browser has also increased click on the methods of support: 

  <SCRIPT LANGUAGE="JavaScript1.2"> 
  Function linkClick () ( 
  Var executeAction = true; 
  If (this.onclick) ( 
  This.onclick executeAction = ((type: 'click')); 
  ) 
  If (executeAction) 
  Open (this.href, this.target? This.target: '_self'); 
  ) 
  Function initLinkClick () ( 
  If (document.layers & document.links.length> 0) 
  Document.links [0]. Constructor.prototype.click = linkClick; 
  ) </ SCRIPT> 
  </ HEAD> 
  <BODY ONLOAD="initLinkClick();"> 

  By the time the links onload elements loaded prototype, you can achieve pages in IE / NS compatible click: 

  <A HREF= http://www.webjx.com/ ONCLICK="alert(event.type); return true;"> 
  Link1 </ A> 
  | <A HREF= http://www.webjx.com/ TARGET="_blank"> 
  Link2 </ A> 
  | <A HREF = "http://www.webjx.com" ONCLICK = "alert (event.type); return 
  False "> 
  Link3 </ A> 
|
  <BR> <FORM> <INPUT TYPE = "button" VALUE = "link1 click" 
  ONCLICK = "document.links [0]. Click ();">< INPUT TYPE =" button "VALUE =" link2 click " 
  ONCLICK = "document.links [1]. Click ();">< INPUT TYPE =" button "VALUE =" link3 click " 
  ONCLICK = "document.links [2]. Click ();"></ FORM> 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • DZone

Tags: xhtml elements xhtml source

Releated Posts

  • How to improve the existing site structure for xhtml + CSS
  • Hong Sing to launch a fusion Web2.0 elements Discuz! 5.0
  • Two minutes to be a xhtml + css the Home
  • CSS closed floating elements introduced norms
  • Using XHTML and CSS design reusability can rejuvenate website

This entry was posted on Monday, April 30th, 2007 at 12:00 am and is filed under Xhtml and Web Design. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« How prepared DHTML Web
Summary page document contains »

Leave a Reply

  • Categories

    • CSS Properties (491)
    • CSS Tutorial (1154)
    • CSS Tutorial By Examples (1201)
    • Css+Div Web Design (3274)
    • Xhtml and Web Design (1797)
  • Archives

    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
  • Pages

    • About us

Cascading Style Sheets Tutorial