2010-11-02 116 views
0

我的index.php包含一堆php和javascript代碼,並且在html中格式化爲html。我對CSS不太瞭解,但我不認爲這會影響這個html表單的可用性。這是該指數代碼:HTML表單單選按鈕不工作

<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
    <title>Untitled</title> 
    <meta name="description" content="Choose"/> 
    <meta name="keywords" content="choose "/> 
    <link rel="shortcut icon" href="http://i/favicon.ico"> 

    <!--[if lt IE 7]> 
     <script type="text/javascript" src="FullPageBackgroundImage/js/mootools.js"></script> 
     <script type="text/javascript" src="FullPageBackgroundImage/js/core.js"></script> 
    <![endif]--> 


<link rel="stylesheet" type="text/css" href="style.css" /> 

</head> 

<body> 

<div id="content"> 
<div id="poll"> 
<form> 

<input id="ch1" type="radio" name="choice" value="0" /> 
<label for="ch1"> 
<?php echo $current['choice1']; ?> 
</label> 
<br /> 
<input id="ch2" type="radio" name="choice" value="1" /> 
<label for="ch2"> 
<?php echo $current['choice2']; ?> 
</label> 
</form> 
</div> 
hello 

</div> 

</body> 
</html> 

這是CSS:

body { 
    background-color:#000; 
    background:#fff; 
    background-repeat: repeat-x; 
    background-attachment:fixed; 
} 

#top_header{ 
    width:100%; 
    height:52px; 
    background:#FFF; 
    position:fixed; 
    left:0px; 
    top:0px; 
    z-index:-1; 

} 

#logo{ 
    background-image:url('Images/web_buttons.jpg'); 
    position:fixed; 
    top:3px; 
    left:0px; 
    width:366px; 
    height:45px; 

} 

#display{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -40px; 
    position:fixed; 
    top:0px; 
    left:420px; 
    width:57px; 
    height:19px; 

} 

#display_divider{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: -100px -45px; 
    position:fixed; 
    top:0px; 
    left:477px; 
    width:8px; 
    height:50px;  
} 

a.display_single{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -80px; 
    position:fixed; 
    top:0px; 
    left:485px; 
    width:67px; 
    height:26px; 
} 

a:hover.display_single{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -104px; 
    position:fixed; 
    top:0px; 
    left:485px; 
    width:67px; 
    height:26px; 
} 

a.display_multiple{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -128px; 
    position:fixed; 
    top:26px; 
    left:485px; 
    width:86px; 
    height:26px; 
} 
a:hover.display_multiple{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -152px; 
    position:fixed; 
    top:26px; 
    left:485px; 
    width:86px; 
    height:26px; 
} 

#view{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -58px; 
    position:fixed; 
    top:0px; 
    left:620px; 
    width:37px; 
    height:19px;  
} 

#view_divider{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: -100px -45px; 
    position:fixed; 
    top:0px; 
    left:657px; 
    width:8px; 
    height:50px;  
} 

a.view_WTFest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -178px; 
    position:fixed; 
    top:0px; 
    left:665px; 
    width:69px; 
    height:26px; 
} 

a:hover.view_WTFest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -204px; 
    position:fixed; 
    top:0px; 
    left:665px; 
    width:69px; 
    height:26px; 
} 

a.view_lamest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -228px; 
    position:fixed; 
    top:26px; 
    left:665px; 
    width:69px; 
    height:25px; 
} 

a:hover.view_lamest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -253px; 
    position:fixed; 
    top:26px; 
    left:665px; 
    width:69px; 
    height:25px; 
} 

a.view_latest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -275px; 
    position:fixed; 
    top:0px; 
    left:734px; 
    width:69px; 
    height:25px; 
} 

a:hover.view_latest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -300px; 
    position:fixed; 
    top:0px; 
    left:734px; 
    width:69px; 
    height:25px; 

} 

a.view_oldest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -323px; 
    position:fixed; 
    top:26px; 
    left:734px; 
    width:69px; 
    height:26px; 
} 

a:hover.view_oldest{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -348px; 
    position:fixed; 
    top:26px; 
    left:734px; 
    width:69px; 
    height:25px; 

} 

a.submit_choices{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -373px; 
    position:fixed; 
    top:3px; 
    right:3px; 
    width:164px; 
    height:41px; 
} 

a:hover.submit_choices{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: -162px -373px; 
    position:fixed; 
    top:3px; 
    right:3px; 
    width:164px; 
    height:41px; 

} 

a.navigation_left{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -413px; 
    position:fixed; 
    bottom:6px; 
    left:3px; 
    width:134px; 
    height:19px; 
} 

a:hover.navigation_left{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: -134px -413px; 
    position:fixed; 
    bottom:6px; 
    left:3px; 
    width:134px; 
    height:19px; 
} 

a.navigation_right{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: 0px -435px; 
    position:fixed; 
    bottom:6px; 
    right:3px; 
    width:104px; 
    height:19px; 
} 

a:hover.navigation_right{ 
    background-image:url('Images/web_buttons.jpg'); 
    background-position: -134px -435px; 
    position:fixed; 
    bottom:6px; 
    right:3px; 
    width:104px; 
    height:19px; 
} 

/*conten*/ 
#content{ 
    position:relative; 
    top:55px; 
    z-index:-3; 
} 

有了這個,我只能選擇第二個單選按鈕,第一個不能被選擇。奇怪的是,如果我刪除輸入之間的中斷,它可以很好地工作。或者我可以在那裏休息,並在表格後刪除'helloworld',它也可以。

任何人有任何想法或看到任何錯誤?我想對彼此的頂部的按鈕,我需要有下面的其他文字..

的CSS代碼是在這裏

+0

將您的代碼從問題複製粘貼到空白html文件,並確認它確實可行。 – zerkms 2010-11-02 05:17:34

+0

粘貼到您的CSS請 – 2010-11-02 05:27:49

+0

哪些瀏覽器出現這種情況? – Ben 2010-11-02 06:01:25

回答

1

爲什麼你有z-index:-3?您正在告訴瀏覽器將內容放在其他圖層的後面...

+0

我用上面的代碼製作了一個頁面,並進行了一些測試,並且這條線確實是導致問題的原因。 – patmortech 2010-11-02 06:36:56

+0

是的,我應該把它拿出來......非常感謝你們! – Cody 2010-11-02 06:42:03

0

的CSS是幾乎可以肯定這裏有毛病。看起來有一個孩子節點被選中(<br />),當你不這樣做。也可能發生在Javascript中。