71st Session of JavaScript

Source: Internet
Author: User

window.open ("http://www.baidu.com", "_blank", "width=300, height=200");

Enter Baidu.

<script type= "Text/javascript" >
var content = "abc";
Console.log (Content.replace ("B", "Q"));

Convert B to Q.

<script type= "Text/javascript" >
var arr = ["Orange", "Mango", "banana", "sugar", "tea"];
Console.log (arr);
Arr.splice (2, 0, "fish");

2 is the second 0 is the deletion of 0
document.write (arr);
document.write ("<br/>");

Results (Orange,mango,fish,banana,sugar,tea)

Arr.splice (5, 1);

5 is the fifth 1 is to delete a
document.write (arr);

Results (Orange,mango,fish,banana,sugar)

<script type= "Text/javascript" >
var username = "a123456789";
Set to enter only a small number of digits
if (Username.length > 7) {
Alert ("Please enter the correct user name ...");

<script type= "Text/javascript" >
var title = "Attendance at Hangzhou Summit Series of 20 leaders ' events";
document.write (title.substr (0, 10) + "...");

See 1 to 10 words for the rest of the "..." expression.

<script type= "Text/javascript" >
var result = confirm ("Do you confirm the deletion?") ");
Console.log (result);
if (result) {
Alert ("Deleting ...");
Alert ("You canceled the delete");

<script type= "Text/javascript" >
var username = "a123456";
Console.log (Username.charat (0));
for (var i = 0; i < username.length; i++) {
document.write (' <span class= ' font ' + i + ' "> ' + username.charat (i) +" </span> ");

JavaScript 71st session

Related Article

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.