您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

HTML5和CSS3实例教程总结(推荐)

2024/8/11 0:43:47发布32次查看
关于onclick的行为与内容分离
1.通过链接触发弹出窗口方式 (不推荐使用此方法!!!)
<a href='#' onclcik = "window.open('holiday_pay.html',winname,'width=300, height = 300');"> holiday pay </a>
如果js被禁用链接无法引导用户进入对应页面,不要为href属性赋"#"及类似的值
2.普通情况
<a href='holiday_pay.html' onclcik = "window.open(this.href,winname,'width=300, height = 300');"> holiday pay </a>
3.0 大量重复链接,为每个链接分配可识别类名,通过使用jquery为每个click事件分别添加监听器
<a href="holiday_pay" class="popup">holiday pay</a> var links = $("a.popup"); links.clcik(function(event){ event.preventdefault(); window.open($(this).attr('href')); });
3.1 通多自定义数据类型设置弹出窗口尺寸大小
<a href ="holiday_pay.html" data-width="600" data-heigth = "400" title = "holiday pay" class = "popup"> holiday pay </a>
$(function(){ $(".popup").click(function(event){ event.preventdefault(); var href=$(this).attr("href"); var width = $(this).attr("data-width"); var height = $(this).attr("data-height"); var popup = window.open(href,"popup","height="+height+",width="+width+""); }) ; });
以上这篇html5和css3实例教程总结(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product