当前位置: 代码迷 >> ASP.NET >> 后台.cs调用前台JS的有关问题
  详细解决方案

后台.cs调用前台JS的有关问题

热度:2170   发布时间:2013-02-25 00:00:00.0
后台.cs调用前台JS的问题
C# code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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>Untitled Page</title>    <script type="text/javascript">        function UploadClick() {                           var  i = 1 ;                    var j;                    var k;                    var aCannel;                    var aIP;                    aCannel = document.getElementById("ListCannel")                    aIP = document.getElementById("ListIP")                    var ds0 = aCannel[0].value;                    var dm0 = aIP[0].value;                    var ds1 = aCannel[1].value;                    var dm1 = aIP[1].value;                    var ds2 = aCannel[2].value;                    var dm2 = aIP[2].value;                    var mm = parseInt(ds0);                    i=document.getElementById("OBJECT1").Initvideo(ds0, dm0,0);                    j=document.getElementById("OBJECT2").Initvideo(2, "192.168.3.102",0);                    k=document.getElementById("OBJECT3").Initvideo(3, "192.168.3.102",0);                    alert(k) ;                          }        function UnloadClick(){                    var i;                    var j;                    var k;                    i=document.getElementById("OBJECT1").DeInitvideo();                    j=document.getElementById("OBJECT2").DeInitvideo();                    k=document.getElementById("OBJECT3").DeInitvideo();                    alert(k) ;                          }         function StartRecordClick() {                           var  i;                    var j;                    var k;                    var aCannel;                    var aIP;                    aCannel = document.getElementById("ListCannel")                    var ds0 = aCannel[0].value;                    var ds1 = aCannel[1].value;                    var ds2 = aCannel[2].value;                     i=document.getElementById("OBJECT1").Videotape(1);                    j=document.getElementById("OBJECT2").Videotape(2);                    k=document.getElementById("OBJECT3").Videotape(3);                    alert(k);                              }         function EndRecordClick() {                           var  i;                    var j;                    var k;                    var aCannel;                    var aIP;                    aCannel = document.getElementById("ListCannel")                    var ds0 = aCannel[0].value;                    var ds1 = aCannel[1].value;                    var ds2 = aCannel[2].value;                    i=document.getElementById("OBJECT1").DeVideotape(1);                    j=document.getElementById("OBJECT2").DeVideotape(2);                    k=document.getElementById("OBJECT3").DeVideotape(3);                    alert(k);                              }    </script></head><body>    <form id="form1" runat="server">    <asp:Button ID="button5" Text="测试" runat="server" />    <asp:DropDownList ID="ListCannel" runat="server" Width="100px">    </asp:DropDownList>    <asp:DropDownList ID="ListIP" runat="server" Width="120px">    </asp:DropDownList>    <div>        <span style="border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;            border-bottom: gray 1px solid;">            <object id="OBJECT1" width="400" height="300" classid="CLSID:D3170B47-FEDD-4BC4-AF03-004B5F253EC4">            </object>        </span><span style="border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;            border-bottom: gray 1px solid;">            <object id="OBJECT2" width="400" height="300" classid="CLSID:D3170B47-FEDD-4BC4-AF03-004B5F253EC4">            </object>        </span><span style="border-right: gray 1px solid; border-top: gray 1px solid; border-left: gray 1px solid;            border-bottom: gray 1px solid;">            <object id="OBJECT3" width="400" height="300" classid="CLSID:D3170B47-FEDD-4BC4-AF03-004B5F253EC4">            </object>        </span>    </div>    &nbsp;</form>    <p>        <input id="Button1" type="button" value="开启视频" onclick="UploadClick()" /></p>    <p>        <input id="Button2" type="button" value="关闭视频" onclick="UnloadClick()" /></p>    <p>        <input id="Button3" type="button" value="开始录像" onclick="StartRecordClick()" /></p>    <p>        <input id="Button4" type="button" value="结束录像" onclick="EndRecordClick()" /></p></body></html>
  相关解决方案