In the morning, a ticket booking page is reconstructed. The page has the function of adding and deleting flight attendants, so JQuery's. remove () attributes and. the append () attribute writes a javascript code that adds or deletes the text content of the div layer. You can run the following code to demonstrate the effect. The Code has two JS effects in total:1. add or delete the text content of the
JavaScript: Div layer drag effect, javascriptdiv
Drag the Div layer:
Implementation:
CSS:View Code
JS:View Code
HTML:View Code
Note: It is for reference only. Compatibility is not considered. IE9 passed the test! Google cannot move! Other self-tests.
CSS: css drop-down menu effects without js implementationJavaScript: Nine js pop-up dialog boxCommon
There are many ways to dynamically add divs to JavaScript on the Internet. Here I show how to use insertBefore () and innerHTML.
Front-end code
Js Code
Function createQuestion (tixing) {// 1. first, determine whether the child node divvar oTest = document exists at the location to be inserted. getElementById ("question"); // obtain the parent node var flag = oTest of all child nodes. hasChildNodes (); // determines whether the current node has a s
1, the problem background
Judge whether the div inside is empty, if it is empty, give countless hints; otherwise, show the normal page
2, the implementation of the effect of the figure shown below:
3. Design Source
The above is a small series to introduce JavaScript to determine whether the div content is empty method, I hope to help.
onmouseover response when mouse moves over this objectonmouseout response when the mouse moves out of the objectdocument.getElementById (' id ') gets the ID of the element and can do some thingsOnClick Click eventAlert Pop-up boxSuch asvar onVar1 = document.getElementById (' Div1 '); Get an element with ID Div1 and assign it a valueOnVar1.style.height = ' 100px ';OnVar1.style.width = ' 100px ';OnVar1.style.background = ' red ';JavaScript changes the s
This article mainly introduces how to edit the node (div) name in JavaScript. For more information, see the following node html code:
The code is as follows:
123
Edit the noteTxt text in js. the function is as follows:
The code is as follows:
Function changeName (noteTxtId ){Var noteTxt = document. getElementById (noteTxtId );NoteTxt. style. display = "none"; //. style. display = "block"Var p
This article mainly introduces how to edit the node (div) Name in Javascript. For more information, see the following node html code:
The Code is as follows:
123
Edit the noteTxt text in js. The function is as follows:
The Code is as follows:
Function changeName (noteTxtId ){Var noteTxt = document. getElementById (noteTxtId );NoteTxt. style. display = "none"; //. style. display = "block"Var p
How does Javascript get and set the height and width of the div and be compatible with any browser? Check the Code:Copy codeThe Code is as follows: Obtain the div1 width and height:Copy codeThe Code is as follows:Alert (document. getElementById ("div1"). offsetHeight); // compatible with FF, IE, etc.Alert (document. getElementById ("div1"). offsetWidth); // compatible with FF, IE, etc. Set div1 to div2:Copy
Recently in learning JavaScript, gave me a topic to write a two-level linkage effect. As an exercise.Write a two-level linkage of the HTML page, the specific requirements are as follows:1, the page support through the keyboard on the key to achieve the focus of movement2, the left side of the page is the name of the parent column, such as movies, TV dramas, sports, music, children, arts, consulting, etc.3, focus on the corresponding parent column, dis
Class= "FL" >Value= "" placeholder= "0" > Class= "FL" >Value= "" placeholder= "0" > Class= "FL" >Value= "" placeholder= "0" > The first step is to select the selected topic type status as the selected state$ (document). Ready (function () { $ ("#ding a"). Click (function () { $ (this). AddClass ("selected");The second step, change the topic of the selected topic type corresponding var id = $ (this). attr (' id '); document.getElementById (ID). style.di
Nonsense not to say, directly to everyone to write JS code, the code looks like this:
The following code is a login mask effect written with JS
The above is based on JavaScript to achieve full screen transparent mask div layer lock screen effect of the relevant content, I hope to help.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.