Z
zhengyan11
my job is to check the cookie and then decide if I show a image link
on the page when the page is loaded.
this is what I did:
<html>
<head>
<TITLE>THIS IS TEST </TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
function buttonLoad()
{
if(isTargetPerson == true)
{
var button = document.getElementById("my_button");
button.attachEvent("onClick", markVisit);
}
else
document.getElementById("my_button").style="visibility:hidden";
}
function isTargetPerson()
{
if (document.documentElement && (typeof
document.documentElement.style.maxHeight!="undefined" )&&
window.XMLHttpRequest && document.epando && isNewbie() )
return true;
else
return false;
}
function isNewbie()
{
if(document.cookie != "")
{
thisCookie = document.cookie.split("; ")
for(i = 0; i< thisCookies.length; i++)
{
if ((thisCookie.split("=")[0] == "newbie") &&
(thisCookie.split("=")[1] == "false"))
{
document.write("Yan= " + thisCookie.split("=")[0] +
"Yan1= " + thisCookie.split("=")[1]);
return false
}
}
return true;
}
else
return true;
}
function markVisit()
{
var expDate = new Date;
expDate.setMonth(expireDate.getMonth()+6);
document.cookie = "newbie=false;expires="+expDate.toGMTString()+";";
}
</SCRIPT>
</head>
<BODY>
<div id="search">
<INPUT TYPE="image" id="my_button" src="sp_ie7.gif" VALUE="Add
Search Provider" onClick='somefunction;'>
</div>
</BODY>
</html>
but everytime I got the image on the page. I have checked
isTargetPerson() function and it returns false. so that means
document.getElementById("my_button").style="visibility:hidden"; did
not do its job.
Anyone could please give me some hints!
on the page when the page is loaded.
this is what I did:
<html>
<head>
<TITLE>THIS IS TEST </TITLE>
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
function buttonLoad()
{
if(isTargetPerson == true)
{
var button = document.getElementById("my_button");
button.attachEvent("onClick", markVisit);
}
else
document.getElementById("my_button").style="visibility:hidden";
}
function isTargetPerson()
{
if (document.documentElement && (typeof
document.documentElement.style.maxHeight!="undefined" )&&
window.XMLHttpRequest && document.epando && isNewbie() )
return true;
else
return false;
}
function isNewbie()
{
if(document.cookie != "")
{
thisCookie = document.cookie.split("; ")
for(i = 0; i< thisCookies.length; i++)
{
if ((thisCookie.split("=")[0] == "newbie") &&
(thisCookie.split("=")[1] == "false"))
{
document.write("Yan= " + thisCookie.split("=")[0] +
"Yan1= " + thisCookie.split("=")[1]);
return false
}
}
return true;
}
else
return true;
}
function markVisit()
{
var expDate = new Date;
expDate.setMonth(expireDate.getMonth()+6);
document.cookie = "newbie=false;expires="+expDate.toGMTString()+";";
}
</SCRIPT>
</head>
<BODY>
<div id="search">
<INPUT TYPE="image" id="my_button" src="sp_ie7.gif" VALUE="Add
Search Provider" onClick='somefunction;'>
</div>
</BODY>
</html>
but everytime I got the image on the page. I have checked
isTargetPerson() function and it returns false. so that means
document.getElementById("my_button").style="visibility:hidden"; did
not do its job.
Anyone could please give me some hints!