Forum Moderators: open
I wrote a little something that checks file properties once the file is uploaded. I do this by refreshing the page and loading a dummy input field... when the input field focuses, it should trigger the javascript to check the file... it works great in IE but not in Firefox... I don't understand why?
Can someone help?
CODE:
<script language = javascript>
<!-- Begin
function CheckPhoto(img){
foto1= new Image();
foto1.src=(img);
Controlla(img);
}
function Controlla(img){
if((foto1.width!=0)&&(foto1.height!=0)){
viewFoto(img);
}
else{
funzione="Controlla('"+img+"')";
intervallo=setTimeout(funzione,20);
}
}
function viewFoto(img){
largh=foto1.width + 30;
altez=foto1.height + 40;
stringa="width="+largh+",height="+altez;
location = ("<cfoutput>#httppath#globalfiles/upload.cfm?subaction=commitResource&resourcetitle=#resourcetitle#&imageAlign=#imageAlign#&maxFileWidth=#maxFileWidth#&maxFileHeight=#maxFileHeight#&post_id=#post_id#&blog_id=#blog_id#&fromurl=#fromurl#&publishOption=#publishOption#&type_search=#type_search#&page_id=#page_id#</cfoutput>&pic="+img+"&height="+foto1.height+"&width="+foto1.width);
}
// End -->
</script>
<body onLoad="document.getElementById('dummyinput').focus();">
<form name="thedummyform">
<input type="text" name="dummyinput" id="dummyinput" style="border:#FFFFFF;" onFocus="javascript:CheckPhoto('<cfoutput>#imagepath#temp/#filename#</cfoutput>');">
Have you checked Mozilla's javascript console? It will help you to find any errors that it may be experiencing.
Good luck!