為什么這樣可以輸出function fn(){var txt=document.getElementById("txt").value;var mydate =new Date();mydate.setTime(mydate.getTime()+txt*60*60*1000);document.write("延遲后的時(shí)間為:"+mydate+"<br/>");}而這樣不可以呢?var txt=document.getElementById("txt").value;function fn(){var mydate =new Date();mydate.setTime(mydate.getTime()+txt*60*60*1000);document.write("延遲后的時(shí)間為:"+mydate+"<br/>");}
函數(shù)能使用函數(shù)以外的變量嗎?
慕前端4105395
2017-08-08 17:14:03