用DW制作简单的浮动广告
原文发布时间为:2008-11-08 —— 来源于本人的百度文章 [由搬家工具导入]
浮动广告可以用层和时间轴结合做出,先选择你的dreamweaver“窗口”,然后从“窗口”菜单中选择“时间轴”,时间轴就会出现在dw下方,再用层工具在网页中拖一个层,在层中插入你的广告内容,再把层拖到时间轴上,在把层拉到其他地方,再把层拖到时间轴上,再录制一个层路径,在网页上拖出你想要图象漂移的路径就可以了。
产生的代码如下:<html>
<head>
<title>js</title>
<style type="text/css">
<!--
#Layer1 {
position:absolute;
width:115px;
height:99px;
z-index:1;
left: 551px;
top: 207px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
//Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
tmLn = document.MM_Time[tmLnName];
if (numGotos != null)
if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}
jmpFwd = (fNew > tmLn.curFrame);
for (i = 0; i < tmLn.length; i++) {
sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
if (sprite.charAt(0) == "s") {
numKeyFr = sprite.keyFrames.length;
firstKeyFr = sprite.keyFrames[0];
lastKeyFr = sprite.keyFrames[numKeyFr - 1];
if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
for (j=0; j<sprite.values.length; j++) {
props = sprite.values[j];
if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
if (sprite.obj != null) {
if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
else sprite.obj[props.prop2][props.prop] = props[propNum];
} }
} else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
}
tmLn.curFrame = fNew;
if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
}
function MM_timelinePlay(tmLnName, myID) { //v1.2
//Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
tmLn = document.MM_Time[tmLnName];
if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
if (myID == tmLn.ID) { //if Im newest
setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
fNew = ++tmLn.curFrame;
for (i=0; i<tmLn.length; i++) {
sprite = tmLn[i];
if (sprite.charAt(0) == 's') {
if (sprite.obj) {
numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
keyFrm=1;
for (j=0; j<sprite.values.length; j++) {
props = sprite.values[j];
if (numKeyFr != props.length) {
if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
else sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
} else {
while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
else sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
} } } } }
} else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
if (fNew > tmLn.lastFrame) tmLn.ID = 0;
} }
}
function MM_initTimelines() { //v4.0
//MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
var ns = navigator.appName == "Netscape";
var ns4 = (ns && parseInt(navigator.appVersion) == 4);
var ns5 = (ns && parseInt(navigator.appVersion) > 4);
var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
document.MM_Time = new Array(1);
document.MM_Time[0] = new Array(5);
document.MM_Time["Timeline1"] = document.MM_Time[0];
document.MM_Time[0].MM_Name = "Timeline1";
document.MM_Time[0].fps = 15;
document.MM_Time[0][0] = new String("sprite");
document.MM_Time[0][0].slot = 1;
if (ns4)
document.MM_Time[0][0].obj = document["Layer1"];
else if (ns5)
document.MM_Time[0][0].obj = document.getElementById("Layer1");
else
document.MM_Time[0][0].obj = document.all ? document.all["Layer1"] : null;
document.MM_Time[0][0].keyFrames = new Array(1, 15);
document.MM_Time[0][0].values = new Array(2);
if (ns5 || macIE5)
document.MM_Time[0][0].values[0] = new Array("485px", "451px", "417px", "383px", "349px", "315px", "281px", "248px", "214px", "180px", "146px", "112px", "78px", "44px", "10px");
else
document.MM_Time[0][0].values[0] = new Array(485,451,417,383,349,315,281,248,214,180,146,112,78,44,10);
document.MM_Time[0][0].values[0].prop = "left";
if (ns5 || macIE5)
document.MM_Time[0][0].values[1] = new Array("178px", "169px", "159px", "150px", "141px", "131px", "122px", "113px", "103px", "94px", "84px", "75px", "66px", "56px", "47px");
else
document.MM_Time[0][0].values[1] = new Array(178,169,159,150,141,131,122,113,103,94,84,75,66,56,47);
document.MM_Time[0][0].values[1].prop = "top";
if (!ns4) {
document.MM_Time[0][0].values[0].prop2 = "style";
document.MM_Time[0][0].values[1].prop2 = "style";
}
document.MM_Time[0][1] = new String("sprite");
document.MM_Time[0][1].slot = 1;
if (ns4)
document.MM_Time[0][1].obj = document["Layer1"];
else if (ns5)
document.MM_Time[0][1].obj = document.getElementById("Layer1");
else
document.MM_Time[0][1].obj = document.all ? document.all["Layer1"] : null;
document.MM_Time[0][1].keyFrames = new Array(16, 30);
document.MM_Time[0][1].values = new Array(2);
if (ns5 || macIE5)
document.MM_Time[0][1].values[0] = new Array("551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px", "551px");
else
document.MM_Time[0][1].values[0] = new Array(551,551,551,551,551,551,551,551,551,551,551,551,551,551,551);
document.MM_Time[0][1].values[0].prop = "left";
if (ns5 || macIE5)
document.MM_Time[0][1].values[1] = new Array("207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px", "207px");
else
document.MM_Time[0][1].values[1] = new Array(207,207,207,207,207,207,207,207,207,207,207,207,207,207,207);
document.MM_Time[0][1].values[1].prop = "top";
if (!ns4) {
document.MM_Time[0][1].values[0].prop2 = "style";
document.MM_Time[0][1].values[1].prop2 = "style";
}
document.MM_Time[0][2] = new String("behavior");
document.MM_Time[0][2].frame = 31;
document.MM_Time[0][2].value = "MM_timelineGoto('Timeline1','1')";
document.MM_Time[0][3] = new String("sprite");
document.MM_Time[0][3].slot = 1;
if (ns4)
document.MM_Time[0][3].obj = document["Layer1"];
else if (ns5)
document.MM_Time[0][3].obj = document.getElementById("Layer1");
else
document.MM_Time[0][3].obj = document.all ? document.all["Layer1"] : null;
document.MM_Time[0][3].keyFrames = new Array(31, 45);
document.MM_Time[0][3].values = new Array(2);
if (ns5 || macIE5)
document.MM_Time[0][3].values[0] = new Array("504px", "474px", "444px", "415px", "385px", "355px", "325px", "296px", "266px", "236px", "206px", "176px", "147px", "117px", "87px");
else
document.MM_Time[0][3].values[0] = new Array(504,474,444,415,385,355,325,296,266,236,206,176,147,117,87);
document.MM_Time[0][3].values[0].prop = "left";
if (ns5 || macIE5)
document.MM_Time[0][3].values[1] = new Array("34px", "36px", "37px", "39px", "41px", "43px", "44px", "46px", "48px", "49px", "51px", "53px", "55px", "56px", "58px");
else
document.MM_Time[0][3].values[1] = new Array(34,36,37,39,41,43,44,46,48,49,51,53,55,56,58);
document.MM_Time[0][3].values[1].prop = "top";
if (!ns4) {
document.MM_Time[0][3].values[0].prop2 = "style";
document.MM_Time[0][3].values[1].prop2 = "style";
}
document.MM_Time[0][4] = new String("sprite");
document.MM_Time[0][4].slot = 1;
if (ns4)
document.MM_Time[0][4].obj = document["Layer1"];
else if (ns5)
document.MM_Time[0][4].obj = document.getElementById("Layer1");
else
document.MM_Time[0][4].obj = document.all ? document.all["Layer1"] : null;
document.MM_Time[0][4].keyFrames = new Array(46, 60);
document.MM_Time[0][4].values = new Array(2);
if (ns5 || macIE5)
document.MM_Time[0][4].values[0] = new Array("504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px", "504px");
else
document.MM_Time[0][4].values[0] = new Array(504,504,504,504,504,504,504,504,504,504,504,504,504,504,504);
document.MM_Time[0][4].values[0].prop = "left";
if (ns5 || macIE5)
document.MM_Time[0][4].values[1] = new Array("34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px", "34px");
else
document.MM_Time[0][4].values[1] = new Array(34,34,34,34,34,34,34,34,34,34,34,34,34,34,34);
document.MM_Time[0][4].values[1].prop = "top";
if (!ns4) {
document.MM_Time[0][4].values[0].prop2 = "style";
document.MM_Time[0][4].values[1].prop2 = "style";
}
document.MM_Time[0].lastFrame = 60;
for (i=0; i<document.MM_Time.length; i++) {
document.MM_Time[i].ID = null;
document.MM_Time[i].curFrame = 0;
document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
}
}
//-->
</script>
</head>
<body onLoad="MM_timelinePlay('Timeline1')">
<p><a href="http://www.baidu.com" onClick="return confirm('dfsdf');" onMouseOver="Status='baidu';" onMouseOut="Status='tt';return true;">open bai du</a></p>
<div id="Layer1" style="left: 485px; top: 178px;"><img src="../../图片/视觉/image011.jpg" width="115" height="100"></div>
<p> </p>
</body>
</html>
用DW制作简单的浮动广告的更多相关文章
- JavaScript浮动广告代码,容纯DIV/CSS对联漂浮广告代码,兼容性非常好的js右下角与漂浮广告代码
基于JavaScript代码实现随机漂浮图片广告,javascript图片广告 在网上有很多这样的代码,不过未必符合W3C标准,因为在头部加上<!DOCTYPE html>类似标签之后,漂 ...
- 笨办法用js屏蔽被http劫持的浮动广告
最近发现网站经常在右下角弹出一个浮动广告,开始的时候以为只是浏览器的广告. 后来越来越多同事反映在家里不同浏览器也会出现广告.然后深入检查了下,发现网站竟然被劫持了. 然后百度了一大堆资料,什么htt ...
- Js浮动广告效果实现
第一种 漂浮广告 不符合W3CJavaScript漂浮广告代码,很不错,代码精简,不过一次只有漂一个,复制就能用了.希望站长朋友喜欢. <html> <head> <ti ...
- Highcharts使用教程(1):制作简单图表
今天我们要使用JavaScript图表Highcharts制作简单的柱形图,我们已经安装好Highcharts,让我们开始制作图表吧. 步骤一 在网页中添加一个div.设置id,设置图表长.高.代码如 ...
- ZAM 3D 制作简单的3D字幕 流程(二)
原地址:http://www.cnblogs.com/yk250/p/5663907.html 文中表述仅为本人理解,若有偏差和错误请指正! 接着 ZAM 3D 制作简单的3D字幕 流程(一) .本篇 ...
- phalcon: eventManager事件管理(结合dispatcher调度控制器)制作简单的acl
制作简单的acl, dispatcher(专门用来加载或调度或跳转到相应的url地址即XXXcontroller的调度器或控制器,能够在controller执行前对controller进行停止跳转等) ...
- web页面浮动回到顶部功能和浮动广告
实现测试浮动回到顶部 法一:用js实现<%@ Page Language="C#" AutoEventWireup="true" CodeBehind=& ...
- canvas制作简单动画
在画布元素<canvas>中,除了绘制图形.图像.文字外,还可以制作一些简单的动画,制作过程十分简单,主要分为两步操作: 1.自定义一个函数,用于图形的移动或其他动作. 2.使用setIn ...
- JQuery实现两侧浮动广告
1.描述 两侧浮动显示广告 2.要点 其实就是一直在变浮动广告距顶部的值. 3.代码 <!DOCTYPE html> <html> <head> <meta ...
随机推荐
- AJPFX关于读取properties 配置文件 返回属性值
:Properties的概述 * Properties 类表示了一个持久的属性集. * Properties 可保存在流中或从流中加载. * 属性列表中每个键 ...
- UART协议
通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,通常称作UART,读音/ˈjuːart/)是一种异步收发传输器,是电脑硬件的一部分,将资料由 ...
- Performance testing architecture
一张图胜过千言. 这个还只是目前阶段的架构,后期会在CI以及自动化驱动下形成具有管理功能的平台.
- react基础语法(一)元素渲染和基础语法规则
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- sqlserver 数据库主外键关联错误
话题引入: 在建立主外键关系时,系统提示表"table2"中的列与现有的主键或UNIQUE约束不匹配 原因: 数据库表中只有一个主键,这个主键可以是多个列共同组成.所以table2 ...
- vscode 用户代码片段 vue初始化模板 Snippet #新加入开头注释 自动生成文件名 开发日期时间等内容
vue文件模板 模板变量 https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables vue.json { // ...
- QTreeWidgetItem封装
#include "qtreewighthelper.h" QTreeWidgetItem* AddQTreeWidgetItemChild(QTreeWidgetItem* pa ...
- Python Syntax Summary
# _*_ coding: utf-8 _*_ """########################################################## ...
- 基于jquery的自定义显示消息数量
根据需求简单的实现一个小功能控件,暂时不支持扩展 $("xxxxxxx").iconCountPlugin(options, start, isOffset) {//三个参数,自定 ...
- PHP将数据库的数据转换成json格式
header('content-type:application/json;charset=utf8'); $results = array(); while ($row = mysql_f ...