Solved

need some html/java code.

Posted on 1998-06-16
13
139 Views
Last Modified: 2010-04-09
I need sponsor to support my expense but no one willing to click the sponsor at all.  One time I saw a guy's homepage what he can do is make the people click all his sponsors before letting the people get in his page(his enter button will not enable unless all sponsor got clicked).  So I think it's a good idea to do that on my page to generate some click for my sponsor.
please email the code/example to funnyweb@hotmail.com if possible thanks.
0
Comment
Question by:pcchiu
  • 6
  • 6
13 Comments
 
LVL 3

Accepted Solution

by:
bigelos earned 120 total points
ID: 1844211
OK,

I'll show you how using JavaScript.  You can also use cookies, but MSIE doesn't do cookies too well.
0
 
LVL 9

Author Comment

by:pcchiu
ID: 1844212
ok, you'll show me how to use it? but where and when and how I should get it?
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1844213
OK,

Here is the code.  You can easily add more banners.  Just pass a higher number.  Of course, then you would have to change the (total > 2) to whatever it needs to be.  (You have to do a little math here.)

Hope it works for you.

<html>

<head>
<title>Homepage</title>

<script language="JavaScript">
var total=0;
function clicked(){
    total++;
}

function AllClicked() {
    // Change the total coresponding to 1 less than the total passed.  So, if only two banners, use 1
    // For 4, use 3, etc
    if (total > 2) {
         window.location="your_real_homepage";
    }
    else {
       alert('Please visit my sponsors first');
    }
}

</script>

</head>

<body>

<Center>
<a href="your_sponsors_address" target="_blank" onClick="clicked()"><img src="your_banner.jpg"></a>
<P>
<a href="your_other_sponsors_address" target="_blank" onClick="clicked()"><img src="your_other_banner.jpg"></a>
<P>
<a href="your_third_sponsors_address" target="_blank" onClick="clicked()"><img src="your_third_banner.jpg"></a>
<p>
<a href="JavaScript:AllClicked()" target="_top" >Enter</a>
</center>
</body>
</html>

0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 9

Author Comment

by:pcchiu
ID: 1844214
I tried the code and I only have 1 sponsor for now so I changed the number to (total > 0).  and only subtitute (one href up) before the javascript:allclciked().  But after I setup the page on the web and test it.  It keep asking to click the sponsor even I clicked the sponsor 10 times and 10 new window was opened...  What's going on?  am I miss something?  You code is easy to follow and seems work great if I can solve that problem.
0
 
LVL 9

Author Comment

by:pcchiu
ID: 1844215
It works great now thanks alot.
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1844216
pcchiu,

No problem.  Glad you got it figured out.  Now you just need to come back and grade the answer...
0
 
LVL 9

Author Comment

by:pcchiu
ID: 1844217
One more thing, If the java code show on my page there's no point to use it since all browers can view the source by one click... Is there anyway to hide the java code?  For that I give out 20 more points...
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1844218
Nope, sorry, can't hide your java code.  I can write you a Perl cgi script if you are able to run scripts on your site.
0
 
LVL 9

Author Comment

by:pcchiu
ID: 1844219
ok, my site can't run the scripts...
0
 
LVL 3

Expert Comment

by:bigelos
ID: 1844220
One thing you can do (since you only have 1 sponsor) is force all your users to open the link to your sponsor.  You can get rid of all the other javascript and just use this:

<a href="your_web_page" target="_blank" onClick="window.location='your_sponsors_web_page'">Enter Here!</a>

What this does is open your web page in a new window, and opens your sponsors web page in the window underneath it.  That way (especially if your sponsor counts the number of hits originating from your site) they will always visit your sponsor, but they won't see the page until they exit from your site.  If you want it the other way around, just swap your_page and your_sponsors_page around.


0
 
LVL 3

Expert Comment

by:bigelos
ID: 1844221
Having not tested the code above, the following might work better:
<a href="your_web_page" target="_blank" OnClick="window.location='your_sponsors_web_page'; return true;">Enter Here!</a>

Or even better yet,
<a href="your_web_page" target="_blank" OnClick="JavaScript:window.location='your_sponsors_web_page'; return true;">Enter Here!</a>

0
 
LVL 9

Author Comment

by:pcchiu
ID: 1844222
Thanks alot i'll try the new code soon.
0
 

Expert Comment

by:Eliza4321
ID: 1844223
Ok you say you need money like a paying banner  I am asking the same question I already have one paying banner and it is from cyber thrill here is the address and it pays 20 cents per click http://www.CyberThrill.com then once you have gotten there go to WebMasters Click for $$$ and then go to banners and you will know what to do from there on!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question