2015-12-05 178 views
-1

我是一個菜鳥程序員,我最近開始了一個html網站。這將是我和我的朋友之間的一個項目。它主要包含Flash遊戲,但我從一個名爲「chatbutton.com」的網站添加了一個「聊天」功能。屏幕左側有三個按鈕,「遊戲」,「聊天」和「關於」。當我在「遊戲」和「關於」頁面上時,所有按鈕都可以正常工作,但是當我在「聊天」頁面上時,「遊戲」按鈕似乎不起作用。以下是聊天頁面的代碼:這個按鈕爲什麼不工作?

<HTML> 
<HEADER> 
    <TITLE>CBgames.com</TITLE> 
</HEADER> 
<BODY bgcolor=#474747 text=#FFFFFF> 
    <CENTER> 
     <img src="siteimages/title.gif"> 
    </CENTER> 
    <table> 
<tr> 
    <td><img 
    <a href=file:///C:/Users/user/Desktop/htmlwebsite/games.html> 
     <img src="siteimages/gamesbutton.gif" onmouseover="this.src='siteimages/mouseovergamesbutton.gif';" onmouseout="this.src='siteimages/gamesbutton.gif'" /><br> 
    <a href=file:///C:/Users/user/Desktop/htmlwebsite/chat.html> 
     </br><img src="siteimages/chatbutton.gif" onmouseover="this.src='siteimages/mouseoverchatbutton.gif';" onmouseout="this.src='siteimages/chatbutton.gif'" /><br> 
    <a href=file:///C:/Users/user/Desktop/htmlwebsite/about.html> 
     </br><img src="siteimages/aboutbutton.gif" onmouseover="this.src='siteimages/mouseoveraboutbutton.gif';" onmouseout="this.src='siteimages/aboutbutton.gif'" /><br> 
</br></td> 
    <td><iframe name="CHATBUTTON_CHATBOX" id="CHATBUTTON_CHATBOX" src="https://www.chatbutton.com/chatroom/18374628/" width="1500" height="700" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no"><a href="https://www.chatbutton.com/chatroom/18374628/">Enter Chat Room</a></iframe> 
    <script type="text/javascript"> 
     CHBT_channel="18374628"; 
     CHBT_profanityfilter="1"; 
     CHBT_position="inline"; 
     </script> 
     <script type="text/javascript" src="https://www.chatbutton.com/c.js"> 
     </script> 
    </td> 
     </tr> 
    </table> 
</BODY> 

固定它:我行11

+3

關閉您的主播標籤 – Jay

+1

*「它將主要以Flash遊戲爲特色」* - 您15年前開始使用嗎? – jonrsharpe

+3

你想關閉標籤;例如:'link to google blabla ...' – Blag

回答

3

這是因爲,當你犯了一個標籤(大部分時間),如<a>,你必須關閉它。在代碼中,你創建一個<a>

<a href="file:///C:/Users/user/Desktop/htmlwebsite/about.html"> 

,但從來沒有關閉,所以表中包含的鏈接內。爲了解決這個問題,請關閉所有<a>的如下:

<a href="file:///C:/Users/user/Desktop/htmlwebsite/games.html"> 
    <img src="siteimages/gamesbutton.gif" onmouseover="this.src='siteimages/mouseovergamesbutton.gif';" onmouseout="this.src='siteimages/gamesbutton.gif'" /> 
</a><br> 
<a href="file:///C:/Users/user/Desktop/htmlwebsite/chat.html"> 
    <img src="siteimages/chatbutton.gif" onmouseover="this.src='siteimages/mouseoverchatbutton.gif';" onmouseout="this.src='siteimages/chatbutton.gif'" /> 
</a><br> 
<a href="file:///C:/Users/user/Desktop/htmlwebsite/about.html"> 
    <img src="siteimages/aboutbutton.gif" onmouseover="this.src='siteimages/mouseoveraboutbutton.gif';" onmouseout="this.src='siteimages/aboutbutton.gif'" /> 
</a><br> 

另外,不要忘記把你的文件路徑引號的href")。而且,不需要單獨關閉<br>。你根本不需要關閉它們。

編輯:您在<a>之前有img標記的一部分。要麼刪除它,要麼變成某種東西。

+0

謝謝你,它工作! – Blake

+0

沒問題。另外,如果可以的話,接受我的答案? – k97513

2

意外寫道<img你有你的第一個鏈接之前<img部分標籤。

此外,您需要在<img>之後關閉<a...>標籤,並使用</a>

請注意,您正在引用本地計算機上的文件,因此顯然沒有其他人能夠看到它們。

您可能想要通過HTML驗證程序運行您的代碼。

3

它看起來像你忘了關閉你的標籤<a>標籤結尾</a>標籤。所以你的瀏覽器仍然認爲這個表是超鏈接部分的一部分。

邊注:放在你的報價文件路徑在href =之後