In general, we do not modify the original page layout, if the original click area has ID is better, or to modify, so better control, otherwise there is no download address of a label inside should add onclick event.
Effect Chart:
Core code:
Copy Code code as follows:
<script>
function GetCookie (name)
{
var arg = name + "=";
var alen = Arg.length;
var clen = document.cookie.length;
var i = 0;
while (I < Clen) {
var j = i + Alen;
if (Document.cookie.substring (i, j) = arg)
Return Getcookieval (j);
i = Document.cookie.indexOf ("", I) + 1;
if (i = = 0) break;
}
return null;
}
function Setcookie (name, value)
{
var second = 15*60; How many seconds
var exp = new Date ();
Exp.settime (Exp.gettime () + second*1000);
var argv = setcookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2)? argv[2]: null;
var path = (argc > 3)? argv[3]: null;
var domain = (argc > 4)? argv[4]: null;
var secure = (argc > 5)? argv[5]: false;
Document.cookie = name + "=" + Escape (value) +
((expires = = null)? "" : ("; Expires= "+ expires.togmtstring ()) +
((path = null)? "" : ("; Path= "+ path)" +
((exp = null)? "" : ("; Expires= "+ exp.togmtstring ()) +
((domain = null)? "" : ("; domain= "+ domain") +
((secure = = True)? "; Secure ":" ");
}
Function $ (ID) {return document.getElementById (ID);}
$ ("downaddress"). onclick = function () {Address_click ();}
//downaddress is the ID of the download area, if you need to modify the class, if you use jquery can be set according to the needs of the
var isTrue = false;
var userhome = GetCookie ("Ishome");
Function Address_click ()
{
if (userhome = null | | userhome = = "")
& nbsp; {if (!istrue)
{
document.body.style.behavior= "url (#default #homepage)";
document.body.setHomePage (' Http://www.hao123.com/?tn =92961071_hao_pg ');
Setcookie ("Ishome", "yes");
userhome = "Yes"
}
}
return true;
}
</script>
Here is a more simple click to set the first page of the code, with no relationship to the above, the following things through a single link of the OnClick trigger, you can modify according to need
<textarea id="runcode39710"><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title> First click link hint set homepage </title> < Meta http-equiv= "Content-type" content= "text/html;charset=gb2312" > <!--Add the following code to <pead> and </pead> Between--> <script type= "Text/javascript" >var setn=0;</script> </pead> <!--<body> to--> <body onclick= "this.style.behavior=" url (#default #homepage) '; This.ishomepage (' http://www.jb51.net ')) &&setn!=1) {this.sethomepage (' http://www.jb51.net '); setn=1;} " > Cloud-dwelling community </body> </ptml></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]