小编Cas*_*dra的帖子

JavaScript 图像在 onmouseover 和 onmouseout 时闪烁

我正在尝试将鼠标悬停在弹出的默认图像的更大图像上。但是,每当我将鼠标悬停在较小的图像上时,它就会弹出,但是当我将鼠标悬停在弹出图像上时,它会继续闪烁。

下面是我的代码:

HTML:

<div class="thumbnail" id="thumbnail1">
    <img src="image1.jpg" onmouseover="enlarge1()" onmouseout="minimize1()"/>            
</div>
Run Code Online (Sandbox Code Playgroud)

JS:

function enlarge1() {
    var parent = document.getElementById("thumbnail1");
    var child = document.createElement("IMG");
    child.setAttribute("src", "image-large1.jpg");
    child.setAttribute("width", "350%");
    child.setAttribute("alt", "Related Large 1");
    child.style.position="absolute";
    child.style.zIndex="1";
    child.style.bottom="15%";
    child.style.left="30%";

    parent.appendChild(child);

}

function minimize1() {
    var parent = document.getElementById("thumbnail1");
    var child = parent.lastElementChild;
    parent.removeChild(child);
}
Run Code Online (Sandbox Code Playgroud)

html javascript

2
推荐指数
1
解决办法
3840
查看次数

在 While 循环中打印字典

我一直在环顾四周,看看是否有人真的这样做过,但找不到,所以希望我能在这里得到一些帮助。

newDict = {'Jan':31, 'Feb':29, 'Mar':31, 'Apr':30, 'May':31, 'Jun':30, 'Jul':31, 'Aug':30}
Run Code Online (Sandbox Code Playgroud)

我创建了这个 dict,我想使用while循环以这种方式输出它:

Jan 31
Feb 29
Mar 31
Apr 30
May 31
Jun 30
Jul 31
Aug 30
Run Code Online (Sandbox Code Playgroud)

我可以用for循环来完成,只是好奇如何用while循环来完成。

python python-2.7

0
推荐指数
1
解决办法
4218
查看次数

标签 统计

html ×1

javascript ×1

python ×1

python-2.7 ×1