今天在asp.net中调用OCX中的函数,代码如下:
<
html
xmlns="http://www.w3.org/1999/xhtml" >
<
head
runat="server">
<title>
无标题页</title>
<
script
type="text/javascript">
function
JoinGame()
{
var
tgame=document.getElementById("jaocx");
tgame.CreateRoom("0","0");
}
</script>
</
head
>
<
body
>
<form id="form1" runat="server">
<div>
<input type="button" name="button1" value="
创建房间"
onclick="javascript:JoinGame()">
<OBJECT id="jaocx" style="WIDTH: 582px; HEIGHT: 435px" classid="clsid:30A5C9F4-C2A1-4DDB-86F8-05D73DA3EC66" VIEWASTEXT>
<PARAM NAME="_Version" VALUE="65536">
<PARAM NAME="_ExtentX" VALUE="15452">
<PARAM NAME="_ExtentY" VALUE="6350">
<PARAM NAME="_StockProps" VALUE="0">
</OBJECT> </div></form>
</
body
>
</
html
>
调试一直出不来创建房间对话框,开始以为是代码有错误,后来经高人指点原来是IE没有设置好。经如下设置调试成功。
把http://localhost站点加到信任站点。工具——选项——安全——受信任站点。。。然后点击:站点。