登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

学子乐

学道之志,贫当益坚,少当努力,老当益壮

 
 
 

日志

 
 

图片flash随机飘动代码生成器及代码(博客特效)  

2010-04-01 13:17:26|  分类: 电脑技术 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

说明:
1.把最后生成的漂浮图片或flash的代码放到自定义HTML模块保存即可获得全屏漂浮图片效果,参考《如何添加自定义html模块 》.

2.“运行代码”即出现“图片flash随机飘动代码生成器-可产生全屏漂浮图片代码”!

特 效 代 码 工 具--代 码 检 验 器

图片flash随机飘动代码生成器

飘动元素: 图片文件 flash文件
图片路径: 图片高度 图片宽度
flash路径: flash高度 flash宽度
图片链接:
图片首次出现位置: 上左 上中 上右 下左 下中 下右
图片飘动延迟时间: 5ms 10ms 20ms 30ms 40ms 50ms
鼠标事件: 是 否 鼠标事件说明:
当鼠标放在图片上时,图片飘动是否停止

 

将文本框中生成的代码拷贝到您的页面

代码如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>图片随机飘动代码生成器</title>

<style type="text/css">
body
{
text-align:center
}
table td
{
font-size:9pt;
}
</style>
</head>

<body topmargin="0">
<script language="JavaScript">
<!--
function fn_getValueRadio(form_name)
{
var value = "";
for (var i=0; i<form_name.length;i++)
{
if (form_name[i].checked)
{
value = form_name[i].value;
break;
}
}
return value;
}
function fn_display(form_name)
{
var display = fn_getValueRadio(form_name);
if (display == "flash")
{
document.getElementById("image").style.display = "none"
document.getElementById("imageUrl").style.display = "none"
document.getElementById("flash").style.display = ""
}
else if (display == "image")
{
document.getElementById("image").style.display = ""
document.getElementById("imageUrl").style.display = ""
document.getElementById("flash").style.display = "none"
}
}
function JM_cc(ob)
{
ob.select();
js=ob.createTextRange();
js.execCommand("Copy");
}
function fn_createCode(form_name)
{
//生成飘动的层
var display = fn_getValueRadio(form_name.type);
var div_html = "";
if (display == "image")
{
var imgPath = form_name.imgPath.value;
var imgHeight = form_name.imgHeight.value;
var imgWidth = form_name.imgWidth.value;
var imgUrl = form_name.imgUrl.value;
var mouse = fn_getValueRadio(form_name.mouse)
if (imgPath == "")
{
alert("请输入飘动图片的路径")
return;
}
if ((imgHeight == "")||((imgHeight != "")&&(!isNumber(imgHeight))))
{
alert("图片的高度不能为空且只能为数字")
return;
}
if ((imgWidth == "")||((imgWidth != "")&&(!isNumber(imgWidth))))
{
alert("图片的宽度不能为空且只能为数字")
return;
}
if (mouse == "1")
{
if (imgUrl != "")
div_html += "<span id='img' style='position:absolute;' onmouseover='mystop()' onmouseout= 'start()'><a href='"+imgUrl+"' target='_blank'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"' border='0'> </a></span>"
else
div_html += "<span id='img' style='position:absolute;' onmouseover='mystop()' onmouseout= 'start()'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"'></span>"
}
else
{
if (imgUrl != "")
div_html += "<span id='img' style='position:absolute;'><a href='"+imgUrl+"' target='_blank'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"' border='0'> </a></span>"
else
div_html += "<span id='img' style='position:absolute;'><img src='"+imgPath+"' width='"+imgHeight+"' height='"+imgWidth+"'></span>"
}
}
else if (display == "flash")
{
var fPath = form_name.fPath.value;
var fHeight = form_name.fHeight.value;
var fWidth = form_name.fWidth.value;
var fmouse = fn_getValueRadio(form_name.mouse)
if (fPath == "")
{
alert("请输入飘动flash的路径")
return;
}
if ((fHeight == "")||((fHeight != "")&&(!isNumber(fHeight))))
{
alert("flash的高度不能为空且只能为数字")
return;
}
if ((fWidth == "")||((fWidth != "")&&(!isNumber(fWidth))))
{
alert("flash的宽度不能为空且只能为数字")
return;
}
if (fmouse == "1")
{
div_html += "<span id='img' style='position:absolute;' onmouseover='mystop()' onmouseout= 'start()'>";
div_html += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+fWidth+"' height='"+fHeight+"'>";
div_html += "<param name='movie' value='"+fPath+"'>";
div_html += "<param name='quality' value='high'>"
div_html += "<embed src='"+fPath+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+fWidth+"' height='"+fHeight+"'></embed></object></span>";
}
else
{
div_html += "<span id='img' style='position:absolute;' onmouseover='stop()' onmouseout= 'start()'>";
div_html += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+fWidth+"' height='"+fHeight+"'>";
div_html += "<param name='movie' value='"+fPath+"'>";
div_html += "<param name='quality' value='high'>"
div_html += "<embed src='"+fPath+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+fWidth+"' height='"+fHeight+"'></embed></object></span>";
}
}
//设置飘动参数生成飘动代码
var code_html = "";
var position = fn_getValueRadio(form_name.imgPosition);
var xPos = 0;
var yPos = 0;
switch (position)
{
case "topLeft":
xPos = 0;
yPos = 0;
break;
case "topCenter":
xPos = parseInt(document.body.clientWidth/2);
yPos = 0;
break;
case "topRight":
xPos = document.body.clientWidth;
yPos = 0;
break;
case "bottomLeft":
xPos = 0;
yPos = document.body.clientHeight;
break;
case "bottomCenter":
xPos = parseInt(document.body.clientWidth/2);
yPos = document.body.clientHeight;
break;
case "bottomRight":
xPos = document.body.clientWidth;
yPos = document.body.clientHeight;
break;
}
var delay_time = parseInt(fn_getValueRadio(form_name.delay))
var delay = 0;
switch (delay_time)
{
case 5:
delay = 5
break;
case 10:
delay = 10
break;
case 20:
delay = 20
break;
case 30:
delay =30
break;
case 40:
delay = 40
break;
case 50:
delay = 50
break;
}
code_html += "\r\n<script language='JavaScript'>\r\n"
code_html += "var xPos = "+xPos+";var yPos = "+yPos+"; var step = 1;var delay = "+delay+";var height = 0; var Hoffset = 0;var Woffset = 0; var yon = 0;var xon = 0; var xon = 0; var interval;\r\n";
code_html += "var img = document.getElementById('img');\r\n"
code_html += "img.style.top = "+yPos+";\r\n";
code_html +="function changePos(){\r\n"
code_html += "width = document.body.clientWidth;\r\n"
code_html += "height = document.body.clientHeight;\r\n"
code_html += "Hoffset = img.offsetHeight;\r\n"
code_html += "Woffset = img.offsetWidth;\r\n"
code_html += "img.style.left = xPos + document.body.scrollLeft;\r\n"
code_html += "img.style.top = yPos + document.body.scrollTop;\r\n"
code_html += "if (yon) {\r\n"
code_html += "yPos = yPos + step;\r\n"
code_html += "\r\n}"
code_html += "else {\r\n"
code_html += "yPos = yPos - step;\r\n"
code_html += "}\r\n"
code_html += "if (yPos < 0) {\r\n"
code_html += "yon = 1;\r\n"
code_html += "yPos = 0;\r\n"
code_html += "}\r\n"
code_html += "if (yPos >= (height - Hoffset)) {\r\n"
code_html += "yon = 0;\r\n"
code_html += "yPos = (height - Hoffset);\r\n"
code_html += "}\r\n"
code_html += "if (xon) {\r\n"
code_html += "xPos = xPos + step;\r\n"
code_html += "}\r\n"
code_html += "else {\r\n"
code_html += "xPos = xPos - step;\r\n"
code_html += "}\r\n"
code_html += "if (xPos < 0) {\r\n"
code_html += "xon = 1;\r\n"
code_html += "xPos = 0;\r\n"
code_html += "}\r\n"
code_html += "if (xPos >= (width - Woffset)) {\r\n"
code_html += "xon = 0;\r\n"
code_html += "xPos = (width - Woffset);\r\n"
code_html += "}\r\n"
code_html += "}\r\n"
code_html +="function start() {\r\n"
code_html +="img.visibility = 'visible';\r\n"
code_html +="interval = setInterval('changePos()', delay);\r\n"
code_html +="}\r\n"
code_html +="function mystop()\r\n"
code_html +="{\r\n"
code_html +="clearInterval(interval)\r\n"
code_html +="}\r\n start()\r\n<\/script>"
form_name.code.value = div_html + code_html;
}
function isNumber(value)
{
var desc = "0123456789";
for (var i = 0; i<value.length;i++)
{
if (desc.indexOf(value.charAt(i)) == -1)
return false
}
return true;
}
-->
</script>

