兼容性已经测过:IE6\IE7\IE8\FF3\CHROME10
普通链接或按钮提示
<script> <BR>//提示消息类 <BR>var tips = { <BR>temp : {}, <BR>/*** <BR>* 弹出提示 <BR>* <BR>* @param string msg 提示文字内容 <BR>* @param string id 要弹出提示的目标对象的id,如果id错误/null/false/0则主窗口弹出 <BR>* @param int time 定时消失时间毫秒数,如果为null/0/false则不定时 <BR>* @param string color 提示内容的背景颜色格式为#000000 <BR>* @param int width 提示窗宽度,默认300 <BR>*/ <BR>show : function(msg, id, time, color, width) <BR>{ <BR>var target = this._get(id); <BR>if(!target) { id = 'window'; } <br><br>//如果弹出过则移除重新弹出 <BR>if(this._get(id+'_tips')) { this.remove(id); } <br><br>//设置默认值 <BR>msg = msg || 'error'; <BR>color = color || '#ea0000'; <BR>width = width || 300; <BR>time = time ? parseInt(time) : false; <br><br>if(id=='window') { <BR>var y = document.body.clientHeight/2+document.body.scrollTop; <BR>var x = (document.body.clientWidth-width)/2; <BR>var textAlign = 'center', fontSize = '15',fontWeight = 'bold'; <BR>} else { <BR>//获取对象坐标信息 <BR>for(var y=0,x=0; target!=null; y+=target.offsetTop, x+=target.offsetLeft, target=target.offsetParent); <BR>var textAlign = 'left', fontSize = '12',fontWeight = 'normal'; <BR>} <br><br>//弹出提示 <BR>var tipsDiv = this._create({display:'block',position:'absolute',zIndex:'1001',width:(width-2)+'px',left:(x+1)+'px',padding:'5px',color:'#ffffff',fontSize:fontSize+'px',backgroundColor:color,textAlign:textAlign,fontWeight:fontWeight,filter:'Alpha(Opacity=50)',opacity:'0.7'}, {id:id+'_text', innerHTML:msg, onclick:function(){tips.hidden(id);}}); <BR>document.body.appendChild(tipsDiv); <BR>tipsDiv.style.top = (y-tipsDiv.offsetHeight-12)+'px'; <BR>document.body.appendChild(this._create({display:'block',position:'absolute',zIndex:'1000',width:(width+10)+'px',height:(tipsDiv.offsetHeight-2)+'px',left:x+'px',top:(y-tipsDiv.offsetHeight-11)+'px',backgroundColor:color,filter:'Alpha(Opacity=50)',opacity:'0.7'}, {id:id+'_bg'})); <BR>if(id!='window') { <BR>var arrow = this._create({display:'block',position:'absolute',overflow:'hidden',zIndex:'999',width:'20px',height:'10px',left:(x+20)+'px',top:(y-13)+'px'}, {id:id+'_arrow'}); <BR>arrow.appendChild(this._create({display:'block',overflow:'hidden',width:'0px',height:'10px',borderTop:'10px solid '+color,borderRight:'10px solid #fff', borderLeft:'10px solid #fff',filter:'Alpha(Opacity=70)',opacity:'0.8'})); <BR>document.body.appendChild(arrow); <BR>} <br><br>//标记已经弹出 <BR>this.temp[id] = id; <br><br>//如果定时关闭 <BR>if(time) { setTimeout(function(){tips.hidden(id);}, time) } <br><br>return id; <BR>}, <BR>/*** <BR>* 隐藏提示 <BR>* <BR>* @param string id 要隐藏提示的id,如果要隐藏主窗口提示id为window,如果要隐藏所有提示id为空即可 <BR>*/ <BR>hidden : function(id) <BR>{ <BR>if(!id) { for(var i in this.temp) { this.hidden(i); } return; } <BR>var t = this._get(id+'_text'), d = this._get(id+'_bg'), a = this._get(id+'_arrow'); <BR>if(t) { t.parentNode.removeChild(t); } <BR>if(d) { d.parentNode.removeChild(d); } <BR>if(a) { a.parentNode.removeChild(a); } <BR>}, <BR>_create : function(set, attr) <BR>{ <BR>var obj = document.createElement('div'); <BR>for(var i in set) { obj.style[i] = set[i]; } <BR>for(var i in attr) { obj[i] = attr[i]; } <BR>return obj; <BR>}, <BR>_get : function(id) <BR>{ <BR>return document.getElementById(id); <BR>} <BR>}; <br><br><BR>window.onload = function(){ <BR>tips.show('主窗口提示-绿色-不定时-300像素', null, null, '#009900', 300); <BR>tips.show('表单报错提示-红色-3000毫秒消失-250像素', 'test', 3000, '#ea0000', 250); <BR>} <BR>document.onclick = function(){ <BR>tips.hidden(); <BR>} <BR></script>

JavaScript核心数据类型在浏览器和Node.js中一致,但处理方式和额外类型有所不同。1)全局对象在浏览器中为window,在Node.js中为global。2)Node.js独有Buffer对象,用于处理二进制数据。3)性能和时间处理在两者间也有差异,需根据环境调整代码。

JavaScriptusestwotypesofcomments:single-line(//)andmulti-line(//).1)Use//forquicknotesorsingle-lineexplanations.2)Use//forlongerexplanationsorcommentingoutblocksofcode.Commentsshouldexplainthe'why',notthe'what',andbeplacedabovetherelevantcodeforclari

Python和JavaScript的主要区别在于类型系统和应用场景。1.Python使用动态类型,适合科学计算和数据分析。2.JavaScript采用弱类型,广泛用于前端和全栈开发。两者在异步编程和性能优化上各有优势,选择时应根据项目需求决定。

选择Python还是JavaScript取决于项目类型:1)数据科学和自动化任务选择Python;2)前端和全栈开发选择JavaScript。Python因其在数据处理和自动化方面的强大库而备受青睐,而JavaScript则因其在网页交互和全栈开发中的优势而不可或缺。

Python和JavaScript各有优势,选择取决于项目需求和个人偏好。1.Python易学,语法简洁,适用于数据科学和后端开发,但执行速度较慢。2.JavaScript在前端开发中无处不在,异步编程能力强,Node.js使其适用于全栈开发,但语法可能复杂且易出错。

javascriptisnotbuiltoncorc; saninterpretedlanguagethatrunsonenginesoftenwritteninc.1)javascriptwasdesignedAsalightweight,解释edganguageforwebbrowsers.2)Enginesevolvedfromsimpleterterterpretpreterterterpretertestojitcompilerers,典型地提示。

JavaScript可用于前端和后端开发。前端通过DOM操作增强用户体验,后端通过Node.js处理服务器任务。1.前端示例:改变网页文本内容。2.后端示例:创建Node.js服务器。

选择Python还是JavaScript应基于职业发展、学习曲线和生态系统:1)职业发展:Python适合数据科学和后端开发,JavaScript适合前端和全栈开发。2)学习曲线:Python语法简洁,适合初学者;JavaScript语法灵活。3)生态系统:Python有丰富的科学计算库,JavaScript有强大的前端框架。


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。

螳螂BT
Mantis是一个易于部署的基于Web的缺陷跟踪工具,用于帮助产品缺陷跟踪。它需要PHP、MySQL和一个Web服务器。请查看我们的演示和托管服务。

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境

SublimeText3汉化版
中文版,非常好用