我的博客有SilverLight!这是一个SilverLight数字时钟。
先给出HTML代码:
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>SilverLight数字时钟 --> 我的博客有SilverLight了</title> 5 6 <style type="text/css"><!-- 7 #silverlightControlHost { 8 height: 202px; 9 width:202px; 10 border:1px solid #000; 11 text-align:center; 12 } 13 --></style> 14 <script type="text/javascript" src="https://files.cnblogs.com/jihua/Silverlight.js"></script> 15 <script type="text/javascript">// <![CDATA[ 16 function onSilverlightError(sender, args) { 17 var appSource = ""; 18 if (sender != null && sender != 0) { 19 appSource = sender.getHost().Source; 20 } 21 22 var errorType = args.ErrorType; 23 var iErrorCode = args.ErrorCode; 24 25 if (errorType == "ImageError" || errorType == "MediaError") { 26 return; 27 } 28 29 var errMsg = "Silverlight 应用程序中未处理的错误 " + appSource + "\n"; 30 31 errMsg += "代码: " + iErrorCode + " \n"; 32 errMsg += "类别: " + errorType + " \n"; 33 errMsg += "消息: " + args.ErrorMessage + " \n"; 34 35 if (errorType == "ParserError") { 36 errMsg += "文件: " + args.xamlFile + " \n"; 37 errMsg += "行: " + args.lineNumber + " \n"; 38 errMsg += "位置: " + args.charPosition + " \n"; 39 } 40 else if (errorType == "RuntimeError") { 41 if (args.lineNumber != 0) { 42 errMsg += "行: " + args.lineNumber + " \n"; 43 errMsg += "位置: " + args.charPosition + " \n"; 44 } 45 errMsg += "方法名称: " + args.methodName + " \n"; 46 } 47 48 throw new Error(errMsg); 49 } 50 // ]]></script> 51 </head> 52 <body> 53 54 55 <div id="silverlightControlHost"><object width="100%" height="100%" data="data:application/x-silverlight-2," type="application/x-silverlight-2"> 56 <param name="source" value="https://files.cnblogs.com/jihua/SilverLight.Jihua.Cnblogs.Com.xap" /> 57 <param name="onError" value="onSilverlightError" /><param name="background" value="white" /> 58 <param name="minRuntimeVersion" value="5.0.61118.0" /><param name="autoUpgrade" value="true" /> 59 <param name="src" value="data:application/x-silverlight-2," /> 60 <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=5.0.61118.0" style="text-decoration:none"> 61 <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="获取 Microsoft Silverlight" style="border-style:none" /> 62 </a> </object> 63 <iframe id="_sl_historyFrame" style="visibility: hidden; height: 0px; width: 0px; border: 0px;" width="320" height="240"></iframe> 64 </div> 65 66 </body> 67 </html>