解决方案 »
- 那位大哥帮我看看下边的代码,怎样实现点击imagefileds的时候,让bl加1,并img的src改变?
- JS兼容性问题
- 在线等!! 怎样取出下来菜单的值!!!
- 一个页面调入为什么同时出现jquery.min.js和jquery.js
- 模态窗口中,怎么实现全选、复制?
- 大家好,帮忙看看这段程序好吗?谢谢~
- 请教各位!如何在网页中弹出向文件下载的对话框!
- 在JAVASCRIPT中,我怎样用语句控制一组选钮中那一个被选中?
- 怎么让td的记录显示在一行上?
- 【菜鸟求助】求一段点击修改变量的代码
- 100分求js在提交时验证是否选中.....
- iframe内部的js,如何实现jquery的ready事件
$("#spell").keyup(function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
<div>
<input id="spell" title="" name="spell" class="input wide" type="text" />
</div>
一点反应都没有 我是用户点击图片我用jquery弹出上面的层 然后用户输入我在对比
$("#spell").keyup(function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
<div>
<input id="spell" title="" name="spell" class="input wide" type="text" />
</div>
一点反应都没有 我是用户点击图片我用jquery弹出上面的层 然后用户输入我在对比
有效果啊 你在输入框中输入看看 title先设置个值
//内嵌弹出层调用
$('#inside').click(function () {
$.webox({
height: 188,
width: 560,
bgvisibel: true,
title: '单词拼写',
html: $("#pingxie").html()
});
});
//iframe弹出层调用
$('#outside').click(function () {
$.webox({
height: 280,
width: 600,
bgvisibel: true,
title: 'iframe弹出层调用',
iframe: 'iframe.html?' + Math.random
});
});
$("#spell").keyup(function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
})
<a href="javascript:void(0);" id="inside" style="display:none;"><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div id="div7"></div>
<div>
<input id="spell" title="" name="spell" class="input wide" type="text" />
</div></div>
放了啊
$("#spell").keyup(function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
<div>
<input id="spell" title="" name="spell" class="input wide" type="text" />
</div>
一点反应都没有 我是用户点击图片我用jquery弹出上面的层 然后用户输入我在对比
有效果啊 你在输入框中输入看看 title先设置个值
你看看我6楼的代码 点击单词拼写弹出pingxie层 用户在pingxie里的文本框输入值我调用keyup判断 title赋了值也没用 试过了
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#spell").keyup(function(){
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
});
</script>
</head>
<body>
Enter your name: <input id="spell" title="123" name="spell" class="input wide" type="text" />
<p>当发生 keydown 和 keyup 事件时,输入域会改变颜色。请试着在其中输入内容。</p>
</body>
</html>这样子就不会有问题
$("#spell").keyup(function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
<div>
<input id="spell" title="" name="spell" class="input wide" type="text" />
</div>
一点反应都没有 我是用户点击图片我用jquery弹出上面的层 然后用户输入我在对比
有效果啊 你在输入框中输入看看 title先设置个值
你看看我6楼的代码 点击单词拼写弹出pingxie层 用户在pingxie里的文本框输入值我调用keyup判断 title赋了值也没用 试过了貌似你这个弹出层 是另一个页面了
你把事件绑定的代码放在弹出层里看看
$("#spell").keyup(function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
<div>
<input id="spell" title="" name="spell" class="input wide" type="text" />
</div>
一点反应都没有 我是用户点击图片我用jquery弹出上面的层 然后用户输入我在对比
有效果啊 你在输入框中输入看看 title先设置个值
你看看我6楼的代码 点击单词拼写弹出pingxie层 用户在pingxie里的文本框输入值我调用keyup判断 title赋了值也没用 试过了貌似你这个弹出层 是另一个页面了
你把事件绑定的代码放在弹出层里看看不行啊 放在弹出层里连jquery代码都不显示了
<script type="text/javascript">
$(document).ready(function () {
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
});
$("#spell").keyup(function () { var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
})
</script>
</head>
<body>
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" />
</div>
</div>
</body>jquery-webox.js 代码$.extend({
webox:function(option){
var _x,_y,m,allscreen=false;
if(!option){
alert('options can\'t be empty');
return;
};
if(!option['html']&&!option['iframe']){
alert('html attribute and iframe attribute can\'t be both empty');
return;
};
option['parent']='webox';
option['locked']='locked';
$(document).ready(function(e){
$('.webox').remove();
$('.background').remove();
var width=option['width']?option['width']:400;
var height=option['height']?option['height']:240;
$('body').append('<script type="text/javascript" src="/templates/green/js/base.js"></script>');
$('body').append('<div class="background" style="display:none;"></div><div class="webox" style="width:'+width+'px;height:'+height+'px;display:none;"><div id="inside" style="height:'+height+'px;"><h1 id="locked" onselectstart="return false;">'+(option['title']?option['title']:'webox')+'<a class="span" href="javascript:void(0);"></a></h1>'+(option['iframe']?'<iframe class="w_iframe" src="'+option['iframe']+'" frameborder="0" width="100%" scrolling="yes" style="border:none;overflow-x:hidden;height:'+parseInt(height-30)+'px;"></iframe>':option['html']?option['html']:'')+'</div></div>');
if(navigator.userAgent.indexOf('MSIE 7')>0||navigator.userAgent.indexOf('MSIE 8')>0){
$('.webox').css({'filter':'progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000,endColorstr=#55000000)'});
}if(option['bgvisibel']){
$('.background').fadeTo('slow',0.3);
};
$('.webox').css({display:'block'});
$('#'+option['locked']+' .span').click(function(){
$('.webox').css({display:'none'});
$('.background').css({display:'none'});
});
var marginLeft=parseInt(width/2);
var marginTop=parseInt(height/2);
var winWidth=parseInt($(window).width()/2);
var winHeight=parseInt($(window).height()/2.2);
var left=winWidth-marginLeft;
var top=winHeight-marginTop;
$('.webox').css({left:left,top:top});
$('#'+option['locked']).mousedown(function(e){
if(e.which){
m=true;
_x=e.pageX-parseInt($('.webox').css('left'));
_y=e.pageY-parseInt($('.webox').css('top'));
}
}).dblclick(function(){
if(allscreen){
$('.webox').css({height:height,width:width});
$('#inside').height(height);
$('.w_iframe').height(height-30);
$('.webox').css({left:left,top:top});
allscreen = false;
}else{
allscreen=true;
var screenHeight = $(window).height();
var screenWidth = $(window).width();$
('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}).mousemove(function(e){
if(m && !allscreen){
var x=e.pageX-_x;
var y=e.pageY-_y;
$('.webox').css({left:x});
$('.webox').css({top:y});
}
}).mouseup(function(){
m=false;
});
$(window).resize(function(){
if(allscreen){
var screenHeight = $(window).height();
var screenWidth = $(window).width();
$('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}
});我弹出的DIV也是在同一个页面里啊 为什么没有办法调用keyup方法呢? 调试根本就没执行keyup方法 是不是html: $("#pingxie").html()写的有问题呢。大家帮我看看吧
<script type="text/javascript">
$(document).ready(function () {
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
});
$("#spell").keyup(function () { var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
})
</script>
</head>
<body>
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" />
</div>
</div>
</body>jquery-webox.js 代码$.extend({
webox:function(option){
var _x,_y,m,allscreen=false;
if(!option){
alert('options can\'t be empty');
return;
};
if(!option['html']&&!option['iframe']){
alert('html attribute and iframe attribute can\'t be both empty');
return;
};
option['parent']='webox';
option['locked']='locked';
$(document).ready(function(e){
$('.webox').remove();
$('.background').remove();
var width=option['width']?option['width']:400;
var height=option['height']?option['height']:240;
$('body').append('<script type="text/javascript" src="/templates/green/js/base.js"></script>');
$('body').append('<div class="background" style="display:none;"></div><div class="webox" style="width:'+width+'px;height:'+height+'px;display:none;"><div id="inside" style="height:'+height+'px;"><h1 id="locked" onselectstart="return false;">'+(option['title']?option['title']:'webox')+'<a class="span" href="javascript:void(0);"></a></h1>'+(option['iframe']?'<iframe class="w_iframe" src="'+option['iframe']+'" frameborder="0" width="100%" scrolling="yes" style="border:none;overflow-x:hidden;height:'+parseInt(height-30)+'px;"></iframe>':option['html']?option['html']:'')+'</div></div>');
if(navigator.userAgent.indexOf('MSIE 7')>0||navigator.userAgent.indexOf('MSIE 8')>0){
$('.webox').css({'filter':'progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000,endColorstr=#55000000)'});
}if(option['bgvisibel']){
$('.background').fadeTo('slow',0.3);
};
$('.webox').css({display:'block'});
$('#'+option['locked']+' .span').click(function(){
$('.webox').css({display:'none'});
$('.background').css({display:'none'});
});
var marginLeft=parseInt(width/2);
var marginTop=parseInt(height/2);
var winWidth=parseInt($(window).width()/2);
var winHeight=parseInt($(window).height()/2.2);
var left=winWidth-marginLeft;
var top=winHeight-marginTop;
$('.webox').css({left:left,top:top});
$('#'+option['locked']).mousedown(function(e){
if(e.which){
m=true;
_x=e.pageX-parseInt($('.webox').css('left'));
_y=e.pageY-parseInt($('.webox').css('top'));
}
}).dblclick(function(){
if(allscreen){
$('.webox').css({height:height,width:width});
$('#inside').height(height);
$('.w_iframe').height(height-30);
$('.webox').css({left:left,top:top});
allscreen = false;
}else{
allscreen=true;
var screenHeight = $(window).height();
var screenWidth = $(window).width();$
('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}).mousemove(function(e){
if(m && !allscreen){
var x=e.pageX-_x;
var y=e.pageY-_y;
$('.webox').css({left:x});
$('.webox').css({top:y});
}
}).mouseup(function(){
m=false;
});
$(window).resize(function(){
if(allscreen){
var screenHeight = $(window).height();
var screenWidth = $(window).width();
$('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}
});我弹出的DIV也是在同一个页面里啊 为什么没有办法调用keyup方法呢? 调试根本就没执行keyup方法 是不是html: $("#pingxie").html()写的有问题呢。大家帮我看看吧在19行后面加上keyup事件看看
<script type="text/javascript">
$(document).ready(function () {
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
});
$("#spell").keyup(function () { var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
})
</script>
</head>
<body>
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" />
</div>
</div>
</body>jquery-webox.js 代码$.extend({
webox:function(option){
var _x,_y,m,allscreen=false;
if(!option){
alert('options can\'t be empty');
return;
};
if(!option['html']&&!option['iframe']){
alert('html attribute and iframe attribute can\'t be both empty');
return;
};
option['parent']='webox';
option['locked']='locked';
$(document).ready(function(e){
$('.webox').remove();
$('.background').remove();
var width=option['width']?option['width']:400;
var height=option['height']?option['height']:240;
$('body').append('<script type="text/javascript" src="/templates/green/js/base.js"></script>');
$('body').append('<div class="background" style="display:none;"></div><div class="webox" style="width:'+width+'px;height:'+height+'px;display:none;"><div id="inside" style="height:'+height+'px;"><h1 id="locked" onselectstart="return false;">'+(option['title']?option['title']:'webox')+'<a class="span" href="javascript:void(0);"></a></h1>'+(option['iframe']?'<iframe class="w_iframe" src="'+option['iframe']+'" frameborder="0" width="100%" scrolling="yes" style="border:none;overflow-x:hidden;height:'+parseInt(height-30)+'px;"></iframe>':option['html']?option['html']:'')+'</div></div>');
if(navigator.userAgent.indexOf('MSIE 7')>0||navigator.userAgent.indexOf('MSIE 8')>0){
$('.webox').css({'filter':'progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000,endColorstr=#55000000)'});
}if(option['bgvisibel']){
$('.background').fadeTo('slow',0.3);
};
$('.webox').css({display:'block'});
$('#'+option['locked']+' .span').click(function(){
$('.webox').css({display:'none'});
$('.background').css({display:'none'});
});
var marginLeft=parseInt(width/2);
var marginTop=parseInt(height/2);
var winWidth=parseInt($(window).width()/2);
var winHeight=parseInt($(window).height()/2.2);
var left=winWidth-marginLeft;
var top=winHeight-marginTop;
$('.webox').css({left:left,top:top});
$('#'+option['locked']).mousedown(function(e){
if(e.which){
m=true;
_x=e.pageX-parseInt($('.webox').css('left'));
_y=e.pageY-parseInt($('.webox').css('top'));
}
}).dblclick(function(){
if(allscreen){
$('.webox').css({height:height,width:width});
$('#inside').height(height);
$('.w_iframe').height(height-30);
$('.webox').css({left:left,top:top});
allscreen = false;
}else{
allscreen=true;
var screenHeight = $(window).height();
var screenWidth = $(window).width();$
('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}).mousemove(function(e){
if(m && !allscreen){
var x=e.pageX-_x;
var y=e.pageY-_y;
$('.webox').css({left:x});
$('.webox').css({top:y});
}
}).mouseup(function(){
m=false;
});
$(window).resize(function(){
if(allscreen){
var screenHeight = $(window).height();
var screenWidth = $(window).width();
$('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}
});我弹出的DIV也是在同一个页面里啊 为什么没有办法调用keyup方法呢? 调试根本就没执行keyup方法 是不是html: $("#pingxie").html()写的有问题呢。大家帮我看看吧在19行后面加上keyup事件看看
具体要怎么加 我初学jquery不是很懂你的意思 我17行不是已经加了keyup事件了吗?只要不是弹出层就不会有问题
<script type="text/javascript">
$(document).ready(function () {
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
});
$("#spell").keyup(function () { var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
})
</script>
</head>
<body>
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" />
</div>
</div>
</body>jquery-webox.js 代码$.extend({
webox:function(option){
var _x,_y,m,allscreen=false;
if(!option){
alert('options can\'t be empty');
return;
};
if(!option['html']&&!option['iframe']){
alert('html attribute and iframe attribute can\'t be both empty');
return;
};
option['parent']='webox';
option['locked']='locked';
$(document).ready(function(e){
$('.webox').remove();
$('.background').remove();
var width=option['width']?option['width']:400;
var height=option['height']?option['height']:240;
$('body').append('<script type="text/javascript" src="/templates/green/js/base.js"></script>');
$('body').append('<div class="background" style="display:none;"></div><div class="webox" style="width:'+width+'px;height:'+height+'px;display:none;"><div id="inside" style="height:'+height+'px;"><h1 id="locked" onselectstart="return false;">'+(option['title']?option['title']:'webox')+'<a class="span" href="javascript:void(0);"></a></h1>'+(option['iframe']?'<iframe class="w_iframe" src="'+option['iframe']+'" frameborder="0" width="100%" scrolling="yes" style="border:none;overflow-x:hidden;height:'+parseInt(height-30)+'px;"></iframe>':option['html']?option['html']:'')+'</div></div>');
if(navigator.userAgent.indexOf('MSIE 7')>0||navigator.userAgent.indexOf('MSIE 8')>0){
$('.webox').css({'filter':'progid:DXImageTransform.Microsoft.gradient(startColorstr=#55000000,endColorstr=#55000000)'});
}if(option['bgvisibel']){
$('.background').fadeTo('slow',0.3);
};
$('.webox').css({display:'block'});
$('#'+option['locked']+' .span').click(function(){
$('.webox').css({display:'none'});
$('.background').css({display:'none'});
});
var marginLeft=parseInt(width/2);
var marginTop=parseInt(height/2);
var winWidth=parseInt($(window).width()/2);
var winHeight=parseInt($(window).height()/2.2);
var left=winWidth-marginLeft;
var top=winHeight-marginTop;
$('.webox').css({left:left,top:top});
$('#'+option['locked']).mousedown(function(e){
if(e.which){
m=true;
_x=e.pageX-parseInt($('.webox').css('left'));
_y=e.pageY-parseInt($('.webox').css('top'));
}
}).dblclick(function(){
if(allscreen){
$('.webox').css({height:height,width:width});
$('#inside').height(height);
$('.w_iframe').height(height-30);
$('.webox').css({left:left,top:top});
allscreen = false;
}else{
allscreen=true;
var screenHeight = $(window).height();
var screenWidth = $(window).width();$
('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}).mousemove(function(e){
if(m && !allscreen){
var x=e.pageX-_x;
var y=e.pageY-_y;
$('.webox').css({left:x});
$('.webox').css({top:y});
}
}).mouseup(function(){
m=false;
});
$(window).resize(function(){
if(allscreen){
var screenHeight = $(window).height();
var screenWidth = $(window).width();
$('.webox').css({'width':screenWidth-18,'height':screenHeight-18,'top':'0px','left':'0px'});
$('#inside').height(screenHeight-20);
$('.w_iframe').height(screenHeight-50);
}
});
}
});我弹出的DIV也是在同一个页面里啊 为什么没有办法调用keyup方法呢? 调试根本就没执行keyup方法 是不是html: $("#pingxie").html()写的有问题呢。大家帮我看看吧在19行后面加上keyup事件看看
具体要怎么加 我初学jquery不是很懂你的意思 我17行不是已经加了keyup事件了吗?只要不是弹出层就不会有问题加在这个文件里jquery-webox.js
$('body').append()源文件里在这加了一大段html代码 应该就是弹出层的html
你把事件绑定放到这里试下看看 我也不知道对不对
$("#spell").bind("keyup", function () {
var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
这样也不对
var aaa = $("#spell").attr("title");
var bbb = $("#spell").val();
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
}
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" onkeyup="upperCase()"/>
<div id="aaa"></div>
</div>
</div>这样写可以了 但是var bbb = $("#spell").val();老是取不到文本框的值
<script type="text/javascript" src="{config.templateskin}/js/jquery-webox.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
});
$("#spell").keyup(function () { var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
})
</script>
</head>
<body>
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" />
</div>
</div>
</body>将你的input标签的id换成class,
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
});这个调用里面的html后面改为:$("#pingxie").clone();这个键盘事件#改为.就可以了
$("#spell").keyup(function () { var aaa = $("#spell").attr("title");
var bbb = $("#spell").attr("value");
if (aaa == bbb) {
alert("相同");
}
else {
alert("不同");
}
});
不行的话,你就等到把键盘事件加到 $('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
//将键盘事件放到这里试下
$(".spell").keyup(function(){
//code
}) });
<script type="text/javascript">
$(document).ready(function () {
$('#inside').click(function () {
$.webox({
height: 188,
width: 400,
bgvisibel: true,
title: '内嵌弹出层调用',
html: $("#pingxie").html()
});
}); })
function upperCase(obj) {
var aaa = $("#spell").attr("title");
var bbb = obj.value;
if (aaa == bbb) {
$(".div1").text("输入正确");
}
else { $(".div1").text("错误"); }
}
</script>
</head>
<body>
<a href="javascript:void(0);" id="inside" ><strong>单词拼写</strong></a>
<div id="div2"></div>
<div id="pingxie" style="display:none;">
<div>
<input id="spell" title="123" name="spell" class="input wide" type="text" onkeyup="upperCase(this)"/>
<div class="div1"></div></div>
</div>
</body>
</html>
我通过id给div1赋值,$("#div1").text("...");赋值不上去,后来我试着按照wzb0712说的 把id换成class,居然成功了,虽然成功了但还是不知道为什么