Tip: you can modify some code before running
<!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=utf-8" /><title>Untitled Document</title></head><body>Select the desktop background:<input type="file" name="fileField" id="fileField" onchange="showPic(this)" /><div id="imgShow"></div><script language="javascript" type="text/javascript">Function setCookie (c_name, value, expiredays) {var exdate = new Date () exdate. setDate (exdate. getDate () + expiredays) document. cookie = c_name + "=" + escape (value) + (expiredays = null )? "": "; Expires =" + exdate. toGMTString ()} function getCookie (c_name) {if (document. cookie. length> 0) {c_start = document. cookie. indexOf (c_name + "=") if (c_start! =-1) {c_start = c_start + c_name.length + 1 c_end = document. cookie. indexOf (";", c_start) if (c_end =-1) c_end = document. cookie. length return unescape (document. cookie. substring (c_start, c_end)} return ""} var showPic = function (obj) {var img = document. createElement ("IMG"); img. src = "file: //" + obj. value; img. onerror = function () {this. parentNode. removeChild (this); alert ("Select a correct image file! ");} Var imgShow = document. getElementById ("imgShow"); imgShow. innerHTML = ""; imgShow. appendChild (img); setCookie ("your bgpic", obj. value, 1000);} document. write ("The image address selected last time is:" + getCookie ("your bgpic") + "! "); Document. getElementById (" fileField "). value = getCookie (" your bgpic "); if (getCookie (" your bgpic ")! = "") {ShowPic (document. getElementById ("fileField "));}</script></body></html>
Tip: you can modify some code before running