Name = document.getElementById (project_not_through_id). ClassName; Gets the contents of the target ID's classdocument.getElementById (project_not_through_id). ClassName = ' label label-success '; Re-assigns a value to the target ID class, which modifies its class styledocument.getElementById (project_not_through_id). InnerHTML = ' audit pass '; Add a new value or change to a label such as a target divJavaScript gets class style re-assignment class style for
1. Hidden elements cannot obtain the focus.2. Obtain the focus for div and other special elements [Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Town Field Poem:The Pure Heart sentiment wisdom language, does not have the world name and the benefit. Learn water under the hundred rivers, give up arrogant slow meaning.Learn to have a small return to feed root, willing to cast a conscience blog. Sincere in this writing experience, willing to see the text to inspire.——————————————————————————————————————————CodeResult——————————————————————————————————————————The essence of the blog, in the technical part, more in the town yard a poem. ide:vs2
Simple point to text display content instance
The code is as follows
Copy Code
Centered Div
Show pictures when connected
The code is as follows
Copy Code
"Http://www.w3.org/TR/html4/loose.dtd" >Wait.gif
The node HTML code is as follows:
Copy Code code as follows:
JS edit Notetxt text, function is as follows:
Copy Code code as follows:
function ChangeName (Notetxtid) {
var notetxt = document.getElementById (Notetxtid);
Notetxt.style.display= "None";//.style.display= "Block"
var div = Notetxt.parentnode;
if (!document.getelementbyid ("Noteinput")) {
var text=document.createelement ("input");
Text.type= "Text";
After querying the relevant information, Div does not have the auto-scroll attribute and can only simulate mouse scrolling to achieve the desired effect.The key part is here: div. scrollTop = div. scrollHeight;The following is the simplified code:Copy codeThe Code is as follows: In fact, the implementation is very simple, but generally there is little such demand
If we want to use js to control the display and hiding of div, we can use js to control the style and define the display settings, in this way, you only need to set none and block dynamically to hide and display the div.
Simple pointing to text display content instance
The Code is as follows:
Copy code
Center DIV
Display images when
HTML code: viewsourceprint? 1 lt; ul gt; nbsp; 2 nbsp; lt; li gt; change the background color when the mouse passes through lt; /li gt; nbsp; 3 nbsp; lt; li gt; change the background color when the mouse passes through lt; /li gt;
Some HTML code:View sourceprint? 1
2
Changes the background color when the mouse passes
3
Changes the background color when the mouse passes
4
Changes the background color when the mouse passes
5
Changes the background color when the mou
Javascript pop-up Layer Effect code. If you need it, you can test it. Dialog box with the floating layer centered
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
Javascript drag operation by shawl. Qiu (compatible with IE, opera, Firefox)
Note:Drag ProcessMouse-> (move the mouse-> move the element)Move the mouse and press the button to start.
For IE, we mainly use obj. attachevent () obj. detachevent ()For Firefox, obj. addeventlistener () obj. removeeventlistener of Dom 2 is mainly used.Both methods are supported by opera.
In this article, the style attribute must be set to position: absolute;Specify the
understand this.
Check the code first:
Html section:
// Is it very familiar? javascript part: window. onload = function () {var obj = document. getElementById ("showZone"); var timer = null; obj. onclick = function () {var I = 0; clearInterval (timer); timer = setInterval (function () {obj. style. display = I ++ % 2? "None": "block"; // There are still gains. This method is better than if .. else should have been much simpler. I> 8 clearInterva
Function beginDrag (elementToDrag, event){Var = event. clientX-parseInt (elementToDrag. style. left );Var deltaY = event. clientY-parseInt (elementToDrag. style. top );// Here, deltaX/Y is actually the Coordinate Difference Between the mouse and the div.If (document. addEventListener)// The reason for this judgment is that IE6 and firefox have different methods for javascript event processing (Versions later than IE7 begin to comply with W3C standards
Netscape will return undefined. if you do not know what innerText does, it strips out all of the tags so you only see the text.For example, if a div contains the HTML Now to make innerHTML act the same we need to use some regular expressions with the strings replace () method.Now the basic pattern we need to match is orNow the regular expression we need to use is/If you do not know regular expressions here is a quick explanation:/-Starts the regular
There are many ways to clear the input tag value in a div. The following describes how to use a loop to clear the input tag value in a div. The HTML page
Piano Name:
Performer:
Lt;/p>
Nature:
Unlimited Popular piano music Classical Piano Music Jazz Piano Piano exercise
Lt;/p>
Js page
// Clear the Piano Music Search Conditio
You can click the label to switch the DIV effect. You have seen it in many places, and there are many implementation methods. This example describes how to switch and automatically switch the DIV tab.
The Code is as follows:
Click the switch and automatic switch tab.
How to get the relative position of the mouse in the div is actually very simple. There is a good example below. If you are interested, refer
The Code is as follows:
JS Get DIV relative coordinates
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.