<p><font size="4">图片flash随机飘动代码生成器 </font></p>
<form name="createCode" method="post" action="">

<table width="700" border="0" cellspacing="0" cellpadding="0" style="line-height:20px">
<tr>
<td width="119"> </td>
<td width="256"> </td>
<td colspan="4"> </td>
</tr>
<tr>
<td width="119" align="right">飘动元素:</td>
<td width="256"><input name="type" type="radio" value="image" checked onClick="fn_display(createCode.type)">

图片文件<input type="radio" name="type" value="flash" onClick="fn_display(createCode.type)">
flash文件
</td>
<td colspan="4"> </td>
</tr>
<tr id="image" style="display:">
<td align="right" >图片路径:</td>
<td align="center"> <input type="text" name="imgPath" style="width:250px"></td>

<td width="60" align="right">图片高度</td>
<td width="92" align="center"><input type="text" name="imgHeight" style="width:80px"></td>
<td width="67" align="right">图片宽度</td>
<td width="106" align="center"><input type="text" name="imgWidth" style="width:80px"></td>
</tr>
<tr id="flash" style="display:none">
<td align="right">flash路径:</td>
<td align="center"> <input type="text" name="fPath" style="width:250px"></td>

<td width="60" align="right">flash高度</td>
<td width="92" align="center"><input type="text" name="fHeight" style="width:80px"></td>
<td width="67" align="right">flash宽度</td>
<td width="106" align="center"><input type="text" name="fWidth" style="width:80px"></td>
</tr>
<tr id="imageUrl" style="display:">
<td align="right">图片链接:</td>
<td align="center"> <input type="text" name="imgUrl" style="width:250px"></td>

