2012-04-30 11 views
0

Eval("link")をiframeタグに渡す必要があります。このeval("link ")は、私は、IFRAMEの最近の項目を表示したいビデオライブラリにアップロードされた最新のビデオを意味します動的URLをiframeに渡す方法は?

<iframe title="YouTube video player" width="525" height="325" src='<%# Eval("link") %>' frameborder="0" ></iframe> 

そのここでは正常に動作しないことが私のコードです:

function OpenDialog() { 
    var options = { 
     url: '/Shared%20Documents/Forms/AllItems.aspx', 
     title:Test modal dialogue, 
     width: 1100, 
     height: 600, 
     left: 50, 
     top: 50, 
     status: 0, 
     toolbar: 0, 
     menubar: 0, 
     resizable: 1, 
     dialogReturnValueCallback: CloseCallback 
    }; 

    SP.UI.ModalDialog.showModalDialog(options); 
    SP.UI.Modal.OpenPopUpPage('Home.aspx', CloseCallback, 1100, 600); 
} 

function autoPlayVideo(vcode, width, height) { 
    "use strict"; $("#videoContainer").html('<iframe width="' + width + '" height="' + height + '" src="https://www.youtube.com/embed/' + vcode + '?autoplay=1&loop=1&rel=0&wmode=transparent" frameborder="0" allowfullscreen wmode="transparent"></iframe>'); 
} 

jQuery('a.introVid').click(function() { autoPlayVideo('Eval("link")', '450', '350'); }); 

function CloseCallback(result, returnValue) { 
    alert('Result from dialog was: ' + result); 
    if (result == SP.UI.DialogResult.Ok) { 
     alert('You clicked Ok'); 
    } 
    else if (result == SP.UI.DialogResult.cancel) { 
     alert('You clicked Cancel'); 
    } 
} 
+1

「リンク」とは何ですか?サーバーから来ていますか? –

+0

あなたのASPコードによって生成されたHTMLを投稿できますか?私は 'Eval(" link ")'が値を返さないと推測しています。 –

+0

Eval( "Link")は、アセットライブラリから値を返す必要があります... – user1328195

答えて

0

コード:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
    <title></title> 
    <script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script> 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      $('a.introVid').live('click', function (e) { 
       e.preventDefault(); 
       autoPlayVideo($(this).data('vcode'), '450', '350'); 
      }); 
     }); 

     function autoPlayVideo(vcode, width, height) { 
      $("#videoContainer").html('<iframe width="' + width + '" height="' + height + '" src="https://www.youtube.com/embed/' + vcode + '?autoplay=1&loop=1&rel=0&wmode=transparent" frameborder="0" allowfullscreen wmode="transparent"></iframe>'); 
     }; 
    </script> 
</head> 
<body> 
    <form id="form1" runat="server"> 
    <div> 
     <a class="introVid" href="#test" data-vcode="u1zgFlCw8Aw">Test Ypu Tube Video</a> 
     <div id="videoContainer"> 
     </div> 
    </div> 
    </form> 
</body> 
</html> 
+0

ライブデモのリンクをご覧ください:http://jsfiddle.net/nanoquantumtech/fDA7z/ – Thulasiram

関連する問題