动态打开新窗口中的图像 [英] Open an image in new window dynamically

查看:92
本文介绍了动态打开新窗口中的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.cs文件中做错了



Response.Write(+ ++ xx +
script:window.open(http://www.XYZ.com)>< img src = paper1 / q+ xx +。png border = 0 height = 10 width = 5 />
);



输出是一个图像,我希望在点击时,该图标在原始宽度和高度的新窗口中打开。

Where im doing wrong in .cs file

Response.Write("" + ++xx + "
script:window.open(http://www.XYZ.com)><img src=paper1/q" + xx + ".png border=0 height=10 width=5 />
");

Output is an image and i want, on click, that icon get open in new window with original width and height.

推荐答案

您需要为 window.open 指定其他参数。请参阅此处: http://www.w3schools.com/jsref/met_win_open.asp [ ^ ]
You need to specify other parameters for window.open. See here: http://www.w3schools.com/jsref/met_win_open.asp[^]


创建了一个新的aspx文件具有javascript功能。这解决了我的问题。



感谢大家的支持
created a new aspx file with function of javascript in it. That's solved my problem.

Thanks all for the support


hi试试这个功能



函数OpenMyImage(){

var isChrome = navigator.userAgent.toLowerCase()。indexOf('chrome')> -1;



var WindowObject = window.open('','_ blank','width = 816,height = 1056,toolbars = no,scrollbars = yes, status = no,resizable = yes');



var strImages =your image path;

var strHtml =< html> ; \ n< body> \ n+ strImages +\ n< / body> \ n< / html>;

WindowObject.document.writeln(strHtml);

WindowObject.document.close();

WindowObject.focus();



if(isChrome == false) ){

WindowObject.close();

}

else {

WindowObject.onload = function() {

WindowObject.close();

};

}

}
hi Try this function

function OpenMyImage() {
var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

var WindowObject = window.open('', '_blank ', 'width=816,height=1056,toolbars=no,scrollbars=yes,status=no,resizable=yes');

var strImages = "your Image path";
var strHtml = "<html>\n<body>\n" + strImages + "\n</body>\n</html>";
WindowObject.document.writeln(strHtml);
WindowObject.document.close();
WindowObject.focus();

if (isChrome == false) {
WindowObject.close();
}
else {
WindowObject.onload = function () {
WindowObject.close();
};
}
}


这篇关于动态打开新窗口中的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