Skip to main content
Participant
November 24, 2006
Question

Simple Question (Probably) About Buttons

  • November 24, 2006
  • 3 replies
  • 3330 views
I am delving into Web programming for the first time. I am used to event driven programming. How and where do I code for a button's OnClick event? I want the button to perform an action OTHER THAN simply a submit.

Just to keep my example simple, let's say I want to open up a small window which says "Thank You" once the button was clicked. Where do I put this code.

Thanks in advance for helping a really discouraged and frustrated newby.
This topic has been closed for replies.

3 replies

Inspiring
November 24, 2006
You cannot add such things to Flash objects. That functionality would have
to be implemented in the object's Actionscript.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"MrJCG1" <webforumsuser@macromedia.com> wrote in message
news:ek752i$f5i$1@forums.macromedia.com...
> Thanks. I don't know why I never thought of functions. I was trying to
> attach
> several lines of code to the onClick event and it wasn't working. But...
>
> If I create a function called test, what is the correct syntax to call it?
> Here's what I have. Is this correct???
>
> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
> codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#ve
> rsion=5,0,0,0" name="btnAddToCart" width="105" height="33"
> id="btnAddToCart"
> onclick="Test()">
>
>


MrJCG1Author
Participant
November 24, 2006
Thanks. I don't know why I never thought of functions. I was trying to attach several lines of code to the onClick event and it wasn't working. But...

If I create a function called test, what is the correct syntax to call it? Here's what I have. Is this correct???

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" name="btnAddToCart" width="105" height="33" id="btnAddToCart" onclick="Test()">
Inspiring
November 24, 2006
put the code in the button html tag:

<input type="button" name="clickme" value="Click me"
onclick="alert('Thank you')" />

if the code is more complex you better define a function and call it in
the onclick handler

MrJCG1 wrote:
> I am delving into Web programming for the first time. I am used to event
> driven programming. How and where do I code for a button's OnClick event? I
> want the button to perform an action OTHER THAN simply a submit.
>
> Just to keep my example simple, let's say I want to open up a small window
> which says "Thank You" once the button was clicked. Where do I put this code.
>
> Thanks in advance for helping a really discouraged and frustrated newby.
>