...

View Full Version : How could a form without submit node be submitted?



koifans
09-13-2007, 07:36 PM
Hi, there,
Please take a look of http://gsx.apple.com. When you look at the source of the page, you'll find the "key" element of "Log In" is just a image, like this:
<TD ALIGN=left WIDTH="50%"><input border="0" type="image" name="1.Continue" src="/AppleConnect/US-EN/BtnGSXLogin.gif"></TD>

My question is that there's no "onclick" to activate a javascript and no "submit" type input but it should belong to a form with "post" method to submit it. So how could it (the image) response to my click action to finish the login action?

Thanks.
Koifans

VIPStephan
09-13-2007, 07:50 PM
Inputs of type image are the same as submit buttons, only that they use an external image.

And FYI: There doesn’t need to be an onclick event handler (or any event handler) in the HTML to invoke a JavaScript function. Actually the best way is to keep scripts out of the HTML and invoke them from an external file, using the DOM to access/address elements.

koifans
09-13-2007, 09:05 PM
Inputs of type image are the same as submit buttons, only that they use an external image.

And FYI: There doesn’t need to be an onclick event handler (or any event handler) in the HTML to invoke a JavaScript function. Actually the best way is to keep scripts out of the HTML and invoke them from an external file, using the DOM to access/address elements.
Ah... yes! Thanks!
For the "keep scripts out of the HTML..." issue, do you mean put all scripts into a "xxxxx.js" file and include it in HTML file like this: <script src="xxxxx.js">?

PremiumBlend
09-13-2007, 09:14 PM
I think he means like this:



someElement.onclick = function() {
alert('You clicked me!');
}

felgall
09-14-2007, 12:00 AM
I think he means like this:



someElement.onclick = function() {
alert('You clicked me!');
}



or better still use event listeners for JavaScript and attachEvent for JScript instead of using event handlers at all.

koifans
09-14-2007, 12:27 AM
I think he means like this:



someElement.onclick = function() {
alert('You clicked me!');
}


Oh, I see.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum