2011-01-19 64 views
0

我做了一個按鈕,打開一個鏈接(網站),但問題是,它只適用於鉻!爲什麼?? link here!鏈接href只適用於鉻

在這裏簡單的HTML代碼>

<!DOCTYPE html PUBLIC "-//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" xml:lang="en" lang="en"> 
    <head> 
<title>HTML and CSS Rounded Corner Button Generated By iWebToolsOnline.com</title> 
<link href="./style.css" rel="stylesheet" type="text/css" /> 
<style href>a {text-decoration: none} </style> 
</head> 
    <body> 
<h3>&nbsp;</h3> 
<button class="rounded"> 
    <a href="http://www.iwebtoolsonline.com/rss-feed-icon-generator"> 
    <span>Save</span> 
    </a> 
</button> 
<br/><br/> 

</body> 
    </html> 

CSS

button { 
border: 0 none; 
cursor: pointer; 
font-weight: bold; 
padding: 0 15px 0 0; 
text-align: center; 
height: 40px; 
line-height: 40px; 
width: auto; 
} 

button.rounded { 
background: transparent url(btn_right.png) no-repeat scroll right top; 
clear: left; 
font-family: "Kristen ITC"; 
font-size: 36px; 

    } 

    button span { 
    display: block; 
    padding: 0 0 0 15px; 
    position: relative; 
    white-space: nowrap; 
    height: 40px; 
    line-height: 40px; 
    } 

    button.rounded span { 
    background: transparent url(btn_left.png) no-repeat scroll left top; 
    color: #FFFFFF; 
    } 

    button.rounded:hover { 
    background-position: 100% -40px; 
    } 

    button.rounded:hover span { 
    background-position: 0% -40px; 
    } 

    button::-moz-focus-inner { 
    border: none; 
    } 

你可以找到我用的鏈接我試着去按鈕生成的鏈接時,發電機不給鏈接的代碼,所以我只是在按鈕中使用href,我這樣做不正確? 還有什麼可能是這個問題?

非常感謝!

+1

也許試試把A標籤放在BUTTON標籤之外? – wmorrell 2011-01-19 01:20:14

回答

0

做這樣的:

<a href="http://www.iwebtoolsonline.com/rss-feed-icon-generator"> 
    <button class="rounded">Save</button> 
    </a> 

但在IE6或7這不會工作(需要用JS(JQuery的例子)來模擬它):

$("a button").click(function() { 
    window.location.href = $(this).parent().attr("href"); 
}); 

但還是在Firefox它會調用兩次該頁面(也許這不重要)。有關於該錯誤的報告(https://bugzilla.mozilla.org/show_bug.cgi?id=577035)。

請記住,在「A」內有「BUTTON」符合W3C標準建議。