常用JS。规范化。
http://www.cnblogs.com/Files/raylynn/Site.js
http://www.cnblogs.com/Files/raylynn/Flash.js
var Flash =
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
Write : function(path,height,width,loop,param)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
document.write ('<OBJECT id="myFlashMovie" codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"');
document.write ('height="' + height + '" width="' + width + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>');
document.write ('<PARAM NAME="_cx" VALUE="14684">');
document.write ('<PARAM NAME="_cy" VALUE="5953">');
Flash.WriteParam(param);
document.write ('<PARAM NAME="Movie" VALUE="' + path + '">');
document.write ('<PARAM NAME="Src" VALUE="' + path + '">');
document.write ('<PARAM NAME="WMode" VALUE="Window">');
document.write ('<PARAM NAME="Play" VALUE="-1">');
document.write ('<PARAM NAME="Loop" VALUE="' + ((loop == null) ? -1 : loop) + '">');
document.write ('<PARAM NAME="Quality" VALUE="High">');
document.write ('<PARAM NAME="SAlign" VALUE="">');
document.write ('<PARAM NAME="Menu" VALUE="-1">');
document.write ('<PARAM NAME="Base" VALUE="">');
document.write ('<PARAM NAME="AllowScriptAccess" VALUE="">');
document.write ('<PARAM NAME="Scale" VALUE="ShowAll">');
document.write ('<PARAM NAME="DeviceFont" VALUE="0">');
document.write ('<PARAM NAME="EmbedMovie" VALUE="0">');
document.write ('<PARAM NAME="BGColor" VALUE="">');
document.write ('<PARAM NAME="SWRemote" VALUE="">');
document.write ('<PARAM NAME="MovieData" VALUE="">');
document.write ('<PARAM NAME="SeamlessTabbing" VALUE="1">');
document.write ('<PARAM NAME="Profile" VALUE="0">');
document.write ('<PARAM NAME="ProfileAddress" VALUE="">');
document.write ('<PARAM NAME="ProfilePort" VALUE="0">');
document.write ('<embed src="' + path + '" swliveconnect="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ');
Flash.WriteEmbedParam(param);
document.write ('type="application/x-shockwave-flash" height="' + height + '" width="' + width + '" name="myFlashMovie">');
document.write ('</embed>');
document.write ('</OBJECT>');
},
WriteParam : function(param)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (param == null)
{
document.write ('<PARAM NAME="FlashVars" VALUE="">');
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
else
{
document.write ('<PARAM NAME="FlashVars" value="' + param.Name + '=' + param.Value + '">');
}
},
WriteEmbedParam : function(param)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (param == null) return;
document.write ('FlashVars="' + param.Name + '=' + param.Value + '"');
}
}
使用方法:
Flash.Write('/Images/Default/Flash/sports2.swf',225,555);
向上动感滚动文本代码。
var Site =
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
{
IsIE : function()
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return (window.navigator.userAgent.indexOf("MSIE") > 0);
},
AttachEvent : function(obj, eventName, delegate)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
if (typeof( obj.addEventListener ) != 'undefined' )
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
obj.addEventListener(Site.GetEventName(eventName),delegate,false);
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
else
{
obj.attachEvent(eventName,delegate);
}
},
DetachEvent : function(obj,eventName,delegate)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (obj.removeEventListener)
{
obj.removeEventListener(eventName,delegate, true);
}
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
else if (obj.detachEvent)
{
obj.detachEvent(eventName,delegate);
}
},
GetEventName : function (name)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return (name.indexOf('on') == 0) ? name.substring(2,name.length) : name;
},
SelectInitInput : function (name)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
Site.AttachEvent(window,'onload',new Function('Site.SelectInput("' + name + '")'));
},
SelectInput : function (name)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
var input = document.getElementById(name);
input.select();input.focus();
},
SrcElement : function(evt)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
return (window.event) ? event.srcElement : evt.target;
},
IsClickedEnter : function(evt)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
var keycode = (window.event) ? window.event.keyCode : evt.which;
return (keycode == 13);
},
ClickedEnter : function(evt,enterElemId)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
if (Site.IsClickedEnter(evt))
{
document.getElementById(enterElemId).click();
return false;
}
return true;
},
WriteHTML : function (str)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
for(i = 0 ; i < str.length ; i++)
{
document.write(String.fromCharCode(4^str.charCodeAt(i)));
}
},
HandleErrorGlobal : function(strErrorMsg,strUrl,iLineNumber)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
{
window.status = strErrorMsg + ': Line:' + iLineNumber;
return true;
}
}
window.onerror = Site.HandleErrorGlobal;
使用方法:
<span id="rot45638" style="height:80px;width:130px;"></span>
<script>var rot45638obj = new Rotator("rot45638",10,80,5000);Site.AttachEvent(window,"onload",new Function('rot45638obj.Init()'));</script>
完整JS:
https://files.cnblogs.com/raylynn/Site.jshttps://files.cnblogs.com/raylynn/Flash.js