Solved

Run OnClick command by a url Appened Javascript

Posted on 2012-04-11
2
158 Views
Last Modified: 2013-01-02
Hello Experts,

 I have a page wihich containing the following command

<div class="infopopup-vote-button" onclick="voteTo(194)";"> Vote </div>

How do I append to the url a javascript command to click on the button automaticly when the url is executed

Thanks
0
Comment
Question by:madmare
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 37833147
add a parameter in your url like that :

http://www.yourdomain.com/yourpage.html?voteid=194

add this in the head section of yourpage.html :

<script type="text/javascript">
window.onload = function() {
      vote(   gup("voteid")    );
}

function gup( name ) // http://www.netlobo.com/url_query_string_javascript.html
{
  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];
}
</script>

Open in new window

0
 

Author Comment

by:madmare
ID: 37833485
The yourpage.html is a website not belong to me


I cannot add any code to it
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now