js和jquery实现显示隐藏

(选择的重要性)

当点击同一个按钮的时候实现显示影藏

<a id="link" class="b-btn-four task-resolve add-sub-task">点击按钮</a></h2>

<label class="field-name float-left label-w-80" id="thediv">实现显示隐藏部分</label>

js实现:

  function Show_Hidden(obj){

    if(obj.style.display == "none"){

      obj.style.display="block";

   }else{

     obj.style.display="none";

   }

  }

  window.onload=function(){

    var onlink = document.getElementById("link");

    var odiv = document.getElementById("thediv");

    odiv.style.display = "none";

    onlink.onclik = function(){

      Show_Hidden(odiv);

      return false;  

    }

  }

Jquery实现显示隐藏的简洁性

$("#link").click(function(){

  $("#thediv").toggle();

})

时间: 2024-08-05 02:25:55

js和jquery实现显示隐藏的相关文章

js 事件点击 显示 隐藏

1 <div style="position:absolute;left:40%;top:10%;border-style:dotted"> 2 <img src="zgl.jpg"/><br/> 3 <center> 4 <input type="button" value="隐藏"/> 5      6 <input type="button&qu

jQuery控制显示隐藏事件小插曲

eg.一页面中有a.b两部分,a部分有个筛选图标,我希望一开始的时候a是显示的,b是隐藏的,当点击筛选图标时,a隐藏,b显示:然后在b页面里有个返回按钮,希望点击b中的返回按钮时a显示b隐藏,搞了半天,记录一下教训: <a class="store-value-condition" style="float: right;margin: 10px;"> <img src="../images/select.png" class=

js中按钮控制显示隐藏以及下拉功能

<script> function show() { var a2=document.getElementById("div2"); if(a2.style.display=="block") { a2.style.display="none"; } else { a2.style.display="block"; } } </script> <input type="button&qu

js鼠标滑动图片显示隐藏效果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <!--声明当前页面的编码集charset=gbk中文编码gb2312,charset=utf-8国际编码--> <meta http-equi

JQuery - 垂直显示隐藏DIV

效果: 代码: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <

js控制ul的显示隐藏,对象的有效范围

<!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-

jquery datatable显示隐藏子表

<table id="parentTable"> <thead> <tr> <th></th> <th>Values</th> <th>Number</th> <th>Other</th> </tr> </thead> <tbody> <tr> <td><span class='expand

js与Jquery的对比

//    document.getElementById("divCommit").style.display="none";//    document.getElementById("oldContent").style.display="block";     $("#divCommit").hide();     $("#oldContent").show(); $("

jq 显示/隐藏 某个模块

html部分 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input class="inp" type="text" > <div id="bo