博主信息
博文 8
粉丝 0
评论 1
访问量 6484
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
我的相册
追梦者的博客
原创
727人浏览过
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<title>Document</title>
<style type="text/css">
.album{width:500px;margin:0 auto;}
.result{width:800px;height:640px;background:url(img/xk.jpg);}
</style>
</head>
<body>

<div>
<h1>我的相册</h1>
<div>
<p>想看哪张相片(url):<input type="text" name="url"></p>
<p>加相框:
   <input type="radio" id="zj" name="border" value="0" checked="checked"><label for="zj">直角</label>
<input type="radio" id="yj" name="border" value="30" checked="checked"><label for="yj">圆角</label>
<input type="radio" id="yx" name="border" value="100" checked="checked"><label for="yx">圆形</label>
</p>
<p><button>打开</button></p>
</div>
<div></div>
</div>
<script>

  $('.add').on('click',function(){

var imgUrl=$('.select input[name="url"]').val()
var imgBorder=$('.select input[name="border"]:checked').val()
var img=$('<img>').attr('src',imgUrl)
    img.width(200)
    img.height(200)
    img.css('margin-left','20px')

img.css('border-radius',imgBorder+'px');
var imgBox=$('<div></div>')
imgBox.append(img)
imgBox.css('float','left');

var moveUp=$('<button>前移</button>')
var moveDown=$('<button>后移</button>')
var remove=$('<button>移除</button>')
imgBox.append(img,moveUp)
moveUp.on('click',function(){
imgBox.prev().before(imgBox)
})

moveDown.on('click',function(){
imgBox.next().after(imgBox)
})
imgBox.append(img,moveUp,moveDown)

remove.on('click',function(){
       imgBox.remove()
})
imgBox.append(img,moveUp,moveDown,remove)
$('.result').append(imgBox);
})
</script>
</body>
</html>


本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学