<td colspan="4" align="right"> </td>
</tr>
<tr>
<td height="16" align="right">图片首次出现位置:</td>
<td colspan="5"><input name="imgPosition" type="radio" value="topLeft" checked>
上左
<input type="radio" name="imgPosition" value="topCenter">
上中 <input type="radio" name="imgPosition" value="topRight">
上右
<input type="radio" name="imgPosition" value="bottomLeft">

下左
<input type="radio" name="imgPosition" value="bottomCenter">
下中
<input type="radio" name="imgPosition" value="bottomRight">
下右 </td>
</tr>
<tr>
<td align="right">图片飘动延迟时间:</td>
<td colspan="5"><input type="radio" name="delay" value="5">

5ms <input name="delay" type="radio" value="10" checked>
10ms <input type="radio" name="delay" value="20">
20ms <input type="radio" name="delay" value="30">
30ms <input type="radio" name="delay" value="40">
40ms <input type="radio" name="delay" value="50">
50ms</td>

</tr>
<tr>
<td align="right" valign="top">鼠标事件:</td>
<td align="left" valign="top"><input name="mouse" type="radio" value="1" checked>

<input type="radio" name="mouse" value="0">
否 </td>
<td colspan="4" align="left" valign="top">鼠标事件说明:<br>当鼠标放在图片上时,图片飘动是否停止</td>

</tr>
<tr>
<td align="right" valign="top"> </td>
<td align="left" valign="top"><input type="button" name="Button" value="生成代码" onClick="fn_createCode(createCode)"></td>
<td colspan="4" align="left" valign="top"> </td>
</tr>
</table>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="81"> </td>

<td width="626"><textarea name="code" cols="70" rows="15"></textarea></td>
<td width="71"> </td>
</tr>
<tr>
<td> </td>
<td><input type="button" name="Button" value="复制到剪切板" onClick="JM_cc(code)"></td>
<td> </td>
</tr>
<tr>
<td> </td>

<td>将文本框中生成的代码拷贝到您的页面</td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>

* 提示:可以將本博特效代碼粘貼在框里或修改代码然后再运行

 

“图片flash随机飘动代码生成器”的说明:

1.“图片路径”为图片本身地址,“图片链接”为点击图片就可以到达的网站或博客的地址。

2.图片路径地址和尺寸的获取:鼠标右键单击图片-属性-地址(URL)后面的地址就是,同时可以得到图片尺寸大小。

  评论这张
 
阅读(309)| 评论(0)

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018