jquery弹出div,jquery弹出自定义提示框

jquery如何当点击A标签,能弹出div,其div能够获取A标签属性值

如你所说的,有很多个A标签,那么你所写的A标签就不能用ID来进行识别,如果你想识别那么一部分的A标签,最好是用class,比如:点击这样,JQ绑定事件可以这样写$("a.click").click(function(){

我们提供的服务有:成都网站制作、成都网站建设、外贸营销网站建设、微信公众号开发、网站优化、网站认证、桂林ssl等。为成百上千企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的桂林网站制作公司

$("#divid").find("input").val($(this).attr("name")).show();})具体你的div想要怎么弹出来,那就要另外说了,但是要获取点击的那个A标签上的name,只要在点击事件中用$(this).attr("name")就可以获取到了。

jquery 点击标签弹出DIV

php我不知道怎么做,不知道和jsp是不是一样的,不会php

1、在jsp中,你用jquery或者javascript非常好实现,当点击性别时,点击就是个事件,这个事件所要做的事情就是显示一个男女的DIV

2、当在男女的DIV上选择了性别后,隐藏这个div,并且在性别那显示我们所选择的性别男或女,我可以可以在隐藏的时候,把选择的那个男或者女赋

值给性别DIV中的性别那一栏

3、学习下jqeury或者javascript实现起来超容易

4、下面是我写的js代码,你看你php能否同样做出来,按照这个方法

!DOCTYPE

html

head

!-- 声明当前页面的编码集charset=gbk中文编码gb2312,charset=utf-8国际编码 --

meta http-equiv="Content-Type" content="text/html; charset=utf-8"

!-- 当前页面三要素 --

titletitle/title

meta name="Author" content="cn.huanghaiping"

meta name="Keywords" content="关键词,关键词"

meta name="Description" content="描述"

!-- css , js --

/head

body

divinput type="text" id="sextxt"input type="button" value="性别" id="sex" onclick="showsex()"/div

div id="sexradio" style="margin-top:10px;display:none;"

input type="radio" name="sex" value="男" onclick="selectsex(this)" 男

input type="radio" name="sex" value="女" onclick="selectsex(this)" 女

/div

script

function showsex(){

document.getElementById("sexradio").style.display = "block";

}

function selectsex(o){

document.getElementById("sextxt").value = o.value

document.getElementById("sexradio").style.display = "none";

}

/script

/body

/html

jquery 实现DIV的弹出

$(function(){

// 点击按钮,DIV弹出隐藏

$('#btn1').toggle(function(){

$('#div1').show();

},function(){

$('#div1').hide();

});

// 点击按钮,DIV弹出,点击body任意地方隐藏div

$('#btn2').click(function(){

if ( event  event.stopPropagation ) { 

// this code is for Mozilla and Opera 

event.stopPropagation(); 

else if (window.event) { 

// this code is for IE 

window.event.cancelBubble = true; 

}

$('#div2').show();

});

$(document).click(function(){

$('#div2').hide();

});

});

以上都必须要基于,div的css是合理的。

其中 event.stopPropagation(); 和 window.event.cancelBubble = true; 是阻止事件冒泡的写法,建议自行百度学习。

css:(这里用了fixed,不考虑兼容性)

/* 水平垂直居中的div */

#div1,#div2{

position: fixed;

top: 50%;

left: 50%;

background:red;

width:100px;

height:100px;

margin:-50px 0 0 -50px;

display:none;

}

同样的功能有很多插件,例如fancybox,fancyzoom等

如何用jquery弹出 一个Div,让其在文本框下面显示

div input id='input1' type='text' /div

div  id='b' style='position:absolute;left:20px;top:20px;display='none''/div//自己调整left和top的值将下面的div定位在上一个div的正下方

引如jquery文件

script

$(function(){

$("#b").hide();

$("#input1").focus(function(){

$("#b").slideDown("slow");

});

$("#input1").blur(function(){

$("#b").slideUp("slow");

});

});

/script

如何用jQuery在浏览器窗口中央弹出一个DIV

style

.box{width:400px;height:400px;background:#f00;position:fixed;top: 50%;left: 50%;}

/style

var html = 'div class="box"/div';

$('body').append(html);

var L = $('.box').width();

var T = $('.box').height();

$('.box').css({

"margin-left":-L/2,

"margin-top":-T/2

})

[img]
网站题目:jquery弹出div,jquery弹出自定义提示框
当前路径:http://pwwzsj.com/article/dsohdsh.html