JS some small knowledge points

Source: Internet
Author: User

IsNaN (), in which a parameter is passed to determine whether the value passed in is a number. Can be used to make some simple form judgments.

You can get the content of span with innerHTML, and you can set the content of span. In fact, all non-form elements can be innerhtml to get their content


<!DOCTYPE HTML><HTML>    <HeadLang= "en">        <MetaCharSet= "UTF-8">        <style>span{Display:Inline-block;width:100px;Height:50px;Line-height:50px;text-align:Center;Border:1px solid Orange;            }        </style>        <Body>            <spanID= "Span1">Red flag</span>            <Script>                varSpan1=document.getElementById ("Span1");                alert (span1.innerhtml); Span1.innerhtml= "I love you ."; </Script>        </Body></HTML>

You can use JS to set the class name of an element, usage: element.classname= "xxx", so that if the corresponding class name has some style attribute, the element will apply these attributes, save us to use JS sentence to set the style for this element.

JS some small knowledge points

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.