HTML5 and CSS3 instance tutorial Summary (recommended), html5css3
Onclick behavior and content Separation
1. trigger a pop-up window via Link (this method is not recommended !!!)
Copy XML/HTML Code to clipboard
- <A href = '#'
- Onclcik = "too many open('holiday_pay.html ', WinName, 'width = 300, height = 300');">
- Holiday Pay
- </A>
If the JS disabled link cannot direct the user to the corresponding page, do not assign "#" and similar values to the href attribute.
2. General situation
Copy XML/HTML Code to clipboard
- <A hrefpolic'holiday_pay.html'
- Onclcik = "window. open (this. href, WinName, 'width = 300, height = 300 ');">
- Holiday Pay
- </A>
3.0 a large number of duplicate links are allocated with recognizable class names for each link. You can add listeners for each click event by using jQuery.
Copy XML/HTML Code to clipboard
- <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 Multi-User custom data type setting window size in the pop-up window
Copy XML/HTML Code to clipboard
- <A href = "holiday_pay.html"
- Data-width = "600"
- Data-heigth = "400"
- Title = "Holiday Pay"
- Class = "popup"> Holiday pay </a>
Copy the content to the clipboard using JavaScript Code
- $ (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 + "");
- });
- });
The above HTML5 and CSS3 instance tutorial Summary (recommended) is all the content shared by xiaobian. I hope to give you a reference, and I hope you can provide more support for helping customers.
Address: http://www.cnblogs.com/liul0703/p/5677644.html