ホームページ ウェブフロントエンド jsチュートリアル Javascript_javascript スキルの最初の概要の概要

Javascript_javascript スキルの最初の概要の概要

May 16, 2016 pm 03:50 PM
javascript 最初の知り合い

1.HTML 内のスクリプトは、<script> タグと </script> の間に配置する必要があります。

スクリプトは HTML ページの セクションに配置できます

2. JavaScript から HTML 要素にアクセスするには、 document.getElementById(id) メソッドを使用できます

3. document.write() を通じて、タグを含むコンテンツを HTML ドキュメントに書き込むことができます。ドキュメントがロードされた後に document.write() が実行されると、HTML ドキュメント全体が上書きされることに注意してください

4.JS は 2 つの方法でアノテーションを付けます: // と /**/

5. 変数は var を通じて宣言されます。JS は弱い型指定言語であるため、変数の型を指定する必要はありません。

07326691def468f747e0ddc30a96c8c1

7.var num=new Number()//Declare a Number object

Number.MAX_VALUE Maximum value
Number.MIN_VALUE Minimum value
Number.NaN special non-numeric value
Number.NEGATIVE_INFINITY Negative infinity
Number.POSITIVE_INFINITY Positive infinity
Number.toExponential() Format numbers using exponential notation
Number.toFixed( ) uses fixed-point counting to format numbers
Number.toLocaleString() Converts numbers into local format strings
Number.toPrecision() Format the significant digits of the number
Number.toString( ) Converts a number into a string
Number.valueOf( ) returns the original value
8.var str = new String() //Declare a string object

str.substr(start,length): Extract and return a substring in str. But it does not modify str. start indicates the starting position of extraction, and length indicates the length. If length is omitted, it indicates extraction to the end.

str.substring(from,to): will return the substring of the string string, consisting of the characters from from to to, including the characters located in from, excluding the characters located in to. If from>to, that is Intercepted after automatic replacement.

 Str.toLowerCase(): Convert the string to lowercase

 Str.toUpperCase(): Convert the string to uppercase

str.split(): Split the string according to the specified symbol

str.slice(): Same as substring() but more flexible, allowing negative values, similar to Array.slice()

str.concat(): String link, similar to Array.concat, but it is more convenient to use numbers

Str.indexOf(): Retrieve characters and return the position where the character first appears

9.var date=new Date() //Create a date object

Main methods:

Date.get/setDay() //Return/set a day of the week (0~6),

Date.get/setFullYear() // Return/set the year in system time

Date.get/setMonth() // Return/set the month field (0~11) in system time

date.get/setDate() //Return/set a certain day of the month

Date.get/setHours() // Return/set the hour field in the system time

Date.get/setMinutes() // Return/set the minutes field in the system time

Date.get/setSeconds() // Return/set the seconds field in the system time

Date.get/setTime() //Return/Set//Return/Set the minute field in the system time

10.var arr=new Array() //Create an array object

Main attributes: arr.length //Returns the length of the array

Main methods:

pop() //Delete and return the last element of the array, the return value is the deleted element

push() //Add elements to the end of the array and return the length of the array

shift()  //Move the first element out of the array, and the return value is the deleted element

unshift()  //Insert an element at the head of the array and return the length of the array

 slice()   //Return a part of the array, the parameter can be a negative value, return the intercepted array

Reverse() //Reverse the order in the array and return the reversed array

sort()  //To sort array elements, you need to specify a method

concat()  //Array connection, returns the connected array without changing the original array

join()  //Join the array elements with the specified characters and return them in string form

splice() //Insert, delete or replace elements of the array,

toString() //Convert the array into a string

11.Math is a native object

Math.abs() //Return the absolute value

Math.ceil() // Round up

Math.floor() // Countryside rounding

Math.round() // Rounding up

Math.randow() // Returns a random number

Math.max() // Return the larger value

Math.min() // Return the smaller value

Math.PI() //Constant PI

Math.pow() // x to the y power

Math.sqrt() // Calculate the square

12. Others

isNaN() // Determine whether it is a numerical value. If not, return true

parseInt() // Forced conversion to integer type

parseFloat() // Forced conversion to floating point value

alert() // Warning

confirm()  //Message confirmation box

prompt()  //Prompt message box

Document.write() //Write content to the HTML document. If the document content is loaded and written using this method, the entire HTML document will be overwritten

 document.getElementById() //Get the object by ID name

 document.getElementsTagName() //Get the object through the tag name and return an array object

 document.getElementsClassName() //Get the object through the class name and return an array object

The above is the entire content of this article, I hope you all like it.

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

WebSocket と JavaScript: リアルタイム監視システムを実装するための主要テクノロジー WebSocket と JavaScript: リアルタイム監視システムを実装するための主要テクノロジー Dec 17, 2023 pm 05:30 PM

WebSocketとJavaScript:リアルタイム監視システムを実現するためのキーテクノロジー はじめに: インターネット技術の急速な発展に伴い、リアルタイム監視システムは様々な分野で広く利用されています。リアルタイム監視を実現するための重要なテクノロジーの 1 つは、WebSocket と JavaScript の組み合わせです。この記事では、リアルタイム監視システムにおける WebSocket と JavaScript のアプリケーションを紹介し、コード例を示し、その実装原理を詳しく説明します。 1.WebSocketテクノロジー

