Javascript f(ie5 | | nn6){ 如果(ie5)cs=2,th=30; 否则cs=0,th=20; document.write( ""+ ""+ ""+ ""+ ""+ ""+ " "+ ""+ ""+ ""+ "" ); } 文件。填写(“”); 函数leftJsConfirm(){ document.getElementById('jsconfirm').style.top=-1000; document.location.href=leftJsConfirmUri; } 函数rightJsConfirm(){ document.getElementById('jsconfirm').style.top=-1000; document.location.href=rightJsConfirmUri; } 函数confirmAlternative(){ if(确认(“Scipt需要更好的浏览器!”)document.location.href=”http://www.mozilla.org"; } leftJsConfirmUri=''; rightJsConfirmUri=''; /** *显示消息/确认框 */ 函数showConfirm(confirmtitle、confirmcontent、confirmlefttext、confirmlefturi、confirmrighttext、con firmrighturi){ document.getElementById(“jsconfirmtitle”).innerHTML=confirmtitle; document.getElementById(“jsconfirmcontent”).innerHTML=confirmcontent; document.getElementById(“jsconfirmleft”).value=confirmlefttext; document.getElementById(“jsconfirmright”).value=confirmrighttext; leftJsConfirmUri=confirmlefturi; rightJsConfirmUri=confirmrighturi; xConfirm=xConfirmStart,yConfirm=yConfirmStart; 如果(ie5){ document.getElementById(“jsconfirm”).style.left='25%'; document.getElementById(“jsconfirm”).style.top='35%'; } 若否(nn6){ document.getElementById(“jsconfirm”).style.top='25%'; document.getElementById(“jsconfirm”).style.left='35%'; } else confirmAlternative();

Javascript f(ie5 | | nn6){ 如果(ie5)cs=2,th=30; 否则cs=0,th=20; document.write( ""+ ""+ ""+ ""+ ""+ ""+ " "+ ""+ ""+ ""+ "" ); } 文件。填写(“”); 函数leftJsConfirm(){ document.getElementById('jsconfirm').style.top=-1000; document.location.href=leftJsConfirmUri; } 函数rightJsConfirm(){ document.getElementById('jsconfirm').style.top=-1000; document.location.href=rightJsConfirmUri; } 函数confirmAlternative(){ if(确认(“Scipt需要更好的浏览器!”)document.location.href=”http://www.mozilla.org"; } leftJsConfirmUri=''; rightJsConfirmUri=''; /** *显示消息/确认框 */ 函数showConfirm(confirmtitle、confirmcontent、confirmlefttext、confirmlefturi、confirmrighttext、con firmrighturi){ document.getElementById(“jsconfirmtitle”).innerHTML=confirmtitle; document.getElementById(“jsconfirmcontent”).innerHTML=confirmcontent; document.getElementById(“jsconfirmleft”).value=confirmlefttext; document.getElementById(“jsconfirmright”).value=confirmrighttext; leftJsConfirmUri=confirmlefturi; rightJsConfirmUri=confirmrighturi; xConfirm=xConfirmStart,yConfirm=yConfirmStart; 如果(ie5){ document.getElementById(“jsconfirm”).style.left='25%'; document.getElementById(“jsconfirm”).style.top='35%'; } 若否(nn6){ document.getElementById(“jsconfirm”).style.top='25%'; document.getElementById(“jsconfirm”).style.left='35%'; } else confirmAlternative();,javascript,alert,Javascript,Alert,} 当您启动或刚刚加入一个基于webapplications的项目时,界面的设计可能很好。否则这应该改变。为了开发Web2.0应用程序,您将使用动态内容、许多效果和其他内容。所有这些都很好,但是没有人考虑过如何设置JavaScript警报和确认框的样式。 这是他们的方式,。。完全动态,JS和CSS驱动 创建简单的html文件 <html> <head> <title>jsConfirmSyle</title> <meta htt

}


当您启动或刚刚加入一个基于webapplications的项目时,界面的设计可能很好。否则这应该改变。为了开发Web2.0应用程序,您将使用动态内容、许多效果和其他内容。所有这些都很好,但是没有人考虑过如何设置JavaScript警报和确认框的样式。 这是他们的方式,。。完全动态,JS和CSS驱动 创建简单的html文件

<html>
 <head>
   <title>jsConfirmSyle</title>
   <meta http-equiv="Content-Style-Type" content="text/css" />
   <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <script type="text/javascript" src="jsConfirmStyle.js"></script>
    <script type="text/javascript">

      function confirmation() {
       var answer = confirm("Wanna visit google?")
       if (answer){
       window.location = "http://www.google.com/";
       }
     }    

    </script>
    <style type="text/css">
     body {
      background-color: white;
      font-family: sans-serif;
      }
    #jsconfirm {
      border-color: #c0c0c0;
      border-width: 2px 4px 4px 2px;
      left: 0;
     margin: 0;
     padding: 0;
     position: absolute;
    top: -1000px;
    z-index: 100;
   }

  #jsconfirm table {
   background-color: #fff;
   border: 2px groove #c0c0c0;
   height: 150px;
   width: 300px;
  }

   #jsconfirmtitle {
  background-color: #B0B0B0;
  font-weight: bold;
  height: 20px;
  text-align: center;
}

 #jsconfirmbuttons {
