Share the JavaScript method for determining file upload types, which can trigger onchange events for duplicate content.
How JavaScript determines the type of file upload:
A feature is used when uploading files, using the input tag of the HTML element to implement:
<input id= "ImageFile" name= "ImageFile1" accept= "image/jpg,image/jpeg,image/png,image/bmp,image/gif" type= "file" title= "Click to select File" onchange= "Imagesubmit (this,0);" />
The onchange event upload image is triggered immediately after the picture is selected, but repeating the same picture does not trigger the Onchang event, the workaround is as follows:
functionif (imageType = = "0"// related processing code ...) // www.yuju100.com // Resolve upload the same picture does not trigger onchange event var nf = Obj.clonenode (true); Nf.value= "; Obj.parentNode.replaceChild (NF, obj );}}
The CloneNode () method is used to create an identical copy of the call to the node, and True indicates that a deep copy is performed, that is, the copy node and the entire child node tree, in the case of false parameters, perform a shallow copy, that is, the node itself is copied only.
The copy of the node returned after replication belongs to the document, but does not specify a parent node for it. Www.jbxue.com
Therefore, this copy of the node becomes an "orphan" unless it is added to the document by AppendChild (), insertbefore (), or replacechild ().
How JavaScript determines file upload type instance sharing