Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > rules for onclick?

Reply
Thread Tools

rules for onclick?

 
 
murrayatuptowngallery
Guest
Posts: n/a
 
      06-14-2007
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

 
Reply With Quote
 
 
 
 
scripts.contact
Guest
Posts: n/a
 
      06-14-2007
On Jun 14, 12:08 am, murrayatuptowngallery
<(E-Mail Removed)> wrote:
> <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.


 
Reply With Quote
 
 
 
 
murrayatuptowngallery
Guest
Posts: n/a
 
      06-15-2007

Thank you

 
Reply With Quote
 
RobG
Guest
Posts: n/a
 
      06-15-2007
On Jun 14, 4:20 pm, "scripts.contact" <(E-Mail Removed)>
wrote:
> On Jun 14, 12:08 am, murrayatuptowngallery
>
> <(E-Mail Removed)> wrote:
> > <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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rules for Cisco PIX 525 firewall rules KAS Cisco 2 10-02-2005 07:12 PM
Case Gallery rules and Guidelines Silverstrand Case Modding 0 06-20-2005 11:38 PM
Thunderbird email "rules"? joseph white Firefox 3 01-04-2005 08:49 PM
Having Problems with Message Rules and Dictionary Install. Reg Mouatt Firefox 7 10-04-2004 11:58 PM
Export/import rules? Jeff Boes Firefox 1 10-30-2003 10:53 PM



Advertisments