程序完全沒反應,我找了好長時間錯但是還是沒用,求大神幫忙看看啊QAQ
?</div>
? <form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" ondick="set.changecolor()"> ?
? ? <input type="button" value="改變寬高"ondick="set.changewh()" >
? ? <input type="button" value="隱藏內(nèi)容" ondick="set.none()">
? ? <input type="button" value="顯示內(nèi)容"ondick="set.block()" >
? ? <input type="button" value="取消設置"ondick="set.quxiao()" >
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
var txt=document.getElementById("txt");
? ?var set={
? ? ? ? ?chengecolor:function(){
? ? ? ? ?txt.style.backgroundcolor="red";
txt.style.color="blue";
},
? ? ? ? ?changewh:function(){
? ? ? ? ? ? txt.style.width="500px";
? ? ? ? ? ? txt.style.height="300px";
? ? ? ? ?},
? ? ? ? ?none:function(){
? ? ? ? ? ? txt.style.display="none";
? ? ? ? ?}, ??
? ? ? ? ?block:function(){
? ? ? ? ? ? txt.style.display="block";
? ? ? ? ?},
? ? ? ? ?quxiao:function(){
? ? ? ? ? ? ?var xiaoxi=confirm("確定要取消設置嘛?");
? ? ? ? ? ? ? ? ? if(xiaoxi==true){
? ? ? ? ? ? ? ? ? ? ? txt.removeAttribute('style');
? ? ? ? ? ? ? ?}
? ? ? ? ?}
? ? }
2016-03-28
沒有結整標簽啊</script>,還有ondick寫錯了吧應該有是onClick
?<form>
? <!--當點擊相應按鈕,執(zhí)行相應操作,為按鈕添加相應事件-->
? ? <input type="button" value="改變顏色" onClick="set.changecolor()"> ?
? ? <input type="button" value="改變寬高"onClick="set.changewh()" >
? ? <input type="button" value="隱藏內(nèi)容" onClick="set.none()">
? ? <input type="button" value="顯示內(nèi)容"onClick="set.block()" >
? ? <input type="button" value="取消設置"onClick="set.quxiao()" >
? </form>
? <script type="text/javascript">
//定義"改變顏色"的函數(shù)
var txt=document.getElementById("txt");
? ?var set={
? ? ? ? ?changecolor:function(){
? ? ? ? txt.style.backgroundColor="red";
txt.style.color="blue";
},
? ? ? ? ?changewh:function(){
? ? ? ? ? ? txt.style.width="500px";
? ? ? ? ? ? txt.style.height="300px";
? ? ? ? ?},
? ? ? ? ?none:function(){
? ? ? ? ? ? txt.style.display="none";
? ? ? ? ?}, ??
? ? ? ? ?block:function(){
? ? ? ? ? ? txt.style.display="block";
? ? ? ? ?},
? ? ? ? ?quxiao:function(){
? ? ? ? ? ? ?var xiaoxi=confirm("確定要取消設置嘛?");
? ? ? ? ? ? ? ? ? if(xiaoxi==true){
? ? ? ? ? ? ? ? ? ? ? txt.removeAttribute('style');
? ? ? ? ? ? ? ?}
? ? ? ? ?}
? ? }
</script>
</body>
2016-03-28
確實呢,居然寫成ondick。這錯誤真明顯
2016-03-28
onClick 寫錯了?