Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> get file input full path </title>
<Script language = 'javascript '>
Function getFullPath (obj)
{
If (obj)
{
// Ie
If (window. navigator. userAgent. indexOf ("MSIE")> = 1)
{
Obj. select ();
Return document. selection. createRange (). text;
}
// Firefox
Else if (window. navigator. userAgent. indexOf ("Firefox")> = 1)
{
If (obj. files)
{
Return obj. files. item (0). getAsDataURL ();
}
Return obj. value;
}
Return obj. value;
}
}
</Script>
</Head>
<Body>
<Input type = "file" onchange = "document. getElementById ('img '). src = getFullPath (this);"/>
</Body>
</Html>
Save the above Code as htm and run it.