《Web交互开发》实验教学指导/实验六:文件 4 databox=document. getElement Byldd'databox): var button=document. getElement Byld(ibutton) window. webkit Request FileSystem( window. TEMPORARY, 5 1024*1024, created, showerror) button. add EventListener(click, create, false); function created(fs)i hd=fs . root function createD var name=document. getElementByld'myentry')value if(name!=)Y hd. getFile(name, create true, exclusive false), show, showerror) function show(entry)1 databox innerhTML=文件创建成功!<br databox innerhTML+=名称:+ entry name.+br> databox innerhTML+=路径:+ entry. fullPath+<br databox innerHTML+=FileSystem: ' +entry filesystem name+<br> function showerror(e)( alert(错误:'+ e name) window. add Event Listener('load, initiate, false) diy id=formbox"> <form name="form"> <p>X1+ <br><input type="text"name="myentry"id="myentry"></p <p><input type="button"name="ibutton"id="ibutton"value="HEx" ></p> 没有可用的对象 <div> </body> </html> (2)请完成下面的任务: 本讲共计6页|当前第4页《Web 交互开发》实验教学指导 / 实验六 :文件 本讲共计 6 页 | 当前第 4 页 databox=document.getElementById('databox'); var button=document.getElementById('fbutton'); window.webkitRequestFileSystem(window.TEMPORARY, 5*1024*1024, createhd, showerror); button.addEventListener('click',create,false); } function createhd(fs){ hd=fs.root; } function create(){ var name=document.getElementById('myentry').value; if(name!=''){ hd.getFile(name, {create:true, exclusive:false}, show, showerror); } } function show(entry){ databox.innerHTML='文件创建成功!<br>'; databox.innerHTML+='名称:'+entry.name+'<br>'; databox.innerHTML+='路径:'+entry.fullPath+'<br>'; databox.innerHTML+='FileSystem:'+entry.filesystem.name+'<br>'; } function showerror(e){ alert('错误:'+e.name); } window.addEventListener('load',initiate,false); </script> </head> <body> <div id="formbox"> <form name="form"> <p>文件:<br><input type="text" name="myentry" id="myentry"></p> <p><input type="button" name="fbutton" id="fbutton" value="提交"></p> </form> </div> <div id="databox"> 没有可用的对象 </div> </body> </html> (2)请完成下面的任务: