• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

JavaScript Auto-Submit

Thingula

How do you change this text?
315
Posts
14
Years
  • Seen Jun 19, 2014
I'm trying to add a small query to the end of the url: "http://www.easypolls.net/poll.html?p=4ec955922634b0e4414d107e" to automatically check and submit "Option 5" (value="4").

I've tried editing the source html, but I know that's only local, and that I would need to upload an edited page to a host for others to see the changes.

When I do that, however, I lose references to the root of the website, "www.easypolls.net".

Here's what I came up with after editing the source:
Code:
<html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="CACHE-CONTROL" content="NO-CACHE"> <meta http-equiv="PRAGMA" content="NO-CACHE"> <title>Poll - EasyPolls.net</title> <script type="text/javascript">var jQueryTags="%3Cscript type='text/javascript' src='http"+(location.protocol==='https:'?'s':'')+"://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js\'>%3C/script%3E"+"%3Cscript type='text/javascript' src='http"+(location.protocol==='https:'?'s':'')+"://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js\'>%3C/script%3E";document.write(unescape(jQueryTags));</script><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script> <link rel="image_src" href="ext/images/poll.png"> <script type="text/javascript">var $opj=window.jQuery;function ZOPP(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)return "";else return results[1];};$(function(){var OPP_BASEURL=window.location.href;var OPP_pollId=ZOPP("p");OPP_BASEURL=OPP_BASEURL.substring(0,OPP_BASEURL.indexOf(".html"))+"?jsoncallback=?";var params={command:"getPoll",pollId:OPP_pollId};$.getJSON(OPP_BASEURL,params,function(data){if(data.resultCode=="0"){if(data.rtlEnabled)$("html").attr("dir","rtl");eval("data.style = "+data.styleString);$(".OPP-poll-content").attr("id","OPP-poll-id-"+data.pollId).data("OPP_BASEURL",OPP_BASEURL).pollOPP('init',{poll:data});}else{$(".OPP-poll-content").html("Poll is not available.");}});});</script> <script type="text/javascript" src="ext/scripts/poll.js"></script> </head> <body bgcolor="#9dc4e2">    <table width="100%"> <tbody><tr> <td align="center"> <div class="OPP-poll-content" id="OPP-poll-id-4ec955922634b0e4414d107e" style="width: 200px; "><div id="OPP-div-around-poll" class="OPP-div-around-poll" style="background-color: rgb(206, 231, 255); padding-left: 10px; padding-right: 10px; padding-top: 10px; padding-bottom: 10px; -webkit-box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px; box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px; border-top-left-radius: 10px 10px; border-top-right-radius: 10px 10px; border-bottom-right-radius: 10px 10px; border-bottom-left-radius: 10px 10px; "><div style="text-align: left; font-family: Arial; font-size: 10pt; font-style: normal; font-weight: normal; color: rgb(70, 109, 146); padding-bottom: 3px; " id="OPP-poll-question-text">Thanks for Voting</div><fieldset class="OPP-choices" style="border: 0px; padding: 0px; margin-top: 2px;"><div class="OPP-poll-choice-div" style="clear: both; font-family: Arial; font-size: 8pt; font-style: normal; font-weight: normal; color: rgb(70, 109, 146); padding-top: 4px; text-align: left; vertical-align: top; "><input id="c_4_4ec955922634b0e4414d107e" class="OPP-choice-button" type="radio" style="float: left; display: block; height: 8pt; margin-top: 2px; margin-right: 3px; margin-left: 0px; min-height: 12px; padding-top: 0px; " name="multResp4ec955922634b0e4414d107e" value="4" checked=""><label for="c_4_4ec955922634b0e4414d107e" class="OPP-poll-choice OPP-poll-choice-text" id="l_4_4ec955922634b0e4414d107e" style="text-align: left; cursor: pointer; position: relative; margin-left: 16px; margin-top: 2px; display: block; font-size: 8pt; ">Vote</label></div></fieldset><div id="OPP-poll-vote" style="vertical-align: middle; text-align: center; font-family: Arial; font-size: 8pt; font-style: normal; font-weight: normal; padding-top: 3px; " align="center"><span id="OPP-poll-vote-button-span"><button id="OPP-poll-vote-button" style="font-family: Arial; font-size: 10pt; font-style: normal; font-weight: normal; color: rgb(0, 0, 0); ">vote</button></span></div></div></div>  </td> </tr> </tbody></table>  </body></html>
You need to edit the html of the original page "http://www.easypolls.net/poll.html?p=4ec955922634b0e4414d107e" using your web browser to see it.
Clicking the vote button will vote for "Option 5"

How can I add a JavaScript query to the address to automatically vote for Option 5 when the original page loads, or edit the page to allow the submit button to work when hosted on a different server?

Thanks,
-Thingula
 
Back
Top