Search

3/30/2008

YAHOO.util.Connect.setForm

http://developer.yahoo.com/yui/docs/YAHOO.util.Connect.html#method_setForm

 setForm
static string setForm ( form , optional )
This method assembles the form label and value pairs and constructs an encoded string. asyncRequest() will automatically initialize the transaction with a a HTTP header Content-Type of application/x-www-form-urlencoded.

Parameters:
form id or name attribute, or form object.
optional enable file upload.
optional enable file upload over SSL in IE only.

Returns: string
string of the HTML form field name and value pairs..

YUI ImageCropper 的簡單範例| 這樣做就對了

function onFormSubmit(e) {
YUE.preventDefault(e);
YUC.setForm(form6);
YUC.asyncRequest('POST', 'crop6.php', {
success : function(o) {
data = eval('(' + o.responseText + ')');
img6.setAttribute('src', data.img);
YUD.setStyle(img6, 'width', 'auto');
YUD.setStyle(img6, 'height', 'auto');
crop6.destroy();
form6.parentNode.removeChild(form6);
}
});
}
YUE.on(form6, 'submit', onFormSubmit);

沒有留言: