Ica*_*aro 1 html javascript jquery json
我一直在尝试使用jquery和httprequest来改变网页中的图像,没有任何运气......经过大量研究我决定寻求帮助.代码粘贴在下面,我首先尝试要求json(什么工作正常),然后更新图像上的scr ...没有用.对于最后的测试我使用鼠标悬停和鼠标输出功能并没有工作,有趣的是,其他属性,如显示和隐藏工作正常,唯一的问题是与attr('scr','')
.
谢谢
<!DOCTYPE html>
<html>
<head>
<script src="..\js\jQuery.js"></script>
<script>
$.getJSON("http://www.containernurseries.co.nz/json/jsonPlantDetails.php",
{plantSelected:"ARGYRANTHEMUM-POLLY"},
function(data){
$('#a1').attr('scr','data:image/jpg;base64,'+data.plantDetail.Image);
});
$(document).ready(function() {
$('#a1').mouseover(function(e) {
$('#a1'.attr('scr','http://www.containernurseries.co.nz/images/services.gif');
}).mouseout(function(e) {
$('#a1').attr('scr','http://www.containernurseries.co.nz/images/services.gif');
});
});
</script>
</head>
<body>
<img id="a1" src="http://www.containernurseries.co.nz/images/contacticon.gif" width="18" height="37"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1221 次 |
最近记录: |