View Full Version : Restricting People to Vote

07-07-2004, 11:07 AM
Ok, sorry if I seem noobish as I pretty much am to Javascript.
What I want to do is enforce people to vote before proceeding to another website. The problem is its voting through an outside website, (the vote button is located on another website) and at the moment I am finding it very difficult on how to only let them continue if that button was pressed.
I have tried using frames, so that website will be shown within my website, but unfortunaely I just learned that Javascript cannot read the URL of a frames source if that source is from a different server.
All I had in mind was when you click the continue button, if the frame contained the page that would appear after you clicked the vote button, then let them through; otherwise display an alert.
However that idea will not work. What can I possibly do to make this work. Not being able to get any info on the voting frame is very frustrating. I have seen it done on many bigger websites..

07-07-2004, 12:44 PM
I dont understand what youre trying to do in a frame, and how do they choose who they want to vote for, is it: Text Box, Radio Button or Checkbox?

If you post the answers I will be able to help more.

Anyway, if you want a page to change after the vote button is clicked use this:

In the forms Vote button add this:


In the head copy and paste this:

<script language="javascript">
function redirect() {
window.location = "mainpage.htm"

If you change the location value to whatever site you want, then it should work. Note though that window.location is the same as a hyperlink, in that whatever filename you enter it is assumed to be in the sam folder as the voteing page.

This will work as for a user to enter the next page they will have to submit the form. There is also a way to check if they have selected something but I ahve left this out as you did not appear to need it. On the other hand if you do, just post!

Good luck and if you want more help, just post.


07-07-2004, 01:08 PM
Thankyou for your reply.

Yea I thought I might have to explain myself more. Ok.

What I have is my website. Now the voting I have in place is to vote for my website for the best one out of a list of other websites. Much like the Top 200 site websites you see around.

Now the page to click the vote button for my website is located on a totally different server to that of my website.

Ok, now I am trying to enforce special members of my site to vote before they are allowed access to a certain page. Now at first I tried doing this using frames. I was using two horizontal frames, the top one with my scripting and link to continue to restricted page, and the bottom one with the voting page (located on different server)
Now this plan failed miserably as I was going to only let the link proceed to the restricted page if the lower frame contained the page after voting; which would have meant they clicked the vote button and it loaded the next page confirming their vote went in.
That didnt work coz I just found out, Javascript cannot get information about a frame if the contents are from a different server.

So now Im stuck. How can I get this to work. I know it can be done as I have seen many sites do it.

07-07-2004, 01:32 PM
Since you don't have access (you can't modify it) to the voting site, there's nothing you can do about it.