Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Simple Question (Probably) About Buttons

New Here ,
Nov 23, 2006 Nov 23, 2006
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.
TOPICS
Server side applications
3.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 24, 2006 Nov 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.
>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 24, 2006 Nov 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()">
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 24, 2006 Nov 24, 2006
LATEST
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()">
>
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines