当前位置: 代码迷 >> ASP.NET >> 下面这段javascript代码这样写对吗,该怎么处理
  详细解决方案

下面这段javascript代码这样写对吗,该怎么处理

热度:5644   发布时间:2013-02-25 00:00:00.0
下面这段javascript代码这样写对吗
<script>
if not (window.confirm( "continue? "))
{
  alert( "operation 1 ");
}
else
{
  alert( "operation 2 ");
}
</script>  
如果不对那该把 not放在哪

------解决方案--------------------------------------------------------
if ( ! confirm( "continue? "))


另外干嘛要not?
opration1 operation2 换个位置不行?
------解决方案--------------------------------------------------------
<script>
if (!!!window.confirm( "continue? "))
{
alert( "operation 1 ");
}
else
{
alert( "operation 2 ");
}
</script>
 

------解决方案--------------------------------------------------------
<script>
if(!window.confirm( "continue? "))
{
alert( "operation 1 ");
}
else
{
alert( "operation 2 ");
}
</script> 
没有not,C#里!号就是非的意思,所以可以这样写。
------解决方案--------------------------------------------------------
JScript code
<script>alert(window.confirm("continue?")?"operation 1 ":"operation 2 ";</script>
------解决方案--------------------------------------------------------
<script type=...>

if not (window.confirm( "continue? "))

firebug 调调
  相关解决方案