473,378 Members | 1,066 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Cancel button using javascript

250 100+
I have "cancel" button in php files. I want to write common javascript function for cancel button. When user click cancel button I want to clear php form data.
Is it possible?
Expand|Select|Wrap|Line Numbers
  1. <input id="Cancel" src="Cancel.jpg" type="image"  alt="cancel"    onclick="Cancel('cancel');"/>
  2.  
JS code
Expand|Select|Wrap|Line Numbers
  1. function Cancel(cancel){
  2.  
  3.     if(cancel=='cancel'){
  4.         document.getElementById('No').value='';
  5.         document.getElementById('FullName').value='';
  6.         document.getElementById('Address').value='';
  7.         document.getElementById('Email').value='';
  8.     }
  9.  
  10. }
  11.  
Aug 3 '09 #1
5 13535
Dormilich
8,658 Expert Mod 8TB
@ghjk
sure, although I'd go for a simple reset button...
Aug 3 '09 #2
ghjk
250 100+
But my above code is not working. Could you tell me where I goes wrong?
Aug 4 '09 #3
Dormilich
8,658 Expert Mod 8TB
are there any error messages in the Console or FireBug?
Aug 4 '09 #4
ghjk
250 100+
No. There are no messages. That's why I'm confusing.
Aug 6 '09 #5
Dormilich
8,658 Expert Mod 8TB
then I need a link to see (and test) for myself.
Aug 6 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Stephen | last post by:
I have code which checks whether a datagrid is empty and if it is it shows a panel on my page. If its not empty then Im using the server.transfer to go to another page so as im able to use the...
1
by: Corey Olsen | last post by:
Can anyone point me to some documentation on bypassing validation controls when a user selects cancel? What I have is a user control with a form to fill out information on a subject. The user...
1
by: amrita | last post by:
hi i have a table in web form wth name table1.i need that wen i click on cancel button all the textboxes in that table becomes empty.ny ideas how to do it,doin in onclien side wud be greatly...
3
by: lakshmikandhan | last post by:
Hi All, Can anyone tell how to handle the Cancel button in the JavaScript Confirm() method?If we press cancel, I have to perform certain action in the Server side? Plz help me!! Thanx, Jacob.
1
by: Sergey Zuyev | last post by:
Hello all I have simple edit form. When user saves data that contains restricted characters such as (< , etc.) , regular expression validator will display a warning message. It all works fine,...
6
by: =?Utf-8?B?V2hpc2tleVJvbWVv?= | last post by:
I read the 4 or 5 threads on this Subject and it seems my javasript should work but it doesn't. In the designer, the onClientClick is set to: CheckForSave(this). This works in .Net 1.1 but not...
0
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
7
by: John Gault | last post by:
I experimented with a snippet of JavaScript that will display a "Please Wait" message and graphic while the results of a cgi script is running (the script grabs a bunch of data and formats it in a...
13
Frinavale
by: Frinavale | last post by:
I've been trying all morning to cancel a form submit to the server. I have a JavaScript Object that determines whether or not the page should be submitted to the server depending on whether the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.