<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Simulate a button click via JavaScript</title>
	<atom:link href="http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/</link>
	<description>Random Snippets of Code and Ideas for any Web Developer</description>
	<lastBuildDate>Sat, 17 Jul 2010 11:08:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anders K</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-14137</link>
		<dc:creator>Anders K</dc:creator>
		<pubDate>Sat, 17 Jul 2010 11:08:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-14137</guid>
		<description>Thanks! When submit() (for some unknown reason...) didn&#039;t work, this is nice :)</description>
		<content:encoded><![CDATA[<p>Thanks! When submit() (for some unknown reason&#8230;) didn&#8217;t work, this is nice :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Use label as distant button in HTML &#8211; Community &#8211; travellin&#39; meets real life</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-13955</link>
		<dc:creator>Use label as distant button in HTML &#8211; Community &#8211; travellin&#39; meets real life</dc:creator>
		<pubDate>Mon, 05 Jul 2010 11:13:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-13955</guid>
		<description>[...] Usage of JavaScript, which may be turned off on some computers, plain HTML is faster by default, &#8230; [...]</description>
		<content:encoded><![CDATA[<p>[...] Usage of JavaScript, which may be turned off on some computers, plain HTML is faster by default, &#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gaurav</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-13915</link>
		<dc:creator>gaurav</dc:creator>
		<pubDate>Thu, 01 Jul 2010 13:30:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-13915</guid>
		<description>Thanks a lOt!</description>
		<content:encoded><![CDATA[<p>Thanks a lOt!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raihan</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-11883</link>
		<dc:creator>Raihan</dc:creator>
		<pubDate>Thu, 04 Mar 2010 10:05:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-11883</guid>
		<description>Great! Solved my problem. :)
Thank you man. You guys make life easier for us.</description>
		<content:encoded><![CDATA[<p>Great! Solved my problem. :)<br />
Thank you man. You guys make life easier for us.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: drei</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-11306</link>
		<dc:creator>drei</dc:creator>
		<pubDate>Tue, 09 Feb 2010 15:58:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-11306</guid>
		<description>I was looking for this exactly. Very helpful! Cheers!</description>
		<content:encoded><![CDATA[<p>I was looking for this exactly. Very helpful! Cheers!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sophie</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-10420</link>
		<dc:creator>Sophie</dc:creator>
		<pubDate>Thu, 14 Jan 2010 10:48:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-10420</guid>
		<description>Is that possible to send a parametter to the submit button ? I have a VB function in the code beheind and i had multiple button who are supposed to active the VB function but whith a parametter. How can i do that ?

Thanks for the exemple by the way :)
(and sorry for my english)</description>
		<content:encoded><![CDATA[<p>Is that possible to send a parametter to the submit button ? I have a VB function in the code beheind and i had multiple button who are supposed to active the VB function but whith a parametter. How can i do that ?</p>
<p>Thanks for the exemple by the way :)<br />
(and sorry for my english)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-8469</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Sat, 21 Nov 2009 02:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-8469</guid>
		<description>This is great and halfway to what I need. I actually want to simulate a button push when a certain key is pressed. 
What I have is a web page that shows video clips. I have  &quot;prev&quot; and &quot;next&quot; buttons. Sometimes the buttons are (intentionally) off the visible page. What I want to do is capture keys to simulate a button click. The button push actually results in the page being reloaded with the prev/next video clip. So I&#039;m not using checkboxes just a plain old key capture. The way it works is that once the page is loaded if I click anywhere on the page (document)it gives it focus and then when I click the appropriate key (P/N) it does what I would expect. However because it reloads the page I lose focus and so have to click on the page again. (Yeah probably bad design in the first place but it is what it is at this point.) So I tried to get around this by something like  or  but it doesn&#039;t seem to work. So my question is how do I set focus on the document itself after it loads? (Oh and this is a page within a frameset to boot. :-) )</description>
		<content:encoded><![CDATA[<p>This is great and halfway to what I need. I actually want to simulate a button push when a certain key is pressed.<br />
What I have is a web page that shows video clips. I have  &#8220;prev&#8221; and &#8220;next&#8221; buttons. Sometimes the buttons are (intentionally) off the visible page. What I want to do is capture keys to simulate a button click. The button push actually results in the page being reloaded with the prev/next video clip. So I&#8217;m not using checkboxes just a plain old key capture. The way it works is that once the page is loaded if I click anywhere on the page (document)it gives it focus and then when I click the appropriate key (P/N) it does what I would expect. However because it reloads the page I lose focus and so have to click on the page again. (Yeah probably bad design in the first place but it is what it is at this point.) So I tried to get around this by something like  or  but it doesn&#8217;t seem to work. So my question is how do I set focus on the document itself after it loads? (Oh and this is a page within a frameset to boot. :-) )</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-8012</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Fri, 06 Nov 2009 15:54:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-8012</guid>
		<description>Also it is possible this elegant simulation:


&lt;a href=&quot;document.getElementById(&#039;fil&#039;).click();&quot; rel=&quot;nofollow&quot;&gt;Play a song!&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Also it is possible this elegant simulation:</p>
<p><a href="document.getElementById('fil').click();" rel="nofollow">Play a song!</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vince</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-7462</link>
		<dc:creator>Vince</dc:creator>
		<pubDate>Fri, 16 Oct 2009 19:58:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-7462</guid>
		<description>What if you have an  control and you are trying to simulate the click event? I&#039;m trying to fire a server-side event that&#039;s why i need the asp:button.

You can&#039;t use getElementById(&quot;Button_ID&quot;) right? Do you need the ClientID?

Thanks...</description>
		<content:encoded><![CDATA[<p>What if you have an  control and you are trying to simulate the click event? I&#8217;m trying to fire a server-side event that&#8217;s why i need the asp:button.</p>
<p>You can&#8217;t use getElementById(&#8220;Button_ID&#8221;) right? Do you need the ClientID?</p>
<p>Thanks&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wellsantos</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-5994</link>
		<dc:creator>wellsantos</dc:creator>
		<pubDate>Thu, 20 Aug 2009 12:53:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-5994</guid>
		<description>Hi, I&#039;m looking for something like this:

  function fireEvent (x, y, type) {...}

Does somebody know&#039;s any function like above?
Because I need to simulate an event at X,Y with the mouse.

  Example: fireEvent( 100, 50, &quot;mousedown&quot; );

Thanks.</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;m looking for something like this:</p>
<p>  function fireEvent (x, y, type) {&#8230;}</p>
<p>Does somebody know&#8217;s any function like above?<br />
Because I need to simulate an event at X,Y with the mouse.</p>
<p>  Example: fireEvent( 100, 50, &#8220;mousedown&#8221; );</p>
<p>Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Céspedes</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-5603</link>
		<dc:creator>Miguel Céspedes</dc:creator>
		<pubDate>Wed, 05 Aug 2009 22:25:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-5603</guid>
		<description>The link contains attributes:
&lt;strong&gt;&lt;a href=&quot;http://iaian7.com/media/2007/06/2007vfx.flv&quot; rel=&quot;mediabox[640 360]&quot; title=&quot;flash video&quot;&gt;play flash video &#187;&lt;/a&gt;&lt;/strong&gt;</description>
		<content:encoded><![CDATA[<p>The link contains attributes:<br />
<strong>&lt;a href=&quot;http://iaian7.com/media/2007/06/2007vfx.flv&quot; rel=&quot;mediabox[640 360]&quot; title=&quot;flash video&quot;&gt;play flash video &raquo;&lt;/a&gt;</strong></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Céspedes</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-5602</link>
		<dc:creator>Miguel Céspedes</dc:creator>
		<pubDate>Wed, 05 Aug 2009 22:14:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-5602</guid>
		<description>Thanks but not is what I&#039;m looking for.
I want to call &quot;Mediabox&quot; from a button

This is the link:

&lt;a href=&quot;http://iaian7.com/media/2007/06/2007vfx.flv&quot; title=&quot;flash video&quot; rel=&quot;nofollow&quot;&gt;play flash video »&lt;/a&gt;

And this is the library:
http://iaian7.com/webcode/Mediabox</description>
		<content:encoded><![CDATA[<p>Thanks but not is what I&#8217;m looking for.<br />
I want to call &#8220;Mediabox&#8221; from a button</p>
<p>This is the link:</p>
<p><a href="http://iaian7.com/media/2007/06/2007vfx.flv" title="flash video" rel="nofollow">play flash video »</a></p>
<p>And this is the library:<br />
<a href="http://iaian7.com/webcode/Mediabox" rel="nofollow">http://iaian7.com/webcode/Mediabox</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-5599</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Wed, 05 Aug 2009 21:17:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-5599</guid>
		<description>Yes, it should work!

http://www.webmasterworld.com/forum91/762.htm</description>
		<content:encoded><![CDATA[<p>Yes, it should work!</p>
<p><a href="http://www.webmasterworld.com/forum91/762.htm" rel="nofollow">http://www.webmasterworld.com/forum91/762.htm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miguel Céspedes</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-5598</link>
		<dc:creator>Miguel Céspedes</dc:creator>
		<pubDate>Wed, 05 Aug 2009 21:05:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-5598</guid>
		<description>Can you replace the button with a hyperlink?</description>
		<content:encoded><![CDATA[<p>Can you replace the button with a hyperlink?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Knix</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-278</link>
		<dc:creator>Knix</dc:creator>
		<pubDate>Thu, 28 Aug 2008 14:05:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-278</guid>
		<description>Hi Henrique,

Yes, you can try the following instead:
&lt;pre lang=&quot;html&quot;&gt;
&lt;a href=&quot;javascript:myJavaScriptFunction();&quot; rel=&quot;nofollow&quot;&gt;Click Me&lt;/a&gt;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hi Henrique,</p>
<p>Yes, you can try the following instead:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;a href=&quot;javascript:myJavaScriptFunction();&quot; rel=&quot;nofollow&quot;&gt;Click Me&lt;/a&gt;</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Henrique</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-277</link>
		<dc:creator>Henrique</dc:creator>
		<pubDate>Thu, 28 Aug 2008 13:12:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-277</guid>
		<description>Very Nice!
But do you know how to set this kind of click on a link object with HREF instead ONCLICK?
Thanks.</description>
		<content:encoded><![CDATA[<p>Very Nice!<br />
But do you know how to set this kind of click on a link object with HREF instead ONCLICK?<br />
Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sunil</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-125</link>
		<dc:creator>sunil</dc:creator>
		<pubDate>Wed, 02 Jul 2008 15:47:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-125</guid>
		<description>Neat!</description>
		<content:encoded><![CDATA[<p>Neat!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scanmen</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-42</link>
		<dc:creator>Scanmen</dc:creator>
		<pubDate>Tue, 22 Apr 2008 08:36:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-42</guid>
		<description>Nice code ... thanks</description>
		<content:encoded><![CDATA[<p>Nice code &#8230; thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: arab</title>
		<link>http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/comment-page-1/#comment-11</link>
		<dc:creator>arab</dc:creator>
		<pubDate>Tue, 25 Mar 2008 15:24:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.randomsnippets.com/2008/03/05/simulate-a-button-click-via-javascript/#comment-11</guid>
		<description>its nice ...thanx a lot</description>
		<content:encoded><![CDATA[<p>its nice &#8230;thanx a lot</p>
]]></content:encoded>
	</item>
</channel>
</rss>
