Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2007, 08:16 AM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using a button image to open an alert?

I have a button (a small .gif image) that I want to use to open an javascript onClick Alert. Need help coding this.

Thanks

Rudy
__________________
Rudy
 
Old June 30th, 2007, 09:23 AM
Friend of Wrox
 
Join Date: Nov 2005
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Default

uhm c'mon that isn't so hard
Code:
<img src="img.jpg" onclick="alert('your alert')" />
or
Code:
<script type="text/javascript">
function customAlert(){
    var alertString="my costum alert text";
    alert(alertString);
}
</script>
<img src="http://www.catfacts.org/cat-facts.jpg" onclick="customAlert()" />
__________________________________________________ ________
I am DJ Kat...that's my name. Its a D and a J and a Kat with a K.
 
Old June 30th, 2007, 09:32 AM
Authorized User
 
Join Date: Oct 2003
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks DJ Kat

Thanks - thats perfect

Rudy





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to open new window on button click nittin14 ASP.NET 1.0 and 1.1 Basics 8 April 28th, 2007 12:13 AM
Open a new window on a button click ag19702004 .NET Framework 2.0 1 January 6th, 2007 12:21 AM
Make a image button as default submit button toshi ASP.NET 1.0 and 1.1 Basics 1 June 1st, 2006 05:25 AM
I cant get my flash button to open one of my links hijinn Javascript How-To 8 December 14th, 2005 04:13 PM
Need to open a PDF with a command button RayL Access VBA 2 January 27th, 2004 12:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.