JavaScript 效果

1. 遍历文件下的所有文件

<script language="java script">
? function?? fileList(){
? var filePath = "test"; //文件目录
? fso = new ActiveXObject("Scripting.FileSystemObject");??
? fldr = fso.GetFolder(filePath);??
? fc = new Enumerator(fldr.files);??
? for(; !fc.atEnd(); fc.moveNext()) { //枚举所有文件
??? s=fc.item();?? //取文件对象???????
??? f = fso.GetFile(s);?????
??? titl=s.name;????
??? alert(titl);
? }?
}
</script>

2. 选中页面上某一文本

<html>
<head>
<script language="JavaScript">
function selectItem() {
?var obj = document.getElementById("text");
?var rng = document.body.createTextRange();
? rng.moveToElementText(obj);
? rng.select();
}
</script>
</head>
<body>



?

被选中


</body>
</html>

你可能感兴趣的:(JavaScript,html,F#)