Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts

    can i use an image as reset button ?

    i know i can use an image as a submit button, but can i use one as a reset button ?

    thanx

    HormonX

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    Louisiana
    Posts
    576
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i am almost positive the syntax is like this
    <img src="rst.jpg" type="submit">

  • #3
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well .. i know the syntax for submit button as an image ... and it actually goes like this ...

    PHP Code:

    <input type='image' name='submit' value="submit" src=image.gif" border="0"> 
    the question is .. if and how can i use a button to clear a form.

    HormonX

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <form name="myform">
    
    ...
    
    <a href="Reset the form" onclick="document.forms["myform"].reset();return false;"><img src="myresetimage" /></a>
    <noscript>
    Since you don't have Javascript enabled, use only this button to reset the form <input type="reset" value="Reset the Form Here" />
    </noscript>
    </form>

  • #5
    New Coder
    Join Date
    Aug 2002
    Location
    Toronto, Canada
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanx,

    the code works fine ... there is only one problem ... when the page loads everything worksfine ..but when i press reset .. and page resets .... i get an error message from javascript.

    Line: 122
    Char: 1
    Error: Syntax Error
    Code: 0
    URL: www.mypage.com/contact.php

    And line 122 is empty ...

    any idea why this might be happening ?

    HormonX

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I can't tell without seeing the code but as a first guess I'd suspect that you've got a typo. My usual problem is spelling false as flase

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,965
    Thanks
    0
    Thanked 236 Times in 233 Posts
    use single quotes instead:

    <a href="Reset the form" onclick="document.forms['myform'].reset();return false;"><img src="myresetimage" /></a>

  • #8
    Regular Coder
    Join Date
    Oct 2002
    Posts
    380
    Thanks
    0
    Thanked 0 Times in 0 Posts
    A general debugging tip for javascript (and php): the error may not become apparent until a few lines after you entered it. This is especially true of missing quotes (something I keep doing, so I know this well). If you get an error on a line, look backwards from that line for a problem.

    Since the answer's already posted, I probably didn't need to add that.

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    ColoRockyz
    Posts
    1,646
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Try:

    <button type="reset"><img src="pic.jpg"></button>
    Zoobie or not Zoobie...That is the problem.
    <body onUnload="flush( ! )">


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •