我想實現可訪問性工具,我設法改變一個段落的字體大小,一旦按鈕被點擊,但我試圖改變代碼,以便它會在所有段落工作,這是行不通的使用按鈕來改變整個網站使用javascript的字體大小
<script>
function myFunction()
{
var p =document.getElementsByTagName('p'); // Find the element
p.style.fontSize="1.5em"; // Change the style
}
</script>
<button type="button" style="background: #ccc url(images/small.jpg); padding: 0.3em 1em" onclick="myFunction()"></button>
這是怎麼只是一個段落前的工作,但我試圖不止一個:
<script>
function myFunction()
{
x=document.getElementById("demo") // Find the element
x.style.fontSize="3.0em"; // Change the style
}
</script>
請通過'src'屬性與CSS添加圖片。當你使用'src'時'alt'屬性有效。否則,這個「按鈕」不可訪問。 – 2013-02-10 19:15:55