jquery显示和隐藏图像不起作用 [英] jquery show and hide image not working
本文介绍了jquery显示和隐藏图像不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的一个页面有代码。当有人点击单选按钮时,它应该淡入,保持和淡出图像。此外,使用ajax更新数据库。
I have a code to one of my pages. It's supposed to fade in, stay and fade out an image when someone clicks a radio button. Also the database is to be updated onclick using ajax.
<html>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
$("#rad").click(function() {
$("#success").fadeIn(500);
$("#success").delay(1000);
$("#success").fadeOut(1000);
})
</script>
<table class="profimg">
<tr><td height="50" width="50"><img id="success" src="http://cdn4.iconfinder.com/data/icons/simplicio/128x128/notification_done.png" style="display:none" height="50" width="50"></td></tr>
<tr><td align="center"><img class="profimg" src="" alt="Administratorasdf" height="100" width="100"/></td></tr>
<tr><td id="rad" align="center"><input type='radio' title='Publicly Visible' name='img_pub' onclick="upimg1()" /> <input type='radio' title='Visible Only To Users' value='UsersOnly' name='img_pub' onclick="upimg2()" /> <input type='radio' title='Visible Only To You' value='Hide' name='img_pub' onclick="upimg3()" checked='checked'/></td></tr>
</table>
</body>
</html>
我删除了ajax部分以避免混淆。这是我用过的jsFiddle。 http://jsfiddle.net/c7ajb/1/ 可能是什么错误?
I removed the ajax part for avoid confusion. This is the jsFiddle I used. http://jsfiddle.net/c7ajb/1/ What might be the error?
推荐答案
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
$(".radios").click(function() {
$("#success").fadeIn(500).delay(1000).fadeOut(1000);
})
});
function upimg1(){}
function upimg2(){}
function upimg3(){}
</script>
</head>
<body>
<table class="profimg">
<tr>
<td height="50" width="50">
<img id="success" src="http://cdn4.iconfinder.com/data/icons/simplicio/128x128/notification_done.png" style="display:none" height="50" width="50">
</td>
</tr>
<tr>
<td align="center">
<img class="profimg" src="" alt="Administratorasdf" height="100" width="100"/>
</td></tr>
<tr>
<td id="rad" align="center">
<input class="radios" type='radio' title='Publicly Visible' name='img_pub' onClick="upimg1()" />
<input class="radios" type='radio' title='Visible Only To Users' value='UsersOnly' name='img_pub' onClick="upimg2()" />
<input class="radios" type='radio' title='Visible Only To You' value='Hide' name='img_pub' onClick="upimg3()" checked='checked'/>
</td>
</tr>
</table>
</body>
这篇关于jquery显示和隐藏图像不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文