惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

小众软件
小众软件
A
About on SuperTechFans
博客园 - Franky
Engineering at Meta
Engineering at Meta
Recent Announcements
Recent Announcements
云风的 BLOG
云风的 BLOG
B
Blog
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
U
Unit 42
Martin Fowler
Martin Fowler
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 叶小钗
Vercel News
Vercel News
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
Last Week in AI
Last Week in AI
腾讯CDC
Microsoft Azure Blog
Microsoft Azure Blog
爱范儿
爱范儿
V
V2EX
G
Google Developers Blog

博客园 - IamV

ADO.NET Entity Framework: 由 Entity Object 執行 SQL 指令 Expression<Func<int, bool>>与<Func<int, bool> search something from db [转]python文件操作/打开/删除文件/压缩文件 Flash与3D编程探秘 - 文章目录 silverlight RenderTransform 后台动画设置 2104 Couldn't download the silverlight application Cannot connect to external websites - WebClient - IamV .NET下多线程中设置按钮的文本 - IamV - 博客园 [Desklighter]在桌面上运行你的Silverlight文件 [转]Silverlight 2.0 正式版跨域提交数据 Application.DoEvent() 转:C#线程调用带参数的方法 [转]深入了解字符集和编码 Office SharePoint Server Search与Windows SharePoint Services Search 调用WCF返回Josn的两种方式 asp.net Excel_MyTest SharePoint-Server Farm Configuration Not Complete Using JSON with ASP.NET 3.5
How to Embed Silverlight Content in HTML
IamV · 2009-02-10 · via 博客园 - IamV

1.http://blogs.msdn.com/tims/archive/2007/07/31/iframe-support-in-silverlight-streaming.aspx

   http://silverlight.net/forums/p/3722/10851.aspx

   This-> http://www.ddj.com/architect/202800424?pgno=2

----------------------------------------------------------------

先来个js文件 用于第二种 embed

using <DIV> tag embed Flash and Silverlight

----------------------------------------------------------------

//IamV_flash
//IamV_silverlight

function IamV_Initialize() {
    var myLayers = document.getElementsByTagName('div');
    if (myLayers.length <= 0)
        return;

    var myDiv = null;
    var sHtml = null;
    for (i = 0; i < myLayers.length; i++) {
        myDiv = myLayers[i];
        if (myDiv.className == 'IamV_flash') {
            sHtml = getFlash(myDiv.id);
            myDiv.innerHTML = sHtml;
            continue;
        }
        if (myDiv.className == 'IamV_silverlight') {
            sHtml = getSilverLight(myDiv.id);
            myDiv.innerHTML = sHtml;
            continue;
        }
    }
}
function getFlash(url) {
    return '<object width="100%" height="100%">'
            //+ '<param name="movie" value="' + url + '"></param>'
            + '<param name="allowFullScreen" value="true"></param>'
            + '<param name="allowscriptaccess" value="always"></param>'
            + '<embed src="' + url + '" type="application/x-shockwave-flash"'
            + 'allowscriptaccess="always" allowfullscreen="true" width="100%" height="100%"></embed></object>';
}
function getSilverLight(url) {
    return '<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">'
   + '<param name="source" value="' + url + '"/>'
   + '<param name="background" value="white" />'
   + '<param name="minRuntimeVersion" value="2.0.31005.0" />'
   + '<param name="autoUpgrade" value="true" />'
   + '<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">'
       + ' <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>'
   + '</a>'
      + '</object>';
}

----------------------------------------------------------------

测试的HTML文件

----------------------------------------------------------------

<html>
<head>
</head>
<body>
 <p>第一种.参见http://www.cnblogs.com/nasa/archive/2008/02/14/1068654.html</p>
 <script type="text/xaml" id="xamlContent">
        <?xml version="1.0"?>
        <Canvas
            xmlns="http://schemas.microsoft.com/client/2007"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
          <Rectangle
            Height="200"
            Width="200"
            Stroke="Black"
            Fill="Wheat"
            StrokeThickness="5"
            RadiusX="10.0"
            RadiusY="10.0"/>
          <TextBlock Canvas.Top="100" Canvas.Left="10">
            No Javascript, wheeeee!!!
          </TextBlock>
        </Canvas>
    </script>

    <div id="controlHost">
        <object
            id="silverlightControl"
            type="application/x-silverlight"
            height="800"
            width="600">
          <param name="Source" value="http://172.28.3.85/IamVSilverlight/ClientBin/IamVImageRotator.xap" />
        </object>
    </div>
  <br />
 <p>第二种.使用上面的JS文件,用于过滤object tag 的情况</p>
 <br />
<script type="text/javascript" src="http://172.28.3.85/SL_inHtml/Silverlight_Helper.js%22%3E%3C/script>

<div id='http://172.28.3.85/IamVSilverlight/ClientBin/IamVImageRotator.xap' class='IamV_silverlight' style="border-style: solid; border-width: 1px; width: 500px; height: 400px;">
 <script type="text/javascript">IamV_Initialize()</script>
 </div>

<input type='button' value='getSL' text='IamV'
 onclick='getElementById("tt").value=getSilverLight("http://172.28.3.85/IamVSilverlight/ClientBin/IamVImageRotator.xap%22);'/>
 <br />
 <textarea id="tt" cols="60" rows="8"></textarea>
 <br />
  <br />
 <p>第三种.简单的</p>
 <br />
<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
<param name="source" value="http://172.28.3.85/IamVSilverlight/ClientBin/IamVImageRotator.xap%22/>
<param name="background" value="white" />
<param name="minRuntimeVersion" value="2.0.31005.0" />
<param name="autoUpgrade" value="true" />
<a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;"> 
<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/></a>
</object>
  <br />
 <p>第四种.using embed tag,使用 embed 标签</p>
 <br />
<embed type="application/x-silverlight-2" id="silverlightControl"
  width="500" height="400" background="white"
  source="http://172.28.3.85/IamVSilverlight/ClientBin/IamVImageRotator.xap%22/>
<br />

<br />
<embed allowScriptAccess="never" allowNetworking="internal"
 type="application/x-silverlight-2"
 width="500" height="400" background="white"
 source="http://172.28.3.85/IamVSilverlight/ClientBin/IamVImageRotator.xap%22/>


</body>
</html>