JavaScript對於函數的調用及原理,javascript調用

來源:互聯網
上載者:User

JavaScript對於函數的調用及原理,javascript調用

<js>

<html xmlns="http://www.w3.org/1999/xhtml"><head>    <title></title>    <style type="text/css">        .div1{ width:100px; height:50px; background-color:Gray; opacity: 0.5; border:1px solid red;  box-shadow:0 0 50px inset;  border-radius:10px; margin:100px auto}    </style>    <script type="text/javascript">        function gaibian() {            document.title = "廣東易通"; //改變網頁標題為“廣東易通”            window.alert("哈哈"); //彈出一個視窗,視窗中顯示“哈哈”            window.location = "http://www.baidu.com"; //頁面跳轉到百度        }            </script></head><body style=" margin:0px; padding:0px"><div class="div1"  onclick="gaibian()"></div>   <!--這個“gaibian”就是我要單擊div的時候要執行的這麼一個事,這個事就叫“gaibian”後面的那個()就表示“執行”--><!--<div class="div1"  onclick="gaibian()"></div>;這個div就能夠響應單擊事件了。當使用者單擊這個div的時候,瀏覽器就會被執行一個叫做“gaibian”的事件。()這個圓括弧就表示執行,絕對不能缺少--></body></html>


javascript函數直接調用的問題

你的這些代碼 我做了修改。可以直接觀看。修改處 我做了標記:

<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 ()

//return paly ()

</script>
</head>

<body>
<table width="1024" height="19" border="0">
<tr>
<td width="1024" height="15"> </td>
</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"......餘下全文>>
 
為何下面的javascript函數不可以被調用

<a href="javascript:void(0)" onclick="showandhide('dept1')">部門1</a>

通常不要兩個都是js語句
前一個 href="#" 比較好..雖然前頭的語句是空的,但還是很容易混淆

<tr id="dept1" style="display:">這句話錯了 本來就是顯示的
你JS語句控制顯示 肯定沒效果
應該是<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>測試</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('dept1');">部門1</a>
</td>
</tr>

<tr id="dept1" style="">
<td>

<table>
<tr><td>人員1</td></tr>
<tr><td>人員1</td></tr>
</table>

</td>
</tr>
</table>

</body>
<&#47......餘下全文>>
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.