支持背景图片的圆角边框图层

1个月前 (04-17 14:30)阅读43回复0
大陆
大陆
  • 管理员
  • 发消息
  • 注册排名1
  • 经验值4714
  • 级别管理员
  • 主题942
  • 回复2
楼主

js实现圆角边框图层显示,这个圆角图层支持背景图片,目前只支持平铺背景图图片,可根据自己的需求自定义。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren">
<meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。">
<title>支持背景图片的圆角边框图层_武鸣人</title>
</head>
<body>
<script language="javascript">
function yj(id){
 var obj = document.getElementById(id);
 var content = obj.innerHTML;
 var s = obj.style;
 var width = s.width.replace(/px/gi,"");
 var height = s.height.replace(/px/gi,"");
 var bc = s.borderColor;
 var bg = s.backgroundImage;
 var bgc = s.backgroundColor;
 var p = s.padding;
 var pt = s.paddingTop.replace(/px/gi,"");
 var pr = s.paddingRight.replace(/px/gi,"");
 var pb = s.paddingBottom.replace(/px/gi,"");
 var pl = s.paddingLeft.replace(/px/gi,"");
 s.padding = "";
//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
 s.width = "";
 s.height = "";
 s.border = "";
 s.background = "";
 bc = (bc == "") ? "#000000" : bc;
 if(window.navigator.userAgent.indexOf("Firefox")>=0){
  bc = String(bc).toLowerCase().replace(/rgb\(.+?\)/g,function(){return "#"+arguments[0].replace(/(\s|\(|\)|rgb)/g,"").replace(/\d+\,*/g,function(){return parseInt(arguments[0]).toString(16).toLowerCase();});}).substring(0,7);
 }
 bgc = (bgc == "") ? "none" : bgc;
 pt = (pt == "") ? 0 : Math.round(pt);
 pr = (pr == "") ? 0 : Math.round(pr);
 pb = (pb == "") ? 0 : Math.round(pb);
 pl = (pl == "") ? 0 : Math.round(pl);
 width = (width == "") ? (20+pl+pr) : Math.round(width)+pl+pr+2;
 height = (height == "") ? (20+pt+pb) : Math.round(height)+pt+pb+2;
 a1 = "<div style='font:0px;margin:0px;margin-left:5px;width:" + (width-10) + "px;height:1px;background:"+bc+" '></div>";
 a2 = "<div style='font:0px;margin:0px;margin-left:3px;width:" + (width-10) + "px;height:1px;background:"+bgc+" "+bg+" -4px 0px;border-left:2px solid "+bc+";border-right:2px solid "+bc+";'></div>";
 a3 = "<div style='font:0px;margin:0px;margin-left:2px;width:" + (width-6) + "px;height:1px;background:"+bgc+" "+bg+" -2px -1px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
 a4 = "<div style='font:0px;margin:0px;margin-left:1px;width:" + (width-4) + "px;height:2px;background:"+bgc+" "+bg+" -1px -2px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
 a5 = "<div style='margin:0px;padding:"+p+";width:" + (width-2-pl-pr) + "px;height:" + (height-10-pt-pb) + "px;background:"+bgc+" "+bg+" 0px -4px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'>" + content + "</div>";
 a6 = "<div style='font:0px;margin:0px;margin-left:1px;width:" + (width-4) + "px;height:2px;background:"+bgc+" "+bg+" -1px -"+(height-2-10+4)+"px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
 a7 = "<div style='font:0px;margin:0px;margin-left:2px;width:" + (width-6) + "px;height:1px;background:"+bgc+" "+bg+" -2px -"+(height-2-10+6)+"px;border-left:1px solid "+bc+";border-right:1px solid "+bc+";'></div>";
 a8 = "<div style='font:0px;margin:0px;margin-left:3px;width:" + (width-10) + "px;height:1px;background:"+bgc+" "+bg+" -4px -"+(height-2-10+7)+"px;border-left:2px solid "+bc+";border-right:2px solid "+bc+";'></div>";
 a9 = "<div style='font:0px;margin:0px;margin-left:5px;width:" + (width-10) + "px;height:1px;background:"+bc+" '></div>";
 obj.innerHTML = a1+a2+a3+a4+a5+a6+a7+a8+a9;
}//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)
</script>
<a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr>
<!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。-->
<script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script>
<script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script>
<div id="wwwwumingren" style="width:700px;height:525px;color: #FF00FF">
武鸣人,各种信息免费发布,资源共享合作共赢!<br /><br />
欢迎收藏本站,或者推荐给您的好友~
</div>
<script>yj("wwwwumingren");</script>
</body>
</html>


0
0
收藏0
回帖

支持背景图片的圆角边框图层 期待您的回复!

取消
载入表情清单……
载入颜色清单……
插入网络图片

取消确定

图片上传中
编辑器信息
提示信息