JavaScript

Moderators: None (Apply to moderate this forum)
Number of threads: 2061
Number of posts: 5164

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Mouse Events Posted by victorsk on 16 Apr 2005 at 12:05 PM
Hello,

I have a question. Does anybody know how to make it so that when a user clicks on an object, that object changes behavoir more than one time? I have:
<script type="text/ecmascript">
function Click(evt)
{
evt.target.setAttribute("transform", "scale(0.9)");
} //this function supposed to reduce an image
</script>
//this function draws an image and calls Click()
<path class="Shape" d="M 99 50 L 143 125 L 56 124 L 99 50z" onclick="Click(evt);"/>

The problem I have is that an image gets reduced only ONCE. How can I call Click() indefinitely to apply its behaviour on an object?

Thank you,
Victor.
Report
Re: Mouse Events Posted by NCS_One on 11 May 2005 at 5:34 PM
: Hello,
:
: I have a question. Does anybody know how to make it so that when a user clicks on an object, that object changes behavoir more than one time? I have:
: <script type="text/ecmascript">
: function Click(evt)
: {
: evt.target.setAttribute("transform", "scale(0.9)");
: } //this function supposed to reduce an image
: </script>
: //this function draws an image and calls Click()
: <path class="Shape" d="M 99 50 L 143 125 L 56 124 L 99 50z" onclick="Click(evt);"/>
:
: The problem I have is that an image gets reduced only ONCE. How can I call Click() indefinitely to apply its behaviour on an object?
:
: Thank you,
: Victor.
:
---------------------------------------------------------------------
Hi

Didn't try it but think it works.

Say something after.

<script type="text/ecmascript">

var CurrentScale = 9;

function Click(evt)
{
evt.target.setAttribute("transform", "scale(0."+CurrentScale+")");

CurrentScale--;

} //this function supposed to reduce an image
</script>
//this function draws an image and calls Click()
<path class="Shape" d="M 99 50 L 143 125 L 56 124 L 99 50z" onclick="Click(evt);"/>



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.