日期:2014-05-17  浏览次数:20507 次

后台.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>