473,320 Members | 1,724 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,320 software developers and data experts.

rules for onclick?

I would like to combine a snippet that captures mouse position with
onclick to insert one axis of the mouse position into a variable for
form use.

I have the mouse position capture part ok.

Tutorial examples of onclick only explore what the author thinks are
typical uses of onclick.

So I guess I need to study the rules (or ask) for onclick...

What I envision, conceptually (what follows is not correct language-
wise - just look at for concept for now, please).
<A HREF="something"
onClick="VAR A=mouseX)";</A>

If mouse is clicked, I want one of the mouse position variables
defined by a separate mouse capure script insered into another
variable.

Can this be done, and is the HTML or JavaScript standard entry for
onclick the place to learn the rules for this, or is it a
combinational function that I will no find documentation on?

Thank you

Murray

Jun 14 '07 #1
3 1270
On Jun 14, 12:08 am, murrayatuptowngallery
<murrayatuptowngall...@yahoo.comwrote:
<A HREF="something"
onClick="VAR A=mouseX)";</A>
<button onclick="var a=event.clientX">Click me to set the value of
variable a</button>
If mouse is clicked, I want one of the mouse position variables
defined by a separate mouse capure script insered into another
variable.
Jun 14 '07 #2

Thank you

Jun 15 '07 #3
On Jun 14, 4:20 pm, "scripts.contact" <scripts.cont...@gmail.com>
wrote:
On Jun 14, 12:08 am, murrayatuptowngallery

<murrayatuptowngall...@yahoo.comwrote:
<A HREF="something"
onClick="VAR A=mouseX)";</A>

<button onclick="var a=event.clientX">Click me to set the value of
variable a</button>
I think you need to be a little careful about that. In some browsers,
the result might be a global variable (window.a) but in others a might
be local to the anonymous function assigned to the onclick handler.

It is probably OK to prototype stuff using script inside an HTML
attribute value, but for robustness they should be restricted to
function calls or simple statements like "return false".

--
Rob

Jun 15 '07 #4

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

Similar topics

8
by: Shock | last post by:
Hello everyone, I am having a problem with the program below. I have isolated the problem to the onclick event that is located throughout arrQuestions. The onclick event refers to a function...
17
by: Mike Gratee | last post by:
Is it possible to use JavaScript to cause the browser to click a link on a page and have the browser act exactly like the user had clicked on the link directly? In other words, I need to...
2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
3
by: Jamie Jackson | last post by:
I'm rewriting all links' onclick events, but I'm having a problem. The onclick event that I'm inserting works correctly in Opera, but not in FF or IE. I'm retroactively adding the statement...
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 } ...
2
by: Sedef | last post by:
Hi, i'm trying to create a custom Button user control which will be derived from System.Web.UI.WebControls.Button. the normal server side Button class creates some client side javascript code for...
1
by: Randall Parker | last post by:
I'm wondering if there are general rules for the use of HTML attributes with ASP tags? For example, one can set an id for an asp:DataGrid and it will show up as the id for the resulting HTML...
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...
1
by: Jeremy | last post by:
Is there any way I can find the CSS rules that were applied to a particular element? This is distinct from computedStyle - for example, in Mozilla, I want to find the actual rules that were...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.