<?xml version="1.0" encoding="gb2312"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!--<meta http-equiv="refresh" content="10"> --> <title>活体扫描</title> </head> <BODY bgcolor="#66CCFF"> <style type="text/css"> #outerBox{ width:90px; height:50px; border:1px black solid; text-align:center; font-size:20px; color:red; background-color:#66CCFF; line-height:90px; float: left; margin-right:20px; margin-bottom:20px; /* 下间距 */ } </style> <object CLASSID="CLSID:686AC84F-27DE-49F9-92AD-2CDA68C419F2" WIDTH=642 HEIGHT=690 CODEBASE="file:///C:/bag/scan.CAB" ID="scanfigner"></object> <script type="text/javascript" language="javascript"> //得到图片路径 function getpath() { var theResult; theResult=scanfigner.GetImgPath(1,1); document.getElementById("preImg").src=theResult; } function getpath10() { var theResult; theResult=scanfigner.GetImgPath(1,10); var myImg = document.getElementById("outerBox"); myImg.style.cssText="background:url('theResult')"; } //执行扫描 获取指纹 function scan() { scanfigner.ExeScan(1,1); } //通过写路径来显示图片 function clickdiv(){ var myImg = document.getElementById("outerBox"); myImg.style.cssText="background:url('rr.jpg')"; } </script> <form action="" method="post"> <div id="outerBox" onclick="clickdiv();">右拇</div> <div id="outerBox">右食</div> <div id="outerBox">右中</div> <div id="outerBox">右环</div> <div id="outerBox">右小</div> <div style="clear:both;"></div> <div id="outerBox">左拇</div> <div id="outerBox">左食</div> <div id="outerBox">左中</div> <div id="outerBox">左环</div> <div id="outerBox" onclick="getpath10();">左小</div> <input type="button" name="submit" value="扫 描" onclick=scan()> <input type="submit" name="submit" value="提 交"> </form> </BODY> </html>
1。这个方法getpath10()中theResult是一个路径。能打印出来。我这样赋值对么?我得不到呀。
2。我把#换成.行么?用class显示图片有问题呀。
问题补充:
我想在GetImgPath()个方法中得到路径
function getpath()
{
var theResult;
theResult=scanfigner.GetImgPath(1,1);
document.getElementById("preImg").src=theResult;
}这个方法不要了。
问题补充:
我在这里没得到。事件没反应呀?
function getpath10()
{
var theResult;
theResult=scanfigner.GetImgPath(1,10);
var myImg = document.getElementById("outerBox");
myImg.style.cssText="background:url('theResult')";
}
问题补充:
function getpath10()
{
var theResult;
theResult=scanfigner.GetImgPath(1,10);
alert(theResult);
document.getElementById("outerBox").style.cssText="background:url('theResult')";
}
alert()能得到路径。,不知道下面那句话对不对?
问题补充:
哈哈 我不会改ID?playfish (资深程序员)我改了,不对。我改错了。
问题补充:
是,前几天实现了。但需求变了。用样式了CSS。
document.getElementById("outerBox").style.cssText="background:url('theResult')";
这样可以么?