為什么運(yùn)行不了呢?
? <script type="text/javascript">
var mychar=document.getElementById("txt");
? ? function changeColor(){
? ? ? ? mychar.style.color="red";
? ? ? ? mychar.style.backgroundColor="blue";
? ? }
? ? function changeSize(){
? ? ? ? mychar.style.width="200px";
? ? ? ? mychar.style.height="300px";
? ? }
? ? function hidetext(){
? ? ? ? mychar.style.display="none";
? ? }
? ? function showtext(){
? ? ? ? mychar.style.display="block";
? ? }
? ? function resttext(){
? ? ? ? var message = confirm("你確定要重置所有設(shè)置么?");
? ? ? ? if(message==true){
? ? ? ? ? ? mychar.removeAttribute("style");
? ? ? ? }
? ? }
</script>
2016-04-22
var message = confirm("你確定要重置所有設(shè)置么?");分號(hào)錯(cuò)誤應(yīng)為英文狀態(tài)的 ' ; '
2016-04-22
你在input里面是否調(diào)用了各個(gè)函數(shù),我瞅了瞅你的代碼沒(méi)什么錯(cuò)誤 ,你自己找找有沒(méi)有不是英文符號(hào)的,是中文的
2016-04-22
?<!--當(dāng)點(diǎn)擊相應(yīng)按鈕,執(zhí)行相應(yīng)操作,為按鈕添加相應(yīng)事件-->
? ? <input type="button" value="改變顏色" onclike="test1()" /> ?
? ? <input type="button" value="改變寬高" onclick="test2()" />
? ? <input type="button" value="隱藏內(nèi)容" onclick="test3()" />
? ? <input type="button" value="顯示內(nèi)容" onclick="test4()" />
? ? <input type="button" value="取消設(shè)置" onclick="test5()" />
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
var a=getElementById("txt");
function test1()
{a.style.color="red";
a.style.background="blue";
? ??
}
//定義"改變寬高"的函數(shù)
function test2()
{a.style.width="700px";
a.style.height="300px";
? ??
}
//定義"隱藏內(nèi)容"的函數(shù)
function test3(){
? ? a.style.display="none";
? ??
}
//定義"顯示內(nèi)容"的函數(shù)
function test4(){
a.style.display="block";
}
//定義"取消設(shè)置"的函數(shù)
function test5(){
? ? var reset = confirm("是否取消設(shè)置?");
? ? if(reset=true){
? ? ? ? mychar.removeAttribute("style");
? ? ? ??
? </script>
我這個(gè)也運(yùn)行不了 不知道什么問(wèn)題
2016-04-21
<form>
??? <input type="button" value="改變顏色" onclick="changeColor()"> ?
??? <input type="button" value="改變寬高" onclick="changeSize()">
??? <input type="button" value="隱藏內(nèi)容" onclick="hidetext()">
??? <input type="button" value="顯示內(nèi)容" onclick="showtext()">
??? <input type="button" value="取消設(shè)置" onclick="resttext()">
? </form>
2016-04-21
button點(diǎn)擊事件添加了沒(méi)有,看不到回答個(gè)毛