How JavaScript calls Functions
<Js>
<Html xmlns = "http://www.w3.org/1999/xhtml">
Direct javascript function call
I have modified your code. You can directly watch the video. I marked the modification:
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<% Dim aa, dk
Aa = "60.21.218.4"
Dk = "8000" %>
<Script language = "javascript">
Var UserID
Function Play ()
{
Var Netocx = document. getElementById ("NetOCX ");
UserID = Netocx. Login ("<% = aa %>", <% = dk %>, "admin", "12345 ");
Netocx. StartRealPlay (0, 0, 0 );
}
Function Stop ()
{
Var Netocx = document. getElementById ("NetOCX ");
Netocx. StopRealPlay ();
Netocx. Logout ();
}
Function FullScreen ()
{
Var Netocx = document. getElementById ("NetOCX ");
Netocx. FullScreenCtrl ();
}
// Return paly () is not required ()
// Return paly ()
</Script>
</Head>
<Body>
<Table width = "1024" height = "19" border = "0">
<Tr>
& Lt; td width = "1024" height = "15" & gt; & lt;/td & gt;
</Tr>
</Table>
<Table width = "789" height = "681" border = "0">
<Tr>
<Td height = "314" colspan = "3" align = "center"> <object classid = "clsid: CAFCF48D-8E34-4490-8154-026191D73924" codebase = ".. /codebase/NetVideoActiveX23.cab # version = 2, 3, 6, 1"
Standby = "Waiting..." id = "NetOCX" width = "400" height = "300" name = "ocx" ...... the remaining full text>
Why cannot the following javascript Functions be called?
<A href = "javascript: void (0)" onclick = "showandhide ('deppt1')"> department 1 </a>
Generally, neither of them is a js statement.
The previous href = "#" is better... although the previous statement is empty, it is still very confusing.
<Tr id = "dept1" style = "display:"> the error message is displayed.
Your JS statement control is definitely ineffective.
It should be <tr id = "dept1" style = "display: none;">
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 Transitional // EN" "www.w3.org/TR/html4/loose.dtd">
<Html>
<Head>
<Title> test </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = GB18030">
<Script language = "javascript">
Function showandhide (n)
{
Var oTrow = document. getElementById (n );
If (oTrow. style. display = 'None ')
{OTrow. style. display = '';}
Else
{OTrow. style. display = 'none ';}
}
</Script>
</Head>
<Body>
<Table>
<Tr>
<Td>
<A href = "#" onclick = "showandhide ('deppt1');"> department 1 </a>
</Td>
</Tr>
<Tr id = "dept1" style = "">
<Td>
<Table>
<Tr> <td> personnel 1 </td> </tr>
<Tr> <td> personnel 1 </td> </tr>
</Table>
</Td>
</Tr>
</Table>
</Body>
<& #47 ...... remaining full text>