自学flash必记代码.doc_第1页
自学flash必记代码.doc_第2页
自学flash必记代码.doc_第3页
自学flash必记代码.doc_第4页
自学flash必记代码.doc_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

下面是一些实用的代码 flash学员要是用可以转载事件源对象event.srcElement.tagNameevent.srcElement.type捕获释放event.srcElement.setCapture();event.srcElement.releaseCapture();事件按键event.keyCodeevent.shiftKeyevent.altKeyevent.ctrlKey事件返回值event.returnValue鼠标位置event.xevent.y窗体活动元素document.activeElement绑定事件document.captureEvents(Event.KEYDOWN);访问窗体元素document.all(txt).focus();document.all(txt).select();窗体命令document.execCommand窗体COOKIEdocument.cookie菜单事件document.oncontextmenu创建元素document.createElement_x_x(SPAN);根据鼠标获得元素:document.elementFromPoint(event.x,event.y).tagName=TDdocument.elementFromPoint(event.x,event.y).appendChild(ms)窗体图片document.images索引窗体事件绑定document.onmousedown=scrollwindow;元素document.窗体.elements索引对象绑定事件document.all.xxx.detachEvent(onclick,a);插件数目navigator.plugins取变量类型typeof($js_libpath) = undefined下拉框下拉框.options索引下拉框.options.length查找对象document.getElementsByName(r1);document.getElementByIdx_xx_x(id);定时timer=setInterval(scrollwindow(),delay);clearInterval(timer);UNCODE编码escape() ,父对象obj.parentElement(dhtml)obj.parentNode(dom)交换表的行TableID.moveRow(2,1)替换CSSdocument.all.csss.href = a.css;并排显示display:inline隐藏焦点hidefocus=true根据宽度换行style=word-break:break-all自动刷新简单邮件快速转到位置obj.scrollIntoView(true)锚anchors网页传递参数location.search();可编辑obj.contenteditable=true执行菜单命令obj.execCommand双字节字符/x00-xff/汉字/u4e00-u9fa5/让英文字符串超出表格宽度自动换行word-wrap: break-word; word-break: break-all;透明背景获得style内容obj.style.cssTextHTML标签document.documentElement.innerHTML第一个style标签document.styleSheets0style标签里的第一个样式document.styleSheets0.rules0防止点击空链接时,页面往往重置到页首端。word上一网页源asp:request.servervariables(HTTP_REFERER)javascript:document.referrer释放内存CollectGarbage();禁止右键document.oncontextmenu = function() return false;禁止保存禁止选取favicon.ico 名字最好不变16*16的16色,放虚拟目录根目录下收藏栏图标查看源码关闭输入法自动全选ENTER键可以让光标移到下一个输入框文本框的默认值title换行obj.title = 123 sdfs 获得时间所代表的微秒var n1 = new Date(2004-10-10.replace(/-/g, /).getTime()窗口是否关闭win.closedcheckbox扁平获取选中内容取选中内容document.selection.createRange().duplicate().text自动完成功能打开该功能关闭该功能关闭窗口window.close();返回history.back();无关闭按钮IE window.open(aa.htm, meizz, fullscreen=7);统一编码/解码 alert(decodeURIComponent(encodeURIComponent(http:/你好.com?as= hehe)encodeURIComponent对:、/、; 和 ?也编码高级应用(一)页面跳转:window.location.href(地址)window.open(地址, _self)打开新窗口:window.open(地址, _blank)只显示地址栏:window.open(地址, title, location=1, height=200, width=500)只显示状态栏:window.open(地址, title, status=1)只显示工具栏:window.open(地址, title, toolbar=1)只显示菜单栏:window.open(地址, title, menubar=1)一个不少:window.open(地址, title)光棍但可以调整大小:window.open(地址, title, resizable=1)去掉所有空格:Object.replace(/s+|s+$/g, )屏蔽鼠标:oncontextmenu=window.event.returnValue=false取消选取:onselectstart=return false不允许粘贴:onpaste=return false关闭输入法:不允许另存为:得到上一页来源:document.referrer弹出窗口总在最上:弹出确认对话框:comfirm(文本)outputs.value=/预览代码function seeHtm()open().document.write(+outputs.value);/用快捷键F12预览document.onkeydown=seeHtmsfunction seeHtms()if(event.keyCode=123)open().document.write(+outputs.value);/全选代码function ta()outputs.select()/拷贝代码function tc()document.execCommand(Copy)/粘贴代码function tp()outputs.focus()document.execCommand(Paste)广告JS代码效果大全1.普通效果现在很多网站广告做的如火如荼,现在我就来介绍一下常见的对联浮动广告效果的代码使用方法,介绍的这种效果,在1024*768分辨率下正常显示,在800*600的分辨率下可以自动隐藏,以免遮住页面影响访问者浏览内容,下面就是实现效果所需代码:var delta=0.015var collection;function floaters() this.items = ;this.addItem =function(id,x,y,content)document.write( +content+);var newItem = ;newItem.object = document.getElementByIdx_xx_x(id);newItem.x = x;newItem.y = y;this.itemsthis.items.length = newItem;this.play =function()collection =this.itemssetInterval(play(),10);function play()if(screen.width0?1:-1)*Math.ceil(Math.abs(dx);followObj.style.left=followObj.offsetLeft+dx;if(followObj.offsetTop!=(document.body.scrollTop+followObj_y) var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;dy=(dy0?1:-1)*Math.ceil(Math.abs(dy);followObj.style.top=followObj.offsetTop+dy;followObj.style.display = ;var theFloaters =new floaters();theFloaters.addItem(followDiv1,document.body.clientWidth-100,0,2.鼠标感应与前面一个代码不同的是,当鼠标移动到广告图片上是可以感应显示另外设置好的广告大图效果,下面就是实现效果所需代码:function bigshow()document.all.div_250.style.visibility = visible;document.all.div_80.style.visibility = hidden;function bighide()document.all.div_80.style.visibility = visible;document.all.div_250.style.visibility = hidden;var ad_80= new Array(1);var ad_250= new Array(1);ad_800=网址 target=_blank;ad_2500=网址 target=_blank;var imgheight;var fubioleft;window.screen.width800 ? fubioleft=15:fubioleft=15document.write( );ad_now = new Date();ad_id= ad_now.getSeconds() %1var adhead1= ;var adhead2=;/var adhead1= ;/var adhead2=;document.write(adhead1+ad_80ad_id+adhead2+ad_250ad_id+);document.write ();self.onError=null;currentX = currentY = 0;whichIt = null;lastScrollX = 0; lastScrollY = 0;NS = (document.layers) ? 1 : 0;IE = (document.all) ? 1: 0;function heartBeat() if(IE) diffY = document.body.scrollTop;diffX = document.body.scrollLeft; if(NS) diffY = self.pageYOffset; diffX = self.pageXOffset; if(diffY != lastScrollY) percent = .5 * (diffY - lastScrollY);if(percent 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.floater_left.style.pixelTop += percent;if(NS) document.floater_left.top += percent;lastScrollY = lastScrollY + percent;if(diffX != lastScrollX) percent = .5 * (diffX - lastScrollX);if(percent 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.floater_left.style.pixelLeft += percent;if(NS) document.floater_left.left += percent;lastScrollX = lastScrollX + percent;if(NS | IE) action = window.setInterval(heartBeat(),1);var ad_80= new Array(1);var ad_250= new Array(1);ad_800=网址 target=_blank;ad_2500=网址 target=_blank;var imgheight;var fubioleft;window.screen.width800 ? fubioleft=15:fubioleft=15document.write( );ad_now = new Date();ad_id= ad_now.getSeconds() %1function myload()if (navigator.appName = Netscape)document.div_right_80.pageX=+windows.innerWidth-130;document.div_right_250.pageX=+windows.innerWidth-300;mymove();elsediv_right_80.style.left=document.body.offsetWidth-130;div_right_250.style.left=document.body.offsetWidth-300;mymove();function mymove()if(document.ns)document.div_right_80.left=pageXOffset+windows.innerWidth-130;document.div_right_250.left=pageXOffset+windows.innerWidth-300;setTimeout(mymove();,20)elsediv_right_80.style.left=document.body.scrollLeft+document.body.offsetWidth-145;div_right_250.style.left=document.body.scrollLeft+document.body.offsetWidth-300;setTimeout(mymove();,20)var adhead1= ;var adhead2=;document.write(adhead1+ad_80ad_id+adhead2+ad_250ad_id+);myload()document.write ();self.onError=null;currentX_right = currentY_right = 0;whichIt_right = null;lastScrollX_right = 0; lastScrollY_right = 0;NS = (document.layers) ? 1 : 0;IE = (document.all) ? 1: 0;function heartBeat_right() if(IE) diffY_right = document.body.scrollTop;diffX_right = document.body.scrollLeft; if(NS) diffY_right = self.pageYOffset; diffX_right = self.pageXOffset; if(diffY_right != lastScrollY_right) percent_right = .5 * (diffY_right - lastScrollY_right);if(percent_right 0) percent_right = Math.ceil(percent_right);else percent_right = Math.floor(percent_right);if(IE) document.all.floater_right.style.pixelTop += percent_right;if(NS) document.floater_right.top += percent_right;lastScrollY_right = lastScrollY_right + percent_right;if(diffX_right != lastScrollX_right) percent_right = .5 * (diffX_right - lastScrollX_right);if(percent_right 0) percent_right = Math.ceil(percent_right);else percent_right = Math.floor(percent_right);if(IE) document.all.floater_right.style.pixelLeft += percent_right;if(NS) document.floater_right.left += percent_right;lastScrollX_right = lastScrollX_right + percent_right;if(NS | IE) action = window.setInterval(heartBeat_right(),1);广告JS代码效果大全2.鼠标感应与前面一个代码不同的是,当鼠标移动到广告图片上是可以感应显示另外设置好的广告大图效果,下面就是实现效果所需代码:function bigshow()document.all.div_250.style.visibility = visible;document.all.div_80.style.visibility = hidden;function bighide()document.all.div_80.style.visibility = visible;document.all.div_250.style.visibility = hidden;var ad_80= new Array(1);var ad_250= new Array(1);ad_800=网址 target=_blank;ad_2500=网址 target=_blank;var imgheight;var fubioleft;window.screen.width800 ? fubioleft=15:fubioleft=15document.write( );ad_now = new Date();ad_id= ad_now.getSeconds() %1var adhead1= ;var adhead2=;/var adhead1= ;/var adhead2=;document.write(adhead1+ad_80ad_id+adhead2+ad_250ad_id+);document.write ();self.onError=null;currentX = currentY = 0;whichIt = null;lastScrollX = 0; lastScrollY = 0;NS = (document.layers) ? 1 : 0;IE = (document.all) ? 1: 0;function heartBeat() if(IE) diffY = document.body.scrollTop;diffX = document.body.scrollLeft; if(NS) diffY = self.pageYOffset; diffX = self.pageXOffset; if(diffY != lastScrollY) percent = .5 * (diffY - lastScrollY);if(percent 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.floater_left.style.pixelTop += percent;if(NS) document.floater_left.top += percent;lastScrollY = lastScrollY + percent;if(diffX != lastScrollX) percent = .5 * (diffX - lastScrollX);if(percent 0) percent = Math.ceil(percent);else percent = Math.floor(percent);if(IE) document.all.floater_left.style.pixelLeft += percent;if(NS) document.floater_left.left += percent;lastScrollX = lastScrollX + percent;if(NS | IE) action = window.setInterval(heartBeat(),1);var ad_80= new Array(1);var ad_250= new Array(1);ad_800=网址 target=_blank;ad_2500=网址 target=_blank;var imgheight;var fubioleft;window.screen.width800 ? fubioleft=15:fubioleft=15document.write( );ad_now = new Date();ad_id= ad_now.getSeconds() %1function myload()if (navigator.appName = Netscape)document.div_right_80.pageX=+windows.innerWidth-130;document.div_right_250.pageX=+windows.innerWidth-300;mymove();elsediv_right_80.style.left=document.body.offsetWidth-130;div_right_250.style.left=document.body.offsetWidth-300;mymove();function mymove()if(document.ns)document.div_right_80.left=pageXOffset+windows.innerWidth-130;document.div_right_250.left=pageXOffset+windows.innerWidth-300;setTimeout(mymove();,20)elsediv_right_80.style.left=document.body.scrollLeft+document.body.offsetWidth-145;div_right_250.style.left=document.body.scrollLeft+document.body.offsetWidth-300;setTimeout(mymove();,20)var adhead1= ;var adhead2=;document.write(adhead1+ad_80ad_id+adhead2+ad_250ad_id+);myload()document.write ();self.onError=null;currentX_right = currentY_right = 0;whichIt_right = null;lastScrollX_right = 0; lastScrollY_right = 0;NS = (document.layers) ? 1 : 0;IE = (document.all) ? 1: 0;function heartBeat_right() if(IE) diffY_right = document.body.scrollTop;diffX_right = document.body.scrollLeft; if(NS) diffY_right = self.pageYOffset; diffX_right = self.pageXOffset; if(diffY_right != lastScrollY_right) percent_right = .5 * (diffY_right - lastScrollY_right);if(percent_right 0) percent_right = Math.ceil(percent_right);else percent_right = Math.floor(percent_right);if(IE) document.all.floater_right.style.pixelTop += percent_right;if(NS) document.floater_right.top += percent_right;lastScrollY_right = lastScrollY_right + percent_right;if(diffX_right != lastScrollX_right) percent_right = .5 * (diffX_right - lastScrollX_right);if(percent_right 0) percent_right = Math.ceil(percent_right);else percent_right = Math.floor(percent_right);if(IE) document.all.floater_right.style.pixelLeft += percent_right;if(NS) document.floater_right.left += percent_right;lastScrollX_right = lastScrollX_right + percent_right;if(NS | IE) action = window.setInterval(heartBeat_right(),1);function bigshow_right()document.all.div_right_250.style.visibility = visible;document.all.div_right_80.style.visibility = hidden;function bighide_right()document.all.div_right_80.style.visibility = visible;document.all.div_right_250.style.visibility = hidden;document.write();document.write();document.write();3.允许关闭与前面两个代码不同的是,广告图下方增加了一个图片按纽,允许访客点击关闭广告图片,下面文本框中就是实现效果所需代码:var delta=0.015;var collection;var closeB=false;function floaters() this.items = ;this.addItem = function(id,x,y,content)document.write( +content+);var newItem = ;newItem.object = document.getElementByIdx_xx_x(id);newItem.x = x;newItem.y = y;this.itemsthis.items.length = newItem;this.play = function()collection = this.itemssetInterval(play(),30);function play()if(screen.width0?1:-1)*Math.ceil(Math.abs(dx);followObj.style.left=followObj.offsetLeft+dx;if(followObj.offsetTop!=(document.body.scrollTop+followObj_y) var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta;dy=(dy0?1:-1)*Math.ceil(Math.abs(dy);followObj.style.top=followObj.offsetTop+dy;followObj.style.display = ;function closeBa

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论