Functions used to display flash in Sina

Source: Internet
Author: User

Functions used to display flash in Sina. They can be used after formatting.
Sinaflash. js
Copy codeThe Code is as follows:
/**
* @ Author [sina] zhangping1 @
* @ Version v1.1.3
* Date: 2006-9-8 2006-12-15
*/
If (typeof (sina )! = "Object") {var sina = {}}
Sina. $ = function (objId) {if (! ObjId) {throw new Error ("sina. $ (String objId) parameter must be ")}
If (document. getElementById) {return eval ('document. getElementById ("'+ objId +'") ')} else if (document. layers) {return eval ("document. layers ['"+ objId +"'] ")} else {return eval ('document. all. '+ objId )}}
SinaFlash = function (C, v, x, V, c, X, I, O, I, l, o) {var z = this; if (! Document. createElement |! Document. getElementById) {return}
Z. id = v? V: ""; z. classid = "clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"; z. codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + (c? C: "7") + ", 0, 0"; z. width = x; z. height = V; z. movie = C; z. bgcolor = X? X: null; z. quality = O? O: "high"; z. src = z. movie; z. pluginspage = "http://www.macromedia.com/go/getflashplayer"; z. type = "application/x-shockwave-flash"; z. useExpressInstall = I? I: null; z. xir = (I )? I: window. location; z. redirectUrl = l? L: null; z. detectKey = o? O: null; z. escapeIs = false; z. objAttrs ={}; z. params = {}; z. flashVars = []; z. flashVarsStr = ""; z. embedAttrs ={}; z. forSetAttribute ("id", z. id); z. objAttrs ["classid"] = z. classid; z. forSetAttribute ("codebase", z. codebase); z. forSetAttribute ("width", z. width); z. forSetAttribute ("height", z. height); z. forSetAttribute ("movie", z. movie); z. forSetAttribute ("quality", z. quality); z. forSetAttribute ("pluginspage", z. pluginspage); z. forSetAttribute ("type", z. type); z. forSetAttribute ("bgcolor", z. bgcolor )}
SinaFlash. prototype = {getFlashHtml: function () {var I = this, I = '<object'; for (var l in I. objAttrs) {I + = l + '= "' + I. objAttrs [l] + '"'}
I + = '>'; for (var l in I. params) {I + = '<param name = "' + l + '" value = "' + I. params [l] + '"/> '}
If (I. flashVarsStr! = "") {I + = '<param name = "FlashVars" value = "' + I. flashVarsStr + '"/> '}
I + = '<embed'; for (var l in I. embedAttrs) {I + = l + '= "' + I. embedAttrs [l] + '"'}
I + = '> </embed> </object>'; return I}, forSetAttribute: function (I, I) {var l = this; I = I. toLowerCase (); switch (I) {case "classid": break; case "pluginspage": l. embedAttrs ["pluginspage"] = I; break; case "src": l. embedAttrs ["src"] = I; l. params ["movie"] = I; break; case "movie": l. params ["movie"] = I; l. embedAttrs ["src"] = I; break; case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ond BlClick ": case" ondrag ": case" ondragend ": case" ondragenter ": case" ondragleave ": case" ondragover ": case" ondrop ": case" onfinish ": case "onfocus": case "onhelp": case "onmousedown": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress ": case "onkeydown": case "onkeyup": case "onload": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete ": Case" onrowenter ": case" onrowexit ": case" onrowsinserted ": case" onstart ": case" onscroll ": case" onbeforeeditfocus ": case" onactivate ": case "onbeforedeactivate": case "ondeactivate": case "type": l. embedAttrs ["type"] = I; break; case "codebase": l. objAttrs ["codebase"] = I; break; case "width": l. objAttrs ["width"] = I; l. embedAttrs ["width"] = I; break; case "height": l. objAttrs ["height"] = I; l. embedAttrs ["height"] = I; break; Case "align": l. objAttrs ["align"] = I; l. embedAttrs ["align"] = I; break; case "vspace": l. objAttrs ["vspace"] = I; l. embedAttrs ["vspace"] = I; break; case "hspace": l. objAttrs ["hspace"] = I; l. embedAttrs ["hspace"] = I; break; case "class": l. objAttrs ["class"] = I; l. embedAttrs ["class"] = I; break; case "title": l. objAttrs ["title"] = I; break; case "accesskey": l. objAttrs ["accesskey"] = I; break; case "name": l. objAttrs ["name"] = I; l. embedAttr S ["name"] = I; break; case "id": l. objAttrs ["id"] = I; l. embedAttrs ["name"] = I; break; case "tabindex": l. objAttrs ["tabindex"] = I; break; default: l. params [I] = l. embedAttrs [I] = I }}, forGetAttribute: function (I) {var I = this; I = I. toLowerCase (); if (I. objAttrs [I]! = Undefined) {return I. objAttrs [I]} else if (I. embedAttrs [I]! = Undefined) {return I. embedAttrs [I]} else if (I. embedAttrs! = Undefined) {return I. embedAttrs [I]} else {return null }}, setAttribute: function (I, I) {this. forSetAttribute (I, I)}, getAttribute: function (I) {return this. forGetAttribute (I)}, addVariable: function (I, I) {var l = this; if (l. escapeIs) {I = escape (I); I = escape (I )}
If (l. flashVarsStr = "") {l. flashVarsStr = I + "=" + I} else {l. flashVarsStr + = "&" + I + "=" + I}
L. embedAttrs ["FlashVars"] = l. flashVarsStr}, getVariable: function (I) {var o = this, I = o. flashVarsStr; if (o. escapeIs) {I = escape (I )}
Var l = new RegExp (I + "= ([^ \ &] *) (\\&?) "," I "cmd.exe c (I); if (o. escapeIs) {return unescape (RegExp. $1 )}
Return RegExp. $1}, addParam: function (I, I) {this. forSetAttribute (I, I)}, getParam: function () {return this. forGetAttribute (name)}, write: function (I) {var I = this; if (typeof I = "string") {sina. $ (I ). innerHTML = I. getFlashHtml ()} else if (typeof I = "object") {I. innerHTML = I. getFlashHtml ()}}}/**
* @ Author [sina] zhangping1 @
* @ Version v1.1.3
* Date: 2006-9-8 2006-12-15
*/
If (typeof (sina )! = "Object "){
Var sina = {
}
}
Sina. $ = function (objId ){
If (! ObjId ){
Throw new Error ("sina. $ (String objId) parameter must be ")
}
If (document. getElementById ){
Return eval ('document. getElementById ("'+ objId + '")')
} Else if (document. layers ){
Return eval ("document. layers ['" + objId + "']")
} Else {
Return eval ('document. all. '+ objId)
}
}
SinaFlash = function (C, v, x, V, c, X, I, O, I, l, o ){
Var z = this;
If (! Document. createElement |! Document. getElementById ){
Return
}
Z. id = v? V :"";
Z. classid = "clsid: D27CDB6E-AE6D-11cf-96B8-444553540000 ";
Z. codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=" + (c? C: "7") + ", 0, 0 ";
Z. width = x;
Z. height = V;
Z. movie = C;
Z. bgcolor = X? X: null;
Z. quality = O? O: "high ";
Z. src = z. movie;
Z. pluginspage = "http://www.macromedia.com/go/getflashplayer ";
Z. type = "application/x-shockwave-flash ";
Z. useExpressInstall = I? I: null;
Z. xir = (I )? I: window. location;
Z. redirectUrl = l? L: null;
Z. detectKey = o? O: null;
Z. escapeIs = false;
Z. objAttrs = {
};
Z. params = {
};
Z. flashVars = [];
Z. flashVarsStr = "";
Z. embedAttrs = {
};
Z. forSetAttribute ("id", z. id );
Z. objAttrs ["classid"] = z. classid;
Z. forSetAttribute ("codebase", z. codebase );
Z. forSetAttribute ("width", z. width );
Z. forSetAttribute ("height", z. height );
Z. forSetAttribute ("movie", z. movie );
Z. forSetAttribute ("quality", z. quality );
Z. forSetAttribute ("pluginspage", z. pluginspage );
Z. forSetAttribute ("type", z. type );
Z. forSetAttribute ("bgcolor", z. bgcolor)
}
SinaFlash. prototype = {
GetFlashHtml: function (){
Var I = this, I = '<object ';
For (var l in I. objAttrs ){
I + = l + '= "' + I. objAttrs [l] + '"'
}
I + = '> ';
For (var l in I. params ){
I + = '<param name = "' + l + '" value = "' + I. params [l] + '"/>'
}
If (I. flashVarsStr! = ""){
I + = '<param name = "FlashVars" value = "' + I. flashVarsStr + '"/>'
}
I + = '<embed ';
For (var l in I. embedAttrs ){
I + = l + '= "' + I. embedAttrs [l] + '"'
}
I + = '> </embed> </object> ';
Return I
}, ForSetAttribute: function (I, I ){
Var l = this;
I = I. toLowerCase ();
Switch (I ){
Case "classid": break;
Case "pluginspage": l. embedAttrs ["pluginspage"] = I;
Break;
Case "src": l. embedAttrs ["src"] = I;
L. params ["movie"] = I;
Break;
Case "movie": l. params ["movie"] = I;
L. embedAttrs ["src"] = I;
Break;
Case "onafterupdate": case "onbeforeupdate": case "onblur": case "oncellchange": case "onclick": case "ondblClick": case "ondrag": case "ondragend ": case "ondragenter": case "ondragleave": case "ondragover": case "ondrop": case "onfinish": case "onfocus": case "onhelp": case "onmousedown ": case "onmouseup": case "onmouseover": case "onmousemove": case "onmouseout": case "onkeypress": case "onkeydown": case "onkeyup": case "onload ": case "onlosecapture": case "onpropertychange": case "onreadystatechange": case "onrowsdelete": case "onrowenter": case "onrowexit": case "onrowsinserted": case "onstart ": case "onscroll": case "onbeforeeditfocus": case "onactivate": case "onbeforedeactivate": case "ondeactivate": case "type": l. embedAttrs ["type"] = I;
Break;
Case "codebase": l. objAttrs ["codebase"] = I;
Break;
Case "width": l. objAttrs ["width"] = I;
L. embedAttrs ["width"] = I;
Break;
Case "height": l. objAttrs ["height"] = I;
L. embedAttrs ["height"] = I;
Break;
Case "align": l. objAttrs ["align"] = I;
L. embedAttrs ["align"] = I;
Break;
Case "vspace": l. objAttrs ["vspace"] = I;
L. embedAttrs ["vspace"] = I;
Break;
Case "hspace": l. objAttrs ["hspace"] = I;
L. embedAttrs ["hspace"] = I;
Break;
Case "class": l. objAttrs ["class"] = I;
L. embedAttrs ["class"] = I;
Break;
Case "title": l. objAttrs ["title"] = I;
Break;
Case "accesskey": l. objAttrs ["accesskey"] = I;
Break;
Case "name": l. objAttrs ["name"] = I;
L. embedAttrs ["name"] = I;
Break;
Case "id": l. objAttrs ["id"] = I;
L. embedAttrs ["name"] = I;
Break;
Case "tabindex": l. objAttrs ["tabindex"] = I;
Break;
Default: l. params [I] = l. embedAttrs [I] = I
}
}, ForGetAttribute: function (I ){
Var I = this;
I = I. toLowerCase ();
If (I. objAttrs [I]! = Undefined ){
Return I. objAttrs [I]
} Else if (I. embedAttrs [I]! = Undefined ){
Return I. embedAttrs [I]
} Else if (I. embedAttrs! = Undefined ){
Return I. embedAttrs [I]
} Else {
Return null
}
}, SetAttribute: function (I, I ){
This. forSetAttribute (I, I)
}, GetAttribute: function (I ){
Return this. forGetAttribute (I)
}, AddVariable: function (I, I ){
Var l = this;
If (l. escapeIs ){
I = escape (I );
I = escape (I)
}
If (l. flashVarsStr = ""){
L. flashVarsStr = I + "=" + I
} Else {
L. flashVarsStr + = "&" + I + "=" + I
}
L. embedAttrs ["FlashVars"] = l. flashVarsStr
}, GetVariable: function (I ){
Var o = this, I = o. flashVarsStr;
If (o. escapeIs ){
I = escape (I)
}
Var l = new RegExp (I + "= ([^ \ &] *) (\\&?) "," I "cmd.exe c (I );
If (o. escapeIs ){
Return unescape (RegExp. $1)
}
Return RegExp. $1
}, AddParam: function (I, I ){
This. forSetAttribute (I, I)
}, GetParam: function (){
Return this. forGetAttribute (name)
}, Write: function (I ){
Var I = this;
If (typeof I = "string "){
Sina. $ (I). innerHTML = I. getFlashHtml ()
} Else if (typeof I = "object "){
I. innerHTML = I. getFlashHtml ()
}
}
}

Call method:
Copy codeThe Code is as follows:
<Div>
<! -- ADS: begin = pdps%%3139: {597CD25D-FAF8-405B-9164-01639EBFB760} --> <! -- 01639EBFB760 --> <div id = "flashcontent_01639EBFB760"> Flash not supported </div>
<Script type = "text/javascript">
Var objFlash = new sinaFlash ("http://ad4.sina.com.cn/200703/28/86132_58590.swf", "", "585", "90", "7", "", false, "high ");
ObjFlash. addParam ("wmode", "opaque ");
ObjFlash. addVariable ("adlink", escape ("http://bf.sina.com.cn/newbf/zt/07qycs.html "));
ObjFlash. write ("flashcontent_01639EBFB760 ");
</Script> <! -- $ AE/2007-4-1 ~ 2007-4-1/A $ --> <! -- ADS: end -->
</Div>



<! -- Advertisement begin -->
<Div>
<! -- The third screen on the Sina homepage starts with the 10th bar -->
<! -- ADS: begin = PDPS000000000794: {A5AB42A8-EFEB-46AE-A24F-97C36D34A728} --> <! -- 97C36D34A728 --> <div id = "flashcontent_97C36D34A728"> Flash not supported </div>
<Script type = "text/javascript">
Var objFlash = new sinaFlash ("http://ad4.sina.com.cn/200704/02/86722_sina402news58550.swf", "", "585", "50", "7", "", false, "high ");
ObjFlash. addParam ("wmode", "opaque ");
ObjFlash. write ("flashcontent_97C36D34A728 ");
</Script> <! -- $ Litong/2007-4-2 ~ 2007-4-6/B $ --> <! -- ADS: end -->
<! -- The third page of Sina homepage ends with the 10th bar -->
</Div>
<! -- Ad end -->

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.