2014-04-23 56 views
0

我已經提到了像w3schools這樣的網站,但它顯示圖像變化onmouseover事件,在這裏我想顯示一些信息在表中是透明的,信息是關於頁面上的不同按鈕,怎麼可以我形成的代碼?我曾經嘗試這樣做:jquery onmouseover事件未能觸發

<script> 
     function info(z) { 
      z.style.visible = "true" 
     } 


      function defaultinfo(z) { 
       z.style.display = "block" 
      } 


    </script> 

<style> 
.menu_box { 
      background-color: #999; 
      padding: 2px; 
      color: #C0C0C0; 
      opacity: .9; 
      font-family: Garamond; 
      font-size: xx-large; 
      height: 91px; 
      width: 1125px; 
     } 
</style> 
<div id='cssmenu'> 
     <ul> 
<li><span><a href="StudentDetails.aspx" title="stud" onmouseover="info(this)"  onmouseout="defaultinfo(this)" visible="false">Students' Corner</a></span></li> 
      <li><span><a href="FacultyDetails.aspx" onmouseover="info(this)" onmouseout="defaultinfo(this)" visible="false">Staff Room</a></span></li> 
      <li><span><a href="LibWork.aspx" onmouseover="info(this)" onmouseout="defaultinfo(this)" visible="false">Librarian Workplace</a></span></li> 
      <li><span><a href="AccountSection.aspx" onmouseover="info(this)" onmouseout="defaultinfo(this)" visible="false">Account Section</a></span></li> 
      <li><span><a href="ContactUs.aspx" onmouseover="info(this)" onmouseout="defaultinfo(this)" visible="false">Contact Us</a></span></li> 
      <li><span><a href="ControlPanel.aspx" onmouseover="info(this)" onmouseout="defaultinfo(this)" visible="false">ERP ControlPanel</a></span></li> 
</ul> 



<span class="menu_box" id="defaultinfo" style="color: #FFFFFF; font-size: medium; font-style: italic">For information on this page, role the cursor over the buttons. 
      </span> 
      <span class="menu_box" id="info" style="color: #FFFFFF; font-size: medium; font-style: italic">The students&#39; of saffrony institute of technology may use this button for their respective class notices,attendance and time-table. There are different modules such as &quot;library&quot; where students&#39; can reserve books or request which are unavailable, or modules like &quot;saffrony recycler&quot; where seniors can upload their used-books and sell them to juniors. There are even modules like &quot;student request&quot; where you can post your requests and &quot;student information&quot; where you can view and update your own requests. 
      </span> 
+3

您已經定義了'function defaultinfo(z)',但是您正在調用'onmouseover =「info(this)」'。函數info()沒有被定義。 – showdev

+1

我們需要看到你的JQuery代碼......另外,你不應該使用W3Schools來獲得JQuery幫助,使用他們的API ......這對於很好的例子來說非常有幫助:http://api.jquery.com/mouseover/ – Adjit

+0

另請參見http://www.w3fools.com/ – Scimonster

回答

1

變化

function defaultinfo(z) { 
    z.style.visible = "true" 
} 

function defaultinfo(z) { 
    z.style.display = "block" 
} 

和HTML

visible="false" 

style="display: none;" 
+0

我想你需要指定是否你需要我應用style =「display:none;」因爲我通過在錯誤的地方應用visible =「false」而在代碼中犯了錯誤......請指出我應該在哪裏編寫代碼? – user3447076