JavaScript implementation Click Ads to display the download address or other content

Source: Internet
Author: User
Tags tagname

One of the usual ways that webmasters used to let the user click on the ads to see the real content, the most use is to click on ads after the display download address, this function is very helpful to advertising revenue, but lost the user experience, as far as possible or not to use the frequency, the code sent up, It's mainly for learning JavaScript.

The code is as follows Copy Code

<base target= "_blank" onclick= "javascript:will ()"/>
<script language= "JavaScript" type= "Text/javascript" >
function would () {
if (event.srcelement.tagname== ' A ' | | event.srcelement.tagname== ' IMG ') {
Window.focus ();
OUrl.style.display = "";
YAd.style.display = "None";
Document.cookie= ' Goodfont=yes ';
}
}
function Get_cookie (Name) {
var search = Name + "="
var returnvalue = "";
if (Document.cookie.length > 0) {
offset = document.cookie.indexOf (search)
if (offset!=-1) {
Offset + = Search.length
End = Document.cookie.indexOf (";", offset);
if (end = = 1)
end = Document.cookie.length;
Returnvalue=unescape (document.cookie.substring (offset, end))
}
}
Return returnvalue;
}
</script>
<!--This is the ad code-->
<div id= "YAd" >
<a href= ' # ' target=_blank> dot this ad, show download address </a>
</div>
<!--here is the real download address-->
<div id= "Ourl" style= "display: ' None '" >
<script language= "JavaScript" >function Jydownh (htmlurl) {var newwin=window.open (htmlurl, ', ' Toolbar=no, Location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no '); return false;}
</script>
<a href= '/down/test.rar ' target=_blank> real download address </A>
</div>


Note: The above code eliminates the

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.