Copy Code code as follows:
window["Mzbrowser"] ={};
(Function ()
{
if (mzbrowser.platform) return;
var ua = window.navigator.userAgent;
Mzbrowser.platform = Window.navigator.platform;
Mzbrowser.firefox = Ua.indexof ("Firefox") > 0;
Mzbrowser.opera = typeof (Window.opera) = = "Object";
mzbrowser.ie =! Mzbrowser.opera && ua.indexof ("MSIE") > 0;
Mzbrowser.mozilla = Window.navigator.product = = "Gecko";
Mzbrowser.netscape = Window.navigator.vendor = = "Netscape";
Mzbrowser.safari = Ua.indexof ("Safari") >-1;
if (Mzbrowser.firefox) var re =/firefox (\s|\/) (\d+ (\.\d+)?) /;
else if (mzbrowser.ie) var re =/msie () (\d+ (\.\d+)?) /;
else if (Mzbrowser.opera) var re =/opera (\s|\/) (\d+ (\.\d+)?) /;
else if (mzbrowser.netscape) var re =/netscape (\s|\/) (\d+ (\.\d+)?) /;
else if (Mzbrowser.safari) var re =/version (\/) (\d+ (\.\d+)?) /;
else if (Mzbrowser.mozilla) var re =/RV (\:) (\d+ (\.\d+)?) /;
if ("Undefined"!= typeof (Re) && Re.test (UA))
Mzbrowser.version = parsefloat (regexp.$2);
}
)();
function Uploadkey (E, object)
{
if ((document.all) true:false)
{
Window.event.keyCode = 9? (Window.event.returnValue = True): (Window.event.returnValue = false);
}
Else
{
if (Object.value = = "" && typeof E.which = = "Number") E.preventdefault ();
if (Object.value!= "") Object.blur ();
}
}
Function version (object)
{
if (mzbrowser.firefox && mzbrowser.version = 2) Object.blur ();
}
function Clearvalue (ID)
{
var up = (typeof id = = "string")? document.getElementById (ID): ID;
if (typeof up!= "Object") return null;
var tt = document.createelement ("span");
Tt.id = "__tt__";
Up.parentNode.insertBefore (TT, UP);
var tf = document.createelement ("form");
Tf.appendchild (UP);
document.getElementsByTagName ("Body") [0].appendchild (TF);
Tf.reset ();
Tt.parentNode.insertBefore (up, TT);
Tt.parentNode.removeChild (TT);
tt = NULL;
Tf.parentNode.removeChild (TF);
}
Page code
Copy Code code as follows:
<script language=" javascript "src=" Upload.js "></script>
<body>
<input name=" textfield3 "type=" file "class=" Input "id=" textfield3 "size=" "value=" "ondrag=" return False, "oncut=" return false; "onkeydown=" Uploadkey (event,this ; ' onpaste= ' return false; ' onmousedown= ' document.oncontextmenu = function () {return false;} ' onmouseout= ' Document.oncontextmenu = function () {return true;}; Version (this); "TabIndex = -1/> <input type=" button "id=" clear "value=" Empty "onclick=" clearvalue (' textfield3 '); " />
</body>