Hi !
i would like to add a customised "reset button" in a form. Can anyone send me the proper code ?
this :
<input type="image" src="../media/bouton_reset.jpg" name="reset">
doesn't work
who can help ?
question about a customised button in a form
Moderator: General Moderators
- orangeapple
- Forum Commoner
- Posts: 70
- Joined: Tue Jan 06, 2004 1:24 pm
- Location: Geneva / Switzerland
You need to use javascript
Paste this in your head tag
Then produce a form like this
Mark
Paste this in your head tag
Code: Select all
<script language = "Javascript">
function ResetForm(which){
var pass=true
var first=-1
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elementsїi]
if (tempobj.type=="text"){
eval(tempobj.value="")
if (first==-1) {first=i}
}
else if (tempobj.type=="checkbox") {
eval(tempobj.checked=0)
if (first==-1) {first=i}
}
else if (tempobj.col!="") {
eval(tempobj.value="")
if (first==-1) {first=i}
}
}
}
which.elementsїfirst].focus()
return false
}
</script>Code: Select all
<form onSubmit="return ResetForm(this)" method="post" action="#" name="">
<!-- place all your other fields here -->
<input type="image" border="0" name="imgReset" src="/images/reset.gif" width="62" height="20">
</form>- no_memories
- Forum Contributor
- Posts: 145
- Joined: Sun Feb 01, 2004 7:12 pm
- Location: New York City
or maybe try using css.
style --->
#formreset {
color: #f00;
background: #ccc;
border: 1px solid #00f;
}
html --->
<input type="reset" id="formreset" value="Reset Form">
style --->
#formreset {
color: #f00;
background: #ccc;
border: 1px solid #00f;
}
html --->
<input type="reset" id="formreset" value="Reset Form">
Last edited by no_memories on Wed Feb 11, 2004 5:41 pm, edited 1 time in total.