SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast athena's Avatar
    Join Date
    Apr 2002
    Location
    Vancouver, Canada
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE problem and Javascript

    I got this working in Firefox and then went to check in IE only to discover it isn't working at all.

    this is on a PHP page:
    HTML Code:
       <input type=\"image\" src=\"bits/delsingle_bttn.gif\" 
     name=\"delsingle\" value=\"$itemcode\"
     onClick=\"document.forms['searchStamp'].submit()\">
    This is supposed to be simple delete button that when clicked passes the id what needs to be deleted. In IE it seems to be submitting, but it's not taking the contents of the variable along for the ride.

    Is there a way to make the passing more explicit?

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Why don't you just use submit button instead of an image? You can stylize it with css.

    Or if you insist to use the image try document.searchStamp.submit()
    Saul

  3. #3
    SitePoint Enthusiast athena's Avatar
    Join Date
    Apr 2002
    Location
    Vancouver, Canada
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    okay the change to the javascript had no effect on the image buttons, but making them submit buttons did work... however can I stylize it to the point that I use my image as opposed to just pretty'ing up the color/font of the button?

    The problem is that since the value on those delete buttons is the ID code, I've just got a bunch of buttons with codes on them now.

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Ah, I think I see the problem. You're trying to pass the ID through the image value. The problem is that IE only sends the coordinates instead of the value of the image. So you must use submit button.

    But since hiding the button text could be complicated, a workaround is to use a hidden field:
    Code:
    <input type="hidden" name="delsingle"/>
    <input type="submit" value=" " onclick="document.searchStamp.delsingle.value='$itemcode'"/>
    Saul


Bookmarks

Posting Permissions

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