webform 光棒效果,删除操作弹出确定取消窗口

鼠标移入onmouseover和鼠标移出onmouseout,代码里没大写我这也就不大写了。那首先,我们得获取Class
为tr_item里的所有东西,也就是项标签里的数据。然后呢,我们定义一个oldColor为空,一会用来记录原来的颜色。接着,我们用for循环
把两个事件给项标签里所有的东西都附上。
<%-- 光棒效果 --%>
    <script type="text/javascript">
        window.onload = function () {
            var items = document.getElementsByClassName("t-body");
            var oldColor = "";
            for (var i = 0; i < items.length; i++) {
                items[i].onmouseover = function () {
                    oldColor = this.style.backgroundColor;
                    this.style.backgroundColor = "green";
                };
                items[i].onmouseout = function () {
                    this.style.backgroundColor = oldColor;
                };
            }
        };
</script>

用户点击删除按钮时,弹出一个确定框,如果用户点击“确定”执行删除操作,否则不执行

方法一:

<a href="javascript:if(confirm('确实要删除吗?'))location='Delete.aspx?un=<%#Eval("GoodsName")%>'">删除</a>

方法二:

JS代码:

function del() {
var msg = "您真的确定要删除吗?\n\n请确认!";
if (confirm(msg)==true){
return true;
}else{
return false;
}
}

html代码:

<a href="" onclick="javascript:return del();">删除</a>

方法三:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>确认是否删除</title> 
<script type="text/javascript"> 
function del(){ 
if(!confirm("确认要删除?")){ 
window.event.returnValue = false; 
} 
} 
</script> 
</head> 
<body> 
<a href="http://www.baidu.com" onclick="return del()">删除</a> 
</body> 
</html>

方法四:

<script type="text/javascript" language="javascript"> 
<!-- 
function confirmAct() 
{ 
  if(confirm('确定要执行此操作吗?')) 
  { 
    return true; 
  } 
  return false; 
} 
//-->
</script> 
  
<a href="operate.aspx?mod=user&act=delete&id=564" onclick="return confirmAct();">执行操作</a>

 

posted @ 2017-01-06 11:11  不会撩妹的白芒果  阅读(314)  评论(0编辑  收藏  举报