如何在网页上实现windows风格的颜色选择器? 直接用CommonDialog控件或者ExecWB()都可以 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <body onload="Init()"><object id=dlgHelper classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px"></object><object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331"><PARAM NAME="LPKPath" VALUE="comdlg.lpk"></object><object id="cDialog" width="0px" height="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab"></object><label id=z>字体:</label><select id=zt style="width:200" onchange="z.style.fontFamily = this.options[this.selectedIndex].text"></select><br><label id=l1>颜色:</label><input type=button onclick="changeColor();" value="chage color"><label>信息:</label><textarea id=xx style="background-color:red;width:100;height:100">nothing</textarea><input type=button value=save onclick="saveDoc()"><input type=button value=load onclick="loadDoc()"><input type=button value=printer onclick="print()"><script>function Init(){ var i=dlgHelper.fonts.count; var opt=""; for(var j=1;j<i;j++) { opt+="<option>"+dlgHelper.fonts(j)+"</option>"; var o=document.createElement("option"); zt.insertAdjacentElement("afterBegin",o); o.text=dlgHelper.fonts(j); } }function changeColor(sInitColor){ if(sInitColor==null) var sColor=dlgHelper.ChooseColorDlg(); else var sColor=dlgHelper.ChooseColorDlg(sInitColor); sColor=sColor.toString(16); if(sColor.length<6) { var sTempString="000000".substring(0,6-sColor.length); sColor=sTempString.concat(sColor); } l1.style.backgroundColor=sColor;}function loadDoc(){ cDialog.CancelError=true; try{ cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"; cDialog.ShowOpen(); var fso=new ActiveXObject("Scripting.FileSystemObject"); var reading=1; var f=fso.OpenTextFile(cDialog.filename,reading); alert(f); var r=f.ReadAll(); f.close(); xx.value=r; }catch(e){}}function saveDoc(){ cDialog.CancelError=true; try{ cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"; cDialog.ShowSave(); var fso=new ActiveXObject("Scripting.FileSystemObject"); var f=fso.CreateTextFile(cDialog.filename,true); f.write(xx.value); f.Close(); } catch(e){}}function print(){ try{ cDialog.CancelError=true; cDialog.ShowPrinter(); }catch(e){}}</script></body> 我都不知道哪里去找你们所说的组件了clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b这个组件哪里有的载? 晕,原来clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b 要放在<body></body>中间的,怪不得我运行的时候都找不到对象 javaScript中使用占位符或者其余方法解决 奇怪的问题,让JS代码失效 关闭和开启Windows 监视器 一到难题 不知道谁会???????????? 如何判断读到Excel文件的最后一行? 中文字和数字的高度 如何用js脚本设置ie的“检查所存网页的最新版本”这个属性? 用哪个热键作为运行程序的快捷键好? 百度地图如何清除指定的覆盖物? webpack 采用html-webpack-plugin生成的html,通过script src关联相应的js,但却404,可是这个js文件明明存在的 #如何由table 生成一个xml ? 为什么window.onresize会触发好几次?
<object id=dlgHelper classid="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" width="0px" height="0px">
</object>
<object classid="clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<PARAM NAME="LPKPath" VALUE="comdlg.lpk">
</object>
<object id="cDialog" width="0px" height="0px" classid="clsid:F9043C85-F6F2-101A-A3C9-08002B2F49FB" codebase="http://activex.microsoft.com/controls/vb5/comdlg32.cab">
</object>
<label id=z>字体:</label><select id=zt style="width:200" onchange="z.style.fontFamily = this.options[this.selectedIndex].text"></select><br>
<label id=l1>颜色:</label><input type=button onclick="changeColor();" value="chage color">
<label>信息:</label><textarea id=xx style="background-color:red;width:100;height:100">nothing</textarea><input type=button value=save onclick="saveDoc()"><input type=button value=load onclick="loadDoc()">
<input type=button value=printer onclick="print()">
<script>
function Init()
{
var i=dlgHelper.fonts.count;
var opt="";
for(var j=1;j<i;j++)
{
opt+="<option>"+dlgHelper.fonts(j)+"</option>";
var o=document.createElement("option");
zt.insertAdjacentElement("afterBegin",o);
o.text=dlgHelper.fonts(j);
}
}
function changeColor(sInitColor)
{
if(sInitColor==null)
var sColor=dlgHelper.ChooseColorDlg();
else
var sColor=dlgHelper.ChooseColorDlg(sInitColor);
sColor=sColor.toString(16);
if(sColor.length<6)
{
var sTempString="000000".substring(0,6-sColor.length);
sColor=sTempString.concat(sColor);
}
l1.style.backgroundColor=sColor;
}
function loadDoc()
{
cDialog.CancelError=true;
try{
cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt";
cDialog.ShowOpen();
var fso=new ActiveXObject("Scripting.FileSystemObject");
var reading=1;
var f=fso.OpenTextFile(cDialog.filename,reading);
alert(f);
var r=f.ReadAll();
f.close();
xx.value=r;
}catch(e){}
}
function saveDoc()
{
cDialog.CancelError=true;
try{
cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt";
cDialog.ShowSave();
var fso=new ActiveXObject("Scripting.FileSystemObject");
var f=fso.CreateTextFile(cDialog.filename,true);
f.write(xx.value);
f.Close();
}
catch(e){}
}
function print()
{
try{
cDialog.CancelError=true;
cDialog.ShowPrinter();
}catch(e){}
}
</script>
</body>