height: 50px;
text-align: center;
 }

#jsconfirmbuttons input {
background-color: #E9E9CF;
color: #000000;
font-weight: bold;
width: 125px;
height: 33px;
padding-left: 20px;
}

#jsconfirmleft{
background-image: url(left.png);
}

#jsconfirmright{
background-image: url(right.png);
 }
 < /style>
  </head>
 <body>
<p><br />
<a href="#"
onclick="javascript:showConfirm('Please confirm','Are you really really sure to visit    google?','Yes','http://www.google.com','No','#')">JsConfirmStyled</a></p>
<p><a href="#" onclick="confirmation()">standard</a></p>

</body>
</html>

jsConfirmSyle
功能确认(){
var answer=确认(“想访问谷歌吗?”)
若有(答复){
window.location=”http://www.google.com/";
}
}    
身体{
背景色:白色;
字体系列:无衬线;
}
#jsconfirm{
边框颜色:#C0;
边框宽度:2px4px4px2px;
左:0;
保证金:0;
填充:0;
位置:绝对位置;
顶部:-1000px;
z指数:100;
}
#JS确认表{
背景色:#fff;
边框:2个凹槽#C0;
高度:150像素;
宽度:300px;
}
#jsconfirmtitle{
背景色:#B0;
字体大小:粗体;
高度:20px;
文本对齐:居中;
}
#JsconfirButtons{
高度:50px;
文本对齐:居中;
}
#JSconfirButtons输入{
背景色:#E9E9CF;
颜色:#000000;
字体大小:粗体;
宽度:125px;
高度:33像素;
左侧填充:20px;
}
#jsconfirmleft{
背景图片:url(left.png);
}
#jsconfirmright{
背景图片:url(right.png);
}


然后创建简单的js文件名jsConfirmStyle.js。下面是简单的js代码

ie5=(document.getElementById&&document.all&&document.styleSheets)?1:0;
nn6=(document.getElementById&&!document.all)?1:0;

 xConfirmStart=800;
 yConfirmStart=100;

  if(ie5||nn6) {
  if(ie5) cs=2,th=30;
  else cs=0,th=20;
   document.write(
    "<div id='jsconfirm'>"+
        "<table>"+
            "<tr><td id='jsconfirmtitle'></td></tr>"+
            "<tr><td id='jsconfirmcontent'></td></tr>"+
            "<tr><td id='jsconfirmbuttons'>"+
                "<input id='jsconfirmleft' type='button' value='' onclick='leftJsConfirm()' onfocus='if(this.blur)this.blur()'>"+
                "&nbsp;&nbsp;"+
                "<input id='jsconfirmright' type='button' value='' onclick='rightJsConfirm()' onfocus='if(this.blur)this.blur()'>"+
            "</td></tr>"+
        "</table>"+
    "</div>"
  );
   }

 document.write("<div id='jsconfirmfade'></div>");


 function leftJsConfirm() {
  document.getElementById('jsconfirm').style.top=-1000;
  document.location.href=leftJsConfirmUri;
 }
function rightJsConfirm() {
document.getElementById('jsconfirm').style.top=-1000;
document.location.href=rightJsConfirmUri;
 }
function confirmAlternative() {
if(confirm("Scipt requieres a better browser!"))       document.location.href="http://www.mozilla.org";
}

