Open image in new window

后端 未结 7 978
执笔经年
执笔经年 2020-11-28 14:34

How can I open an image in a new window by using its id?

function swipe()
{   
    var largeImage = document.getElementById(\'largeImage\');
            


        
7条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 15:05

    HTML:

    
    

    JavaScript

        function test(){
        url = "https://www.google.de//images/branding/googlelogo/2x/googlelogo_color_272x92dp.png";
        img = '';
        popup = window.open();
        popup.document.write(img);                        
        popup.print();
        }
    

    Try this: https://jsfiddle.net/ne6f5axj/10/

    You have to put the url of image in an image-tag.

提交回复
热议问题