473,394 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

OnClick event

Hello,

I am wanting to fire the onClick event of button1 by pressing button2.
Does anyone have a clue if this is even posible? If so PLEASE HELP!!
Thanks.

Jul 23 '05 #1
3 3769
f1******@gmail.com wrote:
I am wanting to fire the onClick event of button1 by pressing
button2. Does anyone have a clue if this is even posible?
Here is a test document. Watch the differing behaviour of MSIE
compared to other Browsers (Mozilla, Opera, Netscape 4) when
clicking the second button:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN Transitional"
"http://www.w3.org/TR/html4/transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Some Events</title>
<script type="text/javascript">
window.name = "myWindow";
</script>
</head>
<body>
<form action="" name="myForm"><p>
<input type="button" value="1" name="myButton1"
onclick="alert(this.name + '\n' + (event &amp;&amp; event.type))" <input type="button" value="2" name="myButton2"
onclick="var o = form.elements['myButton1'], h = o.onclick;
if (typeof h == 'function') h()" <input type="button" value="3" name="myButton3"
onclick="var o = form.elements['myButton1'], h = o.onclick;
if (h && h.apply) h.apply(o, [event])" <input type="button" value="4" name="myButton4"
onclick="var o = form.elements['myButton1'], h = o.onclick;
if (h && h.apply) h.apply(this, [event])"

</p></form>
</body>
</html>

ciao, dhgm
Jul 23 '05 #2
Lee
f1******@gmail.com said:

Hello,

I am wanting to fire the onClick event of button1 by pressing button2.
Does anyone have a clue if this is even posible? If so PLEASE HELP!!
Thanks.


<button onclick="doSomething()">button1</button>
<button onclick="doSomething()">button2</button>

How is what you want different from this?

Jul 23 '05 #3
Dietmar,
Thankyou!!!! This is what I was wanting to do. Thanks so much!!!!

JD

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Andreas Knollmann | last post by:
Hi, I create an object like this: var cell = document.createElement("td"). It doesn't have to be cell. I want this cell to use the onclick event. What doesn't work in the IE as well as with...
2
by: RobG | last post by:
I am trying to dynamically add an onclick to an element, however I just can't get the syntax right. consider the following function: function doClick (evt,x) { // do things with evt and x } ...
17
by: abs | last post by:
My element: <span onclick="alert('test')" id="mySpan">test</span> Let's say that I don't know what is in this span's onclick event. Is it possible to add another action to this element's onclick...
6
by: Cockroach | last post by:
Hello, I have a problem where the onClick of a table row will activates a window.location event, and inside a cell in that row, an image onClick event shows/hides a div. The problem is that...
4
by: RobG | last post by:
I have a function whose parameter is a reference the element that called it: function someFunction(el) { ... } The function is assigned to the onclick event of some elements in the HTML...
5
by: moondaddy | last post by:
I have a <a> element in a datagrid which wraps some asp.net labels. this element also has an onclick event which does not fire in netscape 6 (and perhaps other browsers for all I know...). Below...
5
by: kai | last post by:
Hi, In ASP.NET , what is the difference between OnClick and Click events for a button? Because we have button click event, it can trigger events, why we still need OnClick? Please help. ...
7
by: extremerep | last post by:
My task is to change the value of a button and then make it functional with the onClick handler. Changing the value to "Play Again" works, but making the onClick work accordingly does not. The...
4
by: sameergn | last post by:
Hi, I have an image in my HTML form which has onclick() handler. There is also a submit button and a text box. Whenever text box has focus and user presses enter, the onclick() event of...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.