Documente Academic
Documente Profesional
Documente Cultură
iframe=document.createElement("iframe");iframe.setAttribute("id","upload_ifra
me");iframe.setAttribute("name","upload_iframe");iframe.setAttribute("width",
"0");iframe.setAttribute("height","0");iframe.setAttribute("border","0");ifra
me.setAttribute("style","width: 0; height: 0; border:
none;");form.parentNode.appendChild(iframe);window.frames['upload_iframe'].na
me="upload_iframe";iframeId=document.getElementById("upload_iframe");var
eventHandler=function(){if(iframeId.detachEvent)iframeId.detachEvent("onload"
,eventHandler);else
iframeId.removeEventListener("load",eventHandler,false);if(iframeId.contentDo
cument){content=iframeId.contentDocument.body.innerHTML;}else
if(iframeId.contentWindow){content=iframeId.contentWindow.document.body.inner
HTML;}else if(iframeId.document){content=iframeId.document.body.innerHTML;}
document.getElementById(div_id).innerHTML=content;setTimeout('iframeId.parent
Node.removeChild(iframeId)',250);}
if(iframeId.addEventListener)iframeId.addEventListener("load",eventHandler,tr
ue);if(iframeId.attachEvent)iframeId.attachEvent("onload",eventHandler);form.
setAttribute("target","upload_iframe");form.setAttribute("action",action_url)
;form.setAttribute("method","post");form.setAttribute("enctype","multipart/fo
rm-data");form.setAttribute("encoding","multipart/form-
data");form.submit();document.getElementById(div_id).innerHTML="Uploading..."
;}</script>
<!-- index.php could be any script server-side for receive uploads. -->
<form>
<input name="datafile" type="file"><br>
<input value="upload" onclick="fileUpload(this.form,'index.php','upload');
return false;" type="button">
<div id="upload"></div>
</form>
$(document).ready(function(e){
/* Loop through each form element that has the required="" attribute.
*/
$("form input[required]").each(function(){
});
});