Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 21st, 2005, 05:58 AM
Registered User
Join Date: Jul 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with input type image With Anchor tag


     I'm having problem in input type image.Follwing is my code. When the page loads i'm adding one image input type and setting some attributes. My requirement is initially i want to disable the image. But i added code for disabling the image but still i can able to get the click event on image. What is the problem in my code?

var FirstTD = document.createElement('TD');
var FirstTDAtag = document.createElement('A');
FirstTDAtag.setAttribute('class','ms-toolbar ');
FirstTDAtag.setAttribute('href','javascript:test() ');
var FirstTDImgtag = document.createElement('input');
FirstTDImgtag.disabled = true;

When my page get loads image is showing in the page without disabled. When i click the image its showing alert message of function test(). How come its possible?

When i comment out the line FirstTDImgtag.disabled = true; and after refreshing when i click the image the i'ts not getting into the function test() instead its refreshing the page.

Is anybody know solution for my problem please let me know how to solve it?

Thanks and Regards,

Reply With Quote
  #2 (permalink)  
Old July 21st, 2005, 08:59 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

Try appending the image to the page before setting the disabled attribute.


Joe (Microsoft MVP - XML)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anchor Tag kapilmirchi ASP.NET 1.0 and 1.1 Basics 2 November 18th, 2008 05:57 AM
input type="image" tgopal Javascript How-To 1 September 22nd, 2005 05:16 AM
input type="image" tgopal Javascript 1 September 22nd, 2005 05:15 AM
problem with input type="image" nerssi Javascript 6 September 14th, 2004 03:31 PM

All times are GMT -4. The time now is 03:12 AM.

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