【问题标题】:Change attributes of image in a new window在新窗口中更改图像的属性
【发布时间】:2014-09-05 03:52:03
【问题描述】:

所以我有一个网页,其中包含 6 个 50x50 像素的不同图像的图像幻灯片。我想拥有它;当用户单击图像时,会弹出一个新窗口,其中包含相同的图像执行相同的操作,但将大小更改为 200x200px。有没有简单的方法可以做到这一点,我关闭了吗?

HTML:

JS: var mainImg = document.getElementById("slide");

var imgArray = ["slicedImg_01.gif", "slicedImg_02.gif", "slicedImg_03.gif",  "slicedImg_04.gif", "slicedImg_05.gif", "slicedImg_06.gif"];

var index = 0;

function imgCycle(){
mainImg.setAttribute("src", imgArray[index]);
index++;

if (index >= imgArray.length){
  index = 0;
}
}

setInterval (imgCycle,500);

function fullSize(){
  var big = window.open('assignment 1.1.html')

  document.getElementById("slide").height="200";

}

【问题讨论】:

    标签: javascript attributes onclick window.open


    【解决方案1】:

    您可以使用纯 javascript 使用窗口对象访问子元素

    var big = window.open('assignment 1.1.html')
    big.document.getElementById("slide").height="200";
    

    检查此问题及其答案,希望对您有所帮助。

    how-can-i-access-the-dom-tree-of-child-window

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-26
      • 2019-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多