用户登录
用户注册

分享至

node.js获取word字体

  • 作者: 嗳祢莪等祢
  • 来源: 51数据库
  • 2020-04-21

请问JavaScript如何获取本地系统的所有字体

保存以下HTML并在IE下浏览,仅供参考,思路是一样的

——————————

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE>; 获取当前系统字体和排版样式</TITLE>

<SCRIPT LANGUAGE="JavaScript">

<!--

function getSystemFonts(){

var a=dlgHelper.fonts.count;

var fArray = new Array();

var oDropDown = document.all.fonts;

for (i = 1;i < dlgHelper.fonts.count;i++){

fArray[i] = dlgHelper.fonts(i);

var aOptions = oDropDown.options;

var oOption = document.createElement("OPTION");

aOptions.add(oOption);

oOption.text = fArray[i];

oOption.Value = i;

}

}

function getBlockFormats(){

var a=dlgHelper.blockFormats.count;

var fArray = new Array();

var oDropDown = document.all.formats;

oDropDown.setAttribute("id","FormatList");

for (i = 1;i < dlgHelper.blockFormats.count;i++)

{

fArray[i] = dlgHelper.blockFormats(i);

var aOptions = oDropDown.options;

var oOption = document.createElement("OPTION");

aOptions.add(oOption);

oOption.text = fArray[i];

oOption.Value = i;

}

}

//-->

</SCRIPT>

</HEAD>

<BODY onload="getSystemFonts();getBlockFormats()">

系统字体和排版样式 SystemFont and BlockFormats<BR>

<Select NAME="fonts" onchange="document.body.style.fontFamily = this.options[this.selectedIndex].text">

</Select>

<Select NAME="formats" onchange="document.body.style.fontFamily = this.options[this.selectedIndex].text">

</Select>

<OBJECT ID=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" WIDTH="0px" HEIGHT="0px"></OBJECT>

</BODY>

</HTML>

【急】获取js输出的页面文字

按照你说的,我猜测啊,看到的应该是一句代码<script src="XX.js" ,对不?你设法在XX.js中找到JS动态写文字的容器对象。

一般写js文字就两种可能1、innerHTML 2、document.write 你查找一下 容器对象的ID这样就可以获取里边的文字了。比如,obj.text还有一种终极的解决办法:在页面上嵌入目标iframe, id= a,然后设为display=false,输出字符为:document.write(window.top.a.document.documentElement.innerText。

node什么可以获取到js文件下面所有的js

var fs = require('fs'), stdin = process.stdin, stdout = process.stdout;var stats = [];fs.readdir(process.cwd(), function(err, files) { console.log(' '); if (!files.length) { return console.log(' \033[31m No files to show!\033[39m\n'); } function file(i) { var filename = files[i]; fs.stat(__dirname + '/' + filename, function(err, stat) { stats[i] = stat; if (stat.isDirectory()) { console.log(' ' + i + ' \033[36m' + filename + '/\033[39m'); } else { console.log(' ' + i + ' \033[90m' + filename + '\033[39m'); } i++; if (i == files.length) { read(); } else { file(i); } }); } function read() { console.log(' '); stdout.write(' \033[33mEnter your choice : \033[39m'); stdin.resume(); stdin.setEncoding('utf8'); stdin.on('data', option); } function option(data) { var filename = files[Number(data)]; if (!files[Number(data)]) { stdout.write(' \033[mEnter your choice : \033[39m'); } else if (stats[Number(data)].isDirectory()) { fs.readdir(__dirname + '/' + filename, function(err, files) { console.log(' '); console.log(' (' + files.length + 'files)'); files.forEach(function(file) { console.log(' - ' + file); }); console.log(' '); }); } else { stdin.pause(); fs.readFile(__dirname + '/' + filename, 'utf8', function(err, data) { console.log(' '); console.log('\033[90m' + data.replace(/(.*) /g, ' $1') + '\033[39m'); }); } } file(0);});。

转载请注明出处51数据库 » node.js获取word字体

软件
前端设计
程序设计
Java相关