[thelist] images as button and JS

Jeff jeff at c4webdesign.com
Sat Aug 26 04:20:09 CDT 2000


adrian,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Adrian Fischer <info at aussiebidder.com>
:
: Can any one tell me this doesn't work?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

just offhand i'd say the problem client-side is because an image submit does
not have an onClick event handler.  server-side i'd say that it's because
you're not looking for the right kinds of values, ie x & y coordinates of
the click.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: <form>
:   <input
:     type=image
:     src=\"../images/newitem.gif\"
:     onClick=
:       \"window.open(\'lib/new.html\' ,
:       \'adrian\' ,
:       config=\'height=200,width=200\')\"
:   >
: </form>
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

there's no such parameter named "config" in the window.open() function.

also, just out of curiousity, but what's the reason for all the
back-slashes?  is this something that you're putting on the page via
document.write()?  if not, lose them all, they're not necessary.  if you
are, then may i make a suggestion . . . don't use double-quotes to wrap your
strings in javascript.  instead, wrap your strings in single-quotes, then
the only time you'll ever have to escape anything is when you've got an
apostrophe or the odd function called where you're passing strings that are
wrapped in single-quotes.  in other words, this:

document.write("<a href=\"/foo.html\" onClick=\"alert('bar')\">");

would simply be this:

document.write('<a href="/foo.html" onClick="alert(\'bar\')">');

much easier to read eh?

hint: image submits do not have a value attribute because they don't send a
value to the server.  instead, they return the name of the button with
coordinates attached.

foo.html?imagebutton.x=15&imagebutton.y=3

good luck,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org







More information about the thelist mailing list