❶ js中用confirm("str")弹出的消息框怎么设置按钮的文本
没办法设置,那个文本是系统设定的,你用不同的操作系统可能会有所差别。
你要设置,你就用弹出层的方法。模拟出那样的一个效果。
❷ js confirm怎么实现自定义标题
这是浏览器自带的,无法修改,可以用插件实现自定义提示,如art.dialog
❸ vue.js中confirm怎样实现
<template>
<divclass="confirm">
<divclass="shade"></div>
<divclass="content">
<divclass="top">提示</div>
<divclass="center">{{title}}</div>
<divclass="bottom">
<buttonv-on:click="clickBtn(true)">确定</button>
<buttonv-on:click="clickBtn(false)">取消</button>
</div>
</div>
</div>
</template>
<script>
//importVuefrom'vue'
exportdefault{
name:'confirmCmp',
props:['title'],
data(){return{
}},
methods:{
clickBtn(b){
this.close();
//监听result变化,并发出通知(在angularjs中叫做广播,angularjs提供了emit,broadcast和$on服务用于向子父中传递消息)
this.$emit('result',b);
},
open(){
document.querySelector('.confirm').style.display='block'
},
close(){
document.querySelector('.confirm').style.display='none'
}
},
mounted(){
//垂直居中
varwindowHeight=window.innerHeight;
vardomObj=document.querySelector('.content');
vardomObjHeight=domObj.offsetHeight;
//console.log(domObjHeight)不知道为啥获取不到高
vartop=windowHeight/2-77;
domObj.style.top=top+'px';
},
install(Vue){//核心部分,在我们使用Vue.use()时,自动调用的是install,而install导出的必须是的组件
//console.log('confirmCmpInstall');
Vue.component('confirmCmp',this);
}
}
</script>
<style>
.confirm{display:none;
position:fixed;z-index:1;width:100%;
height:100%;
}
.shade{
position:fixed;
z-index:2;
background-color:rgb(0,0,0);
opacity:0.3;
width:100%;
height:100%;
}
.content{
background-color:white;
z-index:3;
width:260px;
margin:auto;
position:relative;
left:0;right:0;
}
.top{
padding-left:20px;
background:#f6f6f6;
/*color:#212a31;*/
font-size:16px;
font-weight:700;
height:46px;
line-height:46px;
border-bottom:1pxsolid#D5D5D5;
}
.center{
padding:20px;
line-height:20px;
font-size:14px;
}
.bottom{
border-top:1pxsolid#D5D5D5;
text-align:center;
height:46px;
line-height:46px;
background:#f6f6f6;}
.bottombutton{width:60px;border:none;height:30px;display:inline-block;}
.bottombutton:first-child{background-color:#1E9FFF;color:white;margin-right:3px}
.bottombutton:last-child{margin-left:3px}
</style>
<!--插件开发教程-->
<!--https://cn.vuejs.org/v2/guide/plugins.html-->
<!--此办法行不通
http://www.cnblogs.com/yufann/p/Vue-Node8.html-->
❹ 浏览器JS环境中,如何异步使用原生confirm
1、让视频在困败confirm前最小化。youku就是这么做的吧,反正老是提示登陆的时候弹出来。
2、用其他语言实现汪早颤confirm,而不是javascript。试试flash,silverlight之类的能不能搞定。不行自己搞个浏览器插件睁野弹confirm。
❺ 我 怎么使用jquery.plugins.js插件
jQuery插件 要使用它的话 通常插件中都有demo或者api可以查阅
通常jQuery插件为了减小体积 会发布两个版本 XXX.js和XXX.min.js
如果你要修改插件需要使用XXX.js文件
首先 你要知道它怎么用,先有一个可用的demo(没有demo就自己写一个),然后用webkit内核或firefox进行断点查看,这主要是为了找插件入口点,当然 你也可以直接查看js代码 这需要一定的底子
最后 就是慢慢查看他的代码的实现功能了,先得看懂他是怎么实现的,然后你才会知道怎么改.
jQuery插件我也写的不少 像 模拟alert/confirm/prompt 错误信息提示框 模拟弹出窗体 无缝marquee滚动 分页控件 拖拽控件等等
jQuery插件的框架写法通常是
(function($){
$.fn.extend({
fnKey:function(){}
})
//或者
$.fn.fnKey=function(){}
})(jQuery)
上面的两种写法的调用 方式 是
$("XXX").fnKey()进行调用的
还有一种写法:
var fnClass = function(){
this.fnKey=function(){
}
this.props="";
}
这种写法是的调用 方式是
fnClass obj = new fnClass();
obj.fnKey();
第二种写法是js的面向对象编程 得自己慢慢的理解哈
❻ vue提示弹窗插件(alert、confirm、msg)
-moles:放置禅歼模茄袭顷块的文件夹,里面有一个 alert 文件夹,用于存放 alert 插件 ;
-Alert.vue:就是我们要在多处用到提示弹窗组件;
-index.js:对于该自颤陆定义插件的一些配置;
1.alert
2.confirm
原文 https://blog.csdn.net/sinat_40697723/article/details/106036056
❼ js 中confirm的用法
confirm() 方法用于显示一个带有指定消息和OK 及取消按钮的对话框。
如果用户点击确定按钮,则confirm() 返回true。如果点击取消按钮,则confirm() 返回false。
在用户点击确定按钮或取消按钮把对话框关闭之前,它将阻止用户对浏览器的所有输入。在调用confirm() 时,将暂停对JavaScript 代码的执行,在用户作出响应之前,不会执行下一条语句。
下面我们通过这两个小例子,来了解一下它的使用方法吧:
<html>
<head>
<title>confrim的使用方法</title>
<scripttype="text/javascript">
functionclear1()
{
if(confirm("确定要清空数据吗?"))
{
document.main.text1.value="";
}
}
</script>
</head>
<boty>
<formname="main">
<inputtype="text"name="text1"/>
<inputtype="button"name="submit"value="数据清空"onclick="returnclear1()"/>
</form>
</body>
</html>
❽ jquery 模拟 confirm 要求使用方法和 window.confirm 一样
$.confirm = function(msg,func1,func2,w,h) ;
function Confirm(msg,func1,func2,w,h){
var opts = };
//这里还可以判断msg的长度进行排版,并调整弹出框的大小
install(window.top, opts);
$.DialogData.dialogDiv.find("div[id^='_DialogButtons_']").css('text-align','center')
var win = topWin.$.DialogData.iframeObj.attr('contentWindow');
var doc = win.document;
doc.open();
doc.write("<body></body>") ;
var arr = [];
arr.push("<div><table height='100%' border='0' align='center' cellpadding='10' cellspacing='0'>");
arr.push("<tr><td align='center'><img id='Icon' src='../images/icon_query.gif' width='34' height='34' align='absmiddle'></td>");
arr.push("<td align='left' id='Message' style='font-size:9pt'>"+msg+"</td></tr></table></div>");
var div = $(arr.join(''),doc.body);
$(doc.body).append(div);
doc.close();
//设置响应函数
//如果传递响应函数则执行,否则仅关闭窗口
$.DialogData.dialogDiv.find("input[id^='_ButtonOK_']").bind("click", function() {
$.unfunkyUI();
if(func1){
func1();
}
})
$.DialogData.dialogDiv.find("input[id^='_ButtonCancel_']").bind("click", function() {
if(func2){
func2();
}
}) ;
}
})(jQuery);
❾ js confirm 怎么修改它的按钮
这个是修改不到的!
那个按钮是浏览器本身的运行机制决定的!
如果你觉得针对js confirm本身的按钮可以进行修改的话,那你只能修改浏览器程序!
当然,你觉得那按钮难看的话,你可以使用别的js插件
❿ javascript confirm用法
用法一:主要用于删除单条信息确认。
<SCRIPT LANGUAGE=javascript>
function del() {
var msg = "您真的确定要删除吗? 请确认!";
if (confirm(msg)==true){
return true;
}else{
return false;
}
}
</SCRIPT>
调用方法:
<a href="del.php?id=123" onclick="javascript:return del()">删 除</a>
用法二:原理跟用法一的一样。JavaScript删除确认框 。
<a href="javascript:if(confirm('确实要删除吗?'))location='jb51.php?id='">删除</a>
用法三:主要用于批量删除的确认提示 。
<input name="Submit" type="submit" class="inputedit" value="删除"
onclick="{if(confirm('确定纪录吗?')){
this.document.formname.submit();
return true;}return false;
}">
<input name="按钮" type="button" ID="ok" onclick="{if(confirm('确定删除吗?')){
window.location='Action.asp?Action=Del&
TableName=Item&
ID=<%=ID%>';
return true;
}return false;}"
value="删除栏目" />
(10)jsconfirm插件扩展阅读:
confirm参数message:
1、confirm()函数中的参数是确认框的提示语。
2、此函数返回值是布尔型的,点击确定,返回值为true,点击取消返回值为false。
3、confirm快速调用:
<a<a target
="_blank" href
="/item/href/7779531" data-lemmaid
="7779531">href</a>
="#"onclick
="returnconfirm('是否打开链接');"><inputtype
="button"value
="链接"/></a>
注:点击链接后,在弹出对话方块中,如果点击“确定”那么就进入超链接所连接的地址;如果点击“取消”不执行链接。