The dynamic addition and display and hiding of CSS styles and other fragmentary usage

Source: Internet
Author: User

Dynamic Additions to Styles:

(where the red font is a dynamically added-style statement), a function that dynamically generates unordered lists to display the search for WiFi signals, which have 3 parameters, the name of the WiFi, the encryption method, the signal strength.



The
code is as follows:


//Create a network list item


function Newlistitem (Network, averagesignalstrength) {


/**


* A Wi-Fi list item has the following HTML structure:


* <li>


* <div> "signalstrength" + dbm</div>


* <small> Network security </small>


* <a [class= "wifi-secure"]> network SSID </a>


* </li>


*/


//SSID


var _ = Navigator.mozL10n.get;


var ssid = document.createelement (' a ');


ssid.textcontent = Network.ssid;


var div = document.createelement (' div ');


<span style= "color: #FF0000;" >var str_css = "position:absolute;left:50%; Right:3rem; top:45%; Padding-top:0.4rem; Font-size:1.4rem; Color: #505859; Pointer-events:none; "; </span>


<span style= "color: #FF0000;" >div.style = str_css;</span>


if (!averagesignalstrength)


div.textcontent = ' strength: ' + network.signalstrength + ' dbm ';


Else


div.textcontent = ' strength: ' + averagesignalstrength + ' dbm ';


//Supported authentication Methods


var small = document.createelement (' small ');


var keys = network.capabilities;


if (keys && keys.length) {


small.textcontent = _ (' Securedby ', {capabilities:keys.join (', ')});


small.textcontent = Keys.join (', ');


} else {


small.textcontent = _ (' Securityopen ');


small.dataset.l10nId = ' Securityopen ';


}


//Create List item


var li = document.createelement (' li ');


Li.appendchild (DIV);


Li.appendchild (small);


Li.appendchild (SSID);


return li;


}


Display and hide of styles:

Traversal tag exp = document.getElementById ("exp");

Hidden label Exp.style.display = "None";

Display label Exp.style.display = "List-item";

The Padding property defines the space between the element border and the element content.

The padding shorthand property sets all the inner margin properties in a declaration. Sets all current or specified element interior margin properties. This property can have 1 to 4 values

The

code is as follows:


<span style= "FONT-SIZE:14PX;" > Grammatical Structure


padding-top:20px, upper inner margin


padding-right:30px, right inner margin


padding-bottom:30px, lower inner margin


padding-left:20px, left inner margin


padding:1p quadrilateral uniform inner margin


padding:1px1px up and down, the left and right inner margin


padding:1px1px1px, left and right, lower inner margin


PADDING:1PX1PX1PX1PX, right, bottom, left inner margin </span> 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.