Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Invoke onclick event of one button from clicking a second button


  • From: javascript@xxxxxxxxxx (Harry Love)
  • Subject: [Javascript] Invoke onclick event of one button from clicking a second button
  • Date: Mon, 9 Sep 2002 17:21:18 -0700

This is a multi-part message in MIME format.

------=_NextPart_000_0009_01C25825.4F624630
Content-Type: text/plain;
	charset="US-ASCII"
Content-Transfer-Encoding: 7bit

-----Original Message-----
From: javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx]
On Behalf Of George Tsang
Sent: Monday, September 09, 2002 4:59 PM
To: Javascript@xxxxxxxxxx
Subject: [Javascript] Invoke onclick event of one button from clicking a
second button
Greetings,
 
I have set up the following:
 
<button id="abutton" onclick="alert('A clicked')">A</button> 
<br> 
<button id="bbutton" onclick="stuff = document.getElementById
('abutton'); stuff.click()">B</button>
 
 
-----------------------
 
George,
 
You could try this:
<button id="bbutton"
onclick="document.getElementById('abutton').click()">B</button>
 
Works in Moz1.1.
 
Regards,
Harry

------=_NextPart_000_0009_01C25825.4F624630
Content-Type: text/html;
	charset="US-ASCII"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns=3D"http://www.w3.org/TR/REC-html40"; xmlns:o =3D=20
"urn:schemas-microsoft-com:office:office" xmlns:w =3D=20
"urn:schemas-microsoft-com:office:word"><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<TITLE>Message</TITLE>

<META content=3DWord.Document name=3DProgId>
<META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR>
<META content=3D"Microsoft Word 10" name=3DOriginator><LINK=20
href=3D"cid:filelist.xml@xxxxxxxxxxxxxxxxx"; rel=3DFile-List><!--[if gte =
mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:UseFELayout/>
  </w:Compatibility>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<STYLE>
<!--
 /* Font Definitions */
 @font-face
	{font-family:PMingLiU;
	panose-1:2 2 3 0 0 0 0 0 0 0;
	mso-font-alt:\65B0\7D30\660E\9AD4;
	mso-font-charset:136;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:3 137232384 22 0 1048577 0;}
@font-face
	{font-family:"\@PMingLiU";
	panose-1:2 2 3 0 0 0 0 0 0 0;
	mso-font-charset:136;
	mso-generic-font-family:auto;
	mso-font-pitch:auto;
	mso-font-signature:0 0 0 0 0 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-parent:"";
	margin:0cm;
	margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:12.0pt;
	font-family:"Times New Roman";
	mso-fareast-font-family:PMingLiU;}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;
	text-underline:single;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	mso-style-noshow:yes;
	mso-ansi-font-size:10.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:Arial;
	mso-ascii-font-family:Arial;
	mso-hansi-font-family:Arial;
	mso-bidi-font-family:Arial;
	color:windowtext;}
span.SpellE
	{mso-style-name:"";
	mso-spl-e:yes;}
span.GramE
	{mso-style-name:"";
	mso-gram-e:yes;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;
	mso-header-margin:35.4pt;
	mso-footer-margin:35.4pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
-->
</STYLE>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman";}
</style>
<![endif]--></HEAD>
<BODY lang=3DEN-US style=3D"tab-interval: 36.0pt" vLink=3Dpurple =
link=3Dblue>
<DIV><FONT face=3DTahoma size=3D2>-----Original =
Message-----<BR><B>From:</B>=20
javascript-admin@xxxxxxxxxx [mailto:javascript-admin@xxxxxxxxxx] <B>On =
Behalf Of=20
</B>George Tsang<BR><B>Sent:</B> Monday, September 09, 2002 4:59=20
PM<BR><B>To:</B> Javascript@xxxxxxxxxx<BR><B>Subject:</B> [Javascript] =
Invoke=20
onclick event of one button from clicking a second =
button<BR></FONT><FONT=20
face=3D"Courier New" size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">Greetings,<o:p></o:p></SPAN></FONT></DIV>
<DIV class=3DSection1>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"><o:p>&nbsp;</o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">I =
have set up=20
the following:<o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"><o:p>&nbsp;</o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">&lt;button=20
id=3D"<SPAN class=3DSpellE>abutton</SPAN>" <SPAN =
class=3DSpellE>onclick</SPAN>=3D"<SPAN=20
class=3DGramE>alert(</SPAN>'A clicked')"&gt;A&lt;/button&gt;=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">&lt;<SPAN=20
class=3DSpellE><SPAN class=3DGramE>br</SPAN></SPAN>&gt;=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'">&lt;button=20
id=3D"<SPAN class=3DSpellE>bbutton</SPAN>" <SPAN =
class=3DSpellE>onclick</SPAN>=3D"stuff=20
=3D <SPAN class=3DSpellE>document.getElementById</SPAN> ('<SPAN=20
class=3DSpellE>abutton</SPAN>'); <SPAN class=3DSpellE><SPAN=20
class=3DGramE>stuff.click</SPAN></SPAN><SPAN=20
class=3DGramE>(</SPAN>)"&gt;B&lt;/button&gt;<o:p></o:p></SPAN></FONT></P>=

<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"><o:p></o:p></SPAN></FONT>&nbsp;</P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3D"Courier New"=20
size=3D2><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"><o:p></o:p></SPAN></FONT>&nbsp;</P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT=20
face=3D"Courier New"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002><FONT=20
face=3DVerdana>-----------------------</FONT></SPAN></o:p></SPAN></FONT><=
/P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT=20
face=3D"Courier New"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002></SPAN></o:p></SPAN></FONT>&nbsp;</P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT=20
face=3D"Courier New"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002></SPAN><SPAN class=3D681511400-10092002><FONT =

face=3DVerdana>George,</FONT></SPAN></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT=20
face=3D"Courier New"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier =
New'"><o:p></o:p></SPAN></FONT>&nbsp;</P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT=20
face=3D"Courier New"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002><FONT face=3DVerdana>You could try=20
this:</FONT></SPAN></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT=20
face=3D"Courier New"><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002></SPAN><SPAN class=3D681511400-10092002><FONT =

face=3DVerdana>&lt;button id=3D"bbutton"=20
onclick=3D"document.getElementById('abutton').click()"&gt;B&lt;/button&gt=
;</FONT></SPAN></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3DVerdana><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002></SPAN></o:p></SPAN></FONT>&nbsp;</P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3DVerdana><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002>Works in =
Moz1.1.</SPAN></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3DVerdana><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002></SPAN></o:p></SPAN></FONT>&nbsp;</P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3DVerdana><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002>Regards,</SPAN></o:p></SPAN></FONT></P>
<P class=3DMsoNormal style=3D"mso-layout-grid-align: none"><FONT =
face=3DVerdana><SPAN=20
style=3D"FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><o:p><SPAN=20
class=3D681511400-10092002>Harry</SPAN></o:p></SPAN></FONT></P></DIV></BO=
DY></HTML>

------=_NextPart_000_0009_01C25825.4F624630--