css+js修改加上一个关闭浮动窗口的按钮,加赏20财富值!

html-css013

css+js修改加上一个关闭浮动窗口的按钮,加赏20财富值!,第1张

加一个关闭按钮你应该可以自己搞定吧~就是在那个“-”号旁边再加一个按钮,然后这个按钮的功能这样写:

<div onclick="close()">关闭</div>

JS部分:

function close(){

document.getElementById("你这个浮动窗口的ID,例子中为extbkbox").style.display="none"

}

这样就关闭了~

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:

button {border:0width: 200pxheight: 80pxbackground-color: gainsborocursor: not-allowed}

3、浏览器运行index.html页面,此时通过css实现了按钮的禁用样式。

<style type="text/css">

.box {

position: relative

display: inline-block

}

.box .clear {

position: absolute

top: 0

right: 0

width: 16px

height: 16px

border: 1px solid #999

}

</style>

<div class="box">

<img src="images/testing.jpg" width="300" height="300" alt="" />

<div class="clear" onclick="this.parentNode.style.display='none'">X</div>

</div>