Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Restricting People to Vote

    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..
    Thankyou.

  • #2
    New Coder
    Join Date
    Jun 2004
    Location
    Coventry, UK
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Could you Clarify, and Heres What I Can Do

    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:

    onclick="redirect()"

    In the head copy and paste this:

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

    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.

    LOTS8
    Last edited by lordofthesword8; 07-07-2004 at 12:47 PM. Reason: Clarification

  • #3
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Thankyou.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Since you don't have access (you can't modify it) to the voting site, there's nothing you can do about it.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •