当单击窗口在图像上打开窗口以工作时,我该如何获取我的按钮,它没有调用该功能



我的功能与其高度和宽度一起获取图像。我使用窗口在新窗口中打开图像。打开我定义了一个 onclick,以便如果单击图像上的任何位置,窗口关闭,则可以正常工作。我已经定义了一个按钮,并在新窗口中的图像外面找到了它。单击该按钮时,它将调用另一个函数,这不起作用。有做这项工作的地方吗?

我尝试了几种不同的方法来制作这项工作。我尝试在单击图像时尝试删除近距离,但无效。我尝试将按钮放在图像上,但无效。

function showImg(imgSrc, H, W) { 
    newImg = window.open("", "", config = "height=" + H + ",width=" + W + "");
    newImg.document.write("<img src='" + imgSrc + "' height='" + H + "' width='" + W + "'class=photoPreview onclick='window.close()' style='position:absolute;left:0;top:0'>");
    newImg.document.write('<input type="button" id="btn_makedefault" onclick=saveMe(); style="color: black; position: absolute; left: 0; bottom: 0";title="Save Image"; value="Save"></button>');
    newImg.document.close();
    newImg.focus();
}

我希望保存按钮保存在窗口的底部,然后单击调用其他函数Sabeme((。

更改onclick = saveme((;to onClick =" opener.saveme((";而且这似乎像我需要工作的方式一样工作。感谢您的所有帮助。

'''函数showimg(imgsrc,h,w({ newimg = window.open(",",config =" height =" h ",width =" w "(; newimg.document.write("(; newimg.document.write(''(; newimg.document.close((; newimg.focus((;}'''

最新更新