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

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

http://bbs.blueidea.com/thread-1825415-1-1.html

http://bbs.blueidea.com/thread-1825415-1-1.html

 

<!--20100907   生成漂浮flash 图片代码 方法一   开始-->

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>图片随机飘动代码生成器</title>
<style type="text/css">
body
{
text-align:center
}
table td
{
font-size:9pt;
}
</style>
<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;' οnmοuseοver='mystop()' οnmοuseοut= '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;' οnmοuseοver='mystop()' οnmοuseοut= '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;'  οnmοuseοver='mystop()' οnmοuseοut= '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;'  οnmοuseοver='stop()' οnmοuseοut= '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>
</head>
<body  topmargin="0">
<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">&nbsp;</td>
      <td width="256">&nbsp;</td>
      <td colspan="4">&nbsp;</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">&nbsp;</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">&nbsp;</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">&nbsp;</td>
      <td align="left" valign="top"><input type="button" name="Button" value="生成代码" onClick="fn_createCode(createCode)"></td>
      <td colspan="4" align="left" valign="top">&nbsp;</td>
    </tr>
  </table>
  <table width="700" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="81">&nbsp;</td>
      <td width="626"><textarea name="code" cols="70" rows="15"></textarea></td>
      <td width="71">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="button" name="Button" value="复制到剪切板" onClick="JM_cc(code)"></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>将文本框中生成的代码拷贝到您的页面</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
<p><font size="4"></font> </p>
</body>
</html>

<!--20100907   生成漂浮flash 图片代码 方法一  结束-->

 

<!--20100907   生成漂浮flash 图片代码方法二   开始-->

http://bbs.blueidea.com/thread-1825415-1-1.html

<!--20100907   生成漂浮flash 图片代码  方法二结束-->

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值