English 中文(简体)
jqueryidden/overlay录像机
原标题:jquery hide/overlay video player
  • 时间:2012-05-07 01:03:10
  •  标签:
  • jquery

我从服务器中抽出一个动态的造的html表。 最后,它给我一个表格:

<div id="player"></div>

<table id="webcam-table">
            <thead>
            <tr>
                <th>Camera Name</th>
                <th>Date Created</th>
            </tr>
            </thead>
            <tbody>             
            <tr >
                <td onclick="DoNav( http://myserver.com:1935/recordings/myfile1.mp4 );">
                    Default camera 
                </td>
                <td onclick="DoNav( http://myserver:1935/recordings/myfile1.mp4 );">
                    06 May 2012 07:25:01 
                </td>
                </tr>

            <tr >
                <td onclick="DoNav( http://myserver.com:1935/recordings/myfile2.mp4 );">
                    Default camera 
                </td>
                <td onclick="DoNav( http://myserver.com:1935/recordings/myfile2.mp4 );">
                    06 May 2012 07:24:47 
                </td>
                </tr>
...
</tbody></table>

如果有人在桌上点击这段话,则叫DoNav功能插入录像。

function DoNav(theUrl)
{
var mydiv = $("#player");
var myvideo = $("<video id= myfileplayer  src= "+ theUrl +"  width= 280  height= 200  controls></video>");
mydiv.append(myvideo);
$("#myfileplayer").click(function(){
    $(this).play();
});

}

如果你在桌上一行点击的话,它就发挥了巨大作用。 但是,一旦你在下一行点击,它就增加了另一个下层角色。 我想用刚刚被点击的新角色取代当时在场的参与者。 我尝试在<代码>上添加<代码>$(“#myfileplayer”);hide(;至>末,但只是掩盖了整个参与者。 任何想法?

最佳回答

你们在前一个角色的下台。

function DoNav(theUrl)
{

    // only add the player if it doesn t yet exist
    if($( #myfileplayer ).length == 0) {
        var mydiv = $("#player");
        var myvideo = $("<video id= myfileplayer  src= "+ theUrl +
           "  width= 280  height= 200   controls></video>");
        mydiv.append(myvideo);
    } else {
       $( #myfileplayer ).attr("src",theUrl); 
    }

    $("#myfileplayer").click(function(){
        $(this).play();
    });

} 
问题回答

在你的杜纳职能中,这简单不过了。

mydiv.append(myvideo);

mydiv.html(myvideo);

这样做的是,它取代录像带的内容(旧录像),而不是仅仅在录像带上添加新的录像。





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...