leftJsConfirmUri = '';
rightJsConfirmUri = '';

  /**
   * Show the message/confirm box
  */
    function       showConfirm(confirmtitle,confirmcontent,confirmlefttext,confirmlefturi,confirmrighttext,con      firmrighturi)  {
document.getElementById("jsconfirmtitle").innerHTML=confirmtitle;
document.getElementById("jsconfirmcontent").innerHTML=confirmcontent;
document.getElementById("jsconfirmleft").value=confirmlefttext;
document.getElementById("jsconfirmright").value=confirmrighttext;
leftJsConfirmUri=confirmlefturi;
rightJsConfirmUri=confirmrighturi;
xConfirm=xConfirmStart, yConfirm=yConfirmStart;
if(ie5) {
    document.getElementById("jsconfirm").style.left='25%';
    document.getElementById("jsconfirm").style.top='35%';
}
else if(nn6) {
    document.getElementById("jsconfirm").style.top='25%';
    document.getElementById("jsconfirm").style.left='35%';
}
else confirmAlternative();
ie5=(document.getElementById&&document.all&&document.styleSheets)?1:0;
nn6=(document.getElementById&&!document.all)?1:0;
xConfirmStart=800;
yConfirmStart=100;
如果(ie5 | | nn6){
如果(ie5)cs=2,th=30;
否则cs=0,th=20;
document.write(
""+
""+
""+
""+
""+
""+
"  "+
""+
""+
""+
""
);
}
文件。填写(“”);
函数leftJsConfirm(){
document.getElementById('jsconfirm').style.top=-1000;
document.location.href=leftJsConfirmUri;
}
函数rightJsConfirm(){
document.getElementById('jsconfirm').style.top=-1000;
document.location.href=rightJsConfirmUri;
}
函数confirmAlternative(){
if(确认(“Scipt需要更好的浏览器!”)document.location.href=”http://www.mozilla.org";
}
leftJsConfirmUri='';
rightJsConfirmUri='';
/**
*显示消息/确认框
*/
函数showConfirm(confirmtitle、confirmcontent、confirmlefttext、confirmlefturi、confirmrighttext、con firmrighturi){
document.getElementById(“jsconfirmtitle”).innerHTML=confirmtitle;
document.getElementById(“jsconfirmcontent”).innerHTML=confirmcontent;
document.getElementById(“jsconfirmleft”).value=confirmlefttext;
document.getElementById(“jsconfirmright”).value=confirmrighttext;
leftJsConfirmUri=confirmlefturi;
rightJsConfirmUri=confirmrighturi;
xConfirm=xConfirmStart,yConfirm=yConfirmStart;
如果(ie5){
document.getElementById(“jsconfirm”).style.left='25%';
document.getElementById(“jsconfirm”).style.top='35%';
}
若否(nn6){
document.getElementById(“jsconfirm”).style.top='25%';
document.getElementById(“jsconfirm”).style.left='35%';
}
else confirmAlternative();
}


您可以做一些调整,在顶部留下一个空行

像这样

        <script type="text/javascript" >
            alert("USER NOTICE "  +"\n"
            +"\n"
            +"New users are not allowed to work " +"\n"
            +"with that feature.");
        </script>

警报(“用户通知”+“\n”
+“\n”
+不允许新用户使用“+”\n
+“有那个特征。”);

您可以做一些调整,在顶部留下一个空行

像这样

        <script type="text/javascript" >
            alert("USER NOTICE "  +"\n"
            +"\n"
            +"New users are not allowed to work " +"\n"
            +"with that feature.");
        </script>

警报(“用户通知”+“\n”
+“\n”
+不允许新用户使用“+”\n
+“有那个特征。”);
我在自定义标题框javascript中找到了这个

比如说

swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
我在自定义标题框javascript中找到了这个

比如说

swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});

当我想要更改默认确认框的框标题和按钮标题时,我遇到了类似的问题。我选择了jQueryUI对话框插件

当我有以下情况时:

function testConfirm() {
  if (confirm("Are you sure you want to delete?")) {
    //some stuff
  }
}
我已将其更改为:

function testConfirm() {

  var $dialog = $('<div></div>')
    .html("Are you sure you want to delete?")
    .dialog({
      resizable: false,
      title: "Confirm Deletion",
      modal: true,
      buttons: {
        Cancel: function() {
          $(this).dialog("close");
        },
        "Delete": function() {
          //some stuff
          $(this).dialog("close");
        }
      }
    });

  $dialog.dialog('open');
}
函数testConfirm(){
变量$dialog=$('')
.html(“确实要删除吗?”)
.对话({
可调整大小:false,
        <script type="text/javascript" >
            alert("USER NOTICE "  +"\n"
            +"\n"
            +"New users are not allowed to work " +"\n"
            +"with that feature.");
        </script>
swal({
  title: "Are you sure?",
  text: "You will not be able to recover this imaginary file!",
  type: "warning",
  showCancelButton: true,
  confirmButtonColor: "#DD6B55",
  confirmButtonText: "Yes, delete it!",
  closeOnConfirm: false
},
function(){
  swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
function testConfirm() {
  if (confirm("Are you sure you want to delete?")) {
    //some stuff
  }
}
function testConfirm() {

  var $dialog = $('<div></div>')
    .html("Are you sure you want to delete?")
    .dialog({
      resizable: false,
      title: "Confirm Deletion",
      modal: true,
      buttons: {
        Cancel: function() {
          $(this).dialog("close");
        },
        "Delete": function() {
          //some stuff
          $(this).dialog("close");
        }
      }
    });

  $dialog.dialog('open');
}