2013-10-21 5 views
0

없이 내가 몇 가지 문제에 도달했다 중지 : 심지어 2 차 경고에 도달하고 있지 않다처럼FSO.CreateTextFile는 - 행동

<script language="javascript"> 
function MyFunc() 
{ 
    var str = document.getElementById("TextArea1").value; 
    alert(str); 
} 
function CreateFile() 
{ 
    //var path = document.location.substring(8, (path.length - 4)) + ".txt"; 
    var path = "z:\\file.txt"; 
    alert(path); 
    var fso = new ActiveXObject("Scripting.FileSystemObject"); 
    alert("Set FSO."); 
    var s = fso.CreateTextFile(path, true); 
    alert("Created."); 
    var str = document.getElementById("Select1").value; 
    s.write(str); 
    alert("Written."); 
    s.close(); 
} 
</script> 

보인다. 내가 아는 게 있니?

답변

0

예, 알고 있습니다. 두 개의 함수를 만들었지 만 아직 호출하지 않았습니다. 또한 스크립트 태그에서 언어는 "text/javascript"여야합니다. OK : < "()를 CreateFile를 자바 스크립트"버튼의 onclick =>

더 많은 이하, 그것은 1 차 경고,하지만 2 차하지를 반환

:

+0

나중에 호출합니다. – user2868288