The project encountered a headache. The setting of <A> Disabled = "disabled" in Firefox is invalid. What should we do? We can only turn to powerful Js.
The idea is as follows:
To invalidate <A>, you must consider the following aspects: 1. block default behavior ---- hyperlink; 2. stop its mouse events. The Code uses onclick as an example. jquery is also used in the Code. Who calls it so easy to use.
<% @ Page Language = "Java" contenttype = "text/html; charset = UTF-8" <br/> pageencoding = "UTF-8" %> <br/> <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <br/> <HTML> <br/> <pead> <br/> <meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8 "> <br/> <title> insert title here </title> <br/> <MCE: script Type = "text/JavaScript" src = "JS/jquery. JS "mce_src =" JS/jquery. JS "> </MCE: SCRIPT> <br/> </pead> <br/> <MCE: Script Type =" text/JavaScript "> <! -- <Br/> $ (function () {<br/> $ ("A [disabled]"). addclass ("Disable"); // Add a new class. Note that the original class of the label is not overwritten. <br/>}); <br/> function clickevent (oevent) {<br/> var oevent = oevent? Oevent: window. event; <br/> oevent. preventdefault (); // prevents hyperlinks <br/> var tar; <br/> If (navigator. appname = "Microsoft Internet Explorer") {<br/> tar = oevent. srcelement; <br/>}else {<br/> tarw.oevent.tar get; <br/>}< br/> If (TAR. getattribute ("disabled") {<br/> return false; // stop click events <br/>}< br/> alert ("Who says I'm useless !? "); <Br/>}; <br/> function clickevent1 (oevent) {<br/> alert (" Who says I'm useless !? "); <Br/>}; <br/> // --> </MCE: SCRIPT> <br/> <MCE: style> <! -- <Br/>. disable {<br/> color: Gray; // simulated disabled with Gray effect <br/>}< br/> --> </MCE: style> <style mce_bogus = "1">. disable {<br/> color: Gray; // simulate disabled to gray <br/>}</style> <br/> <body> <br/> <p> <a href = "http://baidu.com" mce_href =" http://baidu.com "Disabled =" disabled "Title =" this is the default prompt 1. "onclick =" clickevent1 (event ); "> I should be useless </a> </P> <br/> <p> <a href =" http://baidu.com "mce_href =" http://baidu.com "Disabled =" disabled "title = "this is the default prompt 1. "onclick =" clickevent (event); "> I am useless now </a> </P> <br/> </body> <br/> </ptml>
How about it? Try it! Ga ~