Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery jFrame不在IE中工作,但在FF中_Jquery_Css_Internet Explorer_Firefox_Printing - Fatal编程技术网

Jquery jFrame不在IE中工作,但在FF中

Jquery jFrame不在IE中工作,但在FF中,jquery,css,internet-explorer,firefox,printing,Jquery,Css,Internet Explorer,Firefox,Printing,嘿,我正在努力让这个jFrame在IE8/9中工作,因为它在FF中工作没有问题 打印图像的代码如下所示: function PrintElem(elem) { var strFrameName = ("printer-" + (new Date()).getTime()); var jFrame = $( "<iframe name='" + strFrameName + "'>" ); jFrame .css( "width", "1px" ) .css( "

嘿,我正在努力让这个jFrame在IE8/9中工作,因为它在FF中工作没有问题

打印图像的代码如下所示:

function PrintElem(elem) 
{ 
var strFrameName = ("printer-" + (new Date()).getTime());
var jFrame = $( "<iframe name='" + strFrameName + "'>" );

jFrame
    .css( "width", "1px" )
    .css( "height", "1px" )
    .css( "position", "absolute" )
    .css( "left", "-9999px" )
    .appendTo( $( "body:first" ) )
;

var objFrame = window.frames[ strFrameName ];
var objDoc = objFrame.document;
var theHTML = $(elem).html();

theHTML = theHTML.replace("display:none","display:inline"); 
objDoc.open();
objDoc.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" );
objDoc.write( "<html>" );
objDoc.write( "<body>" );
objDoc.write( "<head>" );
objDoc.write( "</head>" );
objDoc.write(theHTML);
objDoc.write( "</body>" );
objDoc.write( "</html>" );
objDoc.close();
objFrame.focus();
objFrame.print();
}
函数PrintElem(elem)
{ 
var strFrameName=(“打印机-”+(新日期()).getTime());
var jFrame=$(“”);
jFrame
.css(“宽度”、“1px”)
.css(“高度”、“1px”)
.css(“位置”、“绝对”)
.css(“左”,“-9999px”)
.appendTo($(“正文:第一个”))
;
var objFrame=window.frames[strFrameName];
var objDoc=objFrame.document;
var theHTML=$(elem.html();
theHTML=theHTML.replace(“display:none”,“display:inline”);
objDoc.open();
objDoc.write(“”);
objDoc.write(“”);
objDoc.write(“”);
objDoc.write(“”);
objDoc.write(“”);
编写(HTML);
objDoc.write(“”);
objDoc.write(“”);
objDoc.close();
objFrame.focus();
objFrame.print();
}
我开始这样做:

 <div id="printable"><IMG SRC="picturesFromServer.asp?PhotoId=310481" style="display:none;"></div>
 <IMG SRC="picturesFromServer.asp?PhotoId=310481" width="240" height="320"><br>
 </form>

 <input type="button" value="Print Division" onclick="PrintElem('#printable')" /> 


它在FF中显示页面并打印,但在IE中仅显示当前页面

我正在使用我在本网站上找到的jFrame代码:

而且帮助也太好了

大卫

试试看

jFrame.css( "opacity", "0" ).css( "height", "0px" ).appendTo($("body:first"));

它对我有用。显示:无;不会被ie识别。

看一看,它在Firefox上也能工作。@arunes:这似乎在我测试演示站点的一半时间里都不起作用。。。