为了账号安全,请及时绑定邮箱和手机立即绑定

js显示与隐藏

js显示与隐藏

慕粉13727861792 2017-01-24 20:32:53
我感觉没有错误,为什么点击按钮不能按照要求显示和隐藏<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>显示及隐藏</title></head><body><script type="text/javascript">var Q=document.getElementById("q");Q.style.color="red";function x(){ Q.style.display="none";}function y(){ Q.style.display="block";}<h2 id="q">穷</h2></script><p>想住的好,为什么不买个别墅呢?</br>因为</p><form><input type="button" onclick="x()" value="tell me" /><input name="按钮" type="button" onclick="y()" value="not my bussiness" /></form></body></html>
查看完整描述

3 回答

?
ReWorld

TA贡献3条经验 获得超5个赞

我感觉用jquery比较简单

查看完整回答
反对 回复 2017-01-26
  • 慕粉13727861792
    慕粉13727861792
    jquery比js简单?我还没学那个,想学jquery要有什么基础吗?
  • ReWorld
    ReWorld
    jq是js的一个封装库,不需要学习,可以直接使用
  • 3 回答
  • 1 关注
  • 1176 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信