WebSocket と JavaScript を使用してオンライン音声認識システムを実装する方法 WebSocket と JavaScript を使用してオンライン音声認識システムを実装する方法 Dec 17, 2023 pm 02:54 PM

WebSocket と JavaScript を使用してオンライン音声認識システムを実装する方法 はじめに: 技術の継続的な発展により、音声認識技術は人工知能の分野の重要な部分になりました。 WebSocket と JavaScript をベースとしたオンライン音声認識システムは、低遅延、リアルタイム、クロスプラットフォームという特徴があり、広く使用されるソリューションとなっています。この記事では、WebSocket と JavaScript を使用してオンライン音声認識システムを実装する方法を紹介します。

JavaScript と WebSocket を使用してリアルタイムのオンライン注文システムを実装する方法 JavaScript と WebSocket を使用してリアルタイムのオンライン注文システムを実装する方法 Dec 17, 2023 pm 12:09 PM

JavaScript と WebSocket を使用してリアルタイム オンライン注文システムを実装する方法の紹介: インターネットの普及とテクノロジーの進歩に伴い、ますます多くのレストランがオンライン注文サービスを提供し始めています。リアルタイムのオンライン注文システムを実装するには、JavaScript と WebSocket テクノロジを使用できます。 WebSocket は、TCP プロトコルをベースとした全二重通信プロトコルで、クライアントとサーバー間のリアルタイム双方向通信を実現します。リアルタイムオンラインオーダーシステムにおいて、ユーザーが料理を選択して注文するとき

WebSocketとJavaScriptを使ったオンライン予約システムの実装方法 WebSocketとJavaScriptを使ったオンライン予約システムの実装方法 Dec 17, 2023 am 09:39 AM

WebSocket と JavaScript を使用してオンライン予約システムを実装する方法 今日のデジタル時代では、ますます多くの企業やサービスがオンライン予約機能を提供する必要があります。効率的かつリアルタイムのオンライン予約システムを実装することが重要です。この記事では、WebSocket と JavaScript を使用してオンライン予約システムを実装する方法と、具体的なコード例を紹介します。 1. WebSocket とは何ですか? WebSocket は、単一の TCP 接続における全二重方式です。

JavaScript と WebSocket: 効率的なリアルタイム天気予報システムの構築 JavaScript と WebSocket: 効率的なリアルタイム天気予報システムの構築 Dec 17, 2023 pm 05:13 PM

JavaScript と WebSocket: 効率的なリアルタイム天気予報システムの構築 はじめに: 今日、天気予報の精度は日常生活と意思決定にとって非常に重要です。テクノロジーの発展に伴い、リアルタイムで気象データを取得することで、より正確で信頼性の高い天気予報を提供できるようになりました。この記事では、JavaScript と WebSocket テクノロジを使用して効率的なリアルタイム天気予報システムを構築する方法を学びます。この記事では、具体的なコード例を通じて実装プロセスを説明します。私たちは

簡単な JavaScript チュートリアル: HTTP ステータス コードを取得する方法 簡単な JavaScript チュートリアル: HTTP ステータス コードを取得する方法 Jan 05, 2024 pm 06:08 PM

JavaScript チュートリアル: HTTP ステータス コードを取得する方法、特定のコード例が必要です 序文: Web 開発では、サーバーとのデータ対話が頻繁に発生します。サーバーと通信するとき、多くの場合、返された HTTP ステータス コードを取得して操作が成功したかどうかを判断し、さまざまなステータス コードに基づいて対応する処理を実行する必要があります。この記事では、JavaScript を使用して HTTP ステータス コードを取得する方法を説明し、いくつかの実用的なコード例を示します。 XMLHttpRequestの使用

JavaScriptでinsertBeforeを使用する方法 JavaScriptでinsertBeforeを使用する方法 Nov 24, 2023 am 11:56 AM

使用法: JavaScript では、insertBefore() メソッドを使用して、DOM ツリーに新しいノードを挿入します。このメソッドには、挿入される新しいノードと参照ノード (つまり、新しいノードが挿入されるノード) の 2 つのパラメータが必要です。

JavaScript で HTTP ステータス コードを簡単に取得する方法 JavaScript で HTTP ステータス コードを簡単に取得する方法 Jan 05, 2024 pm 01:37 PM

JavaScript で HTTP ステータス コードを取得する方法の紹介: フロントエンド開発では、バックエンド インターフェイスとの対話を処理する必要があることが多く、HTTP ステータス コードはその非常に重要な部分です。 HTTP ステータス コードを理解して取得すると、インターフェイスから返されたデータをより適切に処理できるようになります。この記事では、JavaScript を使用して HTTP ステータス コードを取得する方法と、具体的なコード例を紹介します。 1. HTTP ステータス コードとは何ですか? HTTP ステータス コードとは、ブラウザがサーバーへのリクエストを開始したときに、サービスが

See all articles