html清空按钮代码,HTML DOM console.clear()用法及代码示例
生活随笔
收集整理的這篇文章主要介紹了
html清空按钮代码,HTML DOM console.clear()用法及代码示例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
HTML中的console.clear()方法用于清除控制臺,并在每次執行時在控制臺上寫一些消息“Console was cleared”。此方法不需要任何參數。
用法:
console.clear()
以下示例程序旨在說明HTML中的console.clear()方法:
例:
DOM console.clear() Method in HTMLh1 {
color:green;
}
h2 {
font-family:Impact;
}
body {
text-align:center;
}
GeeksforGeeks
DOM console.clear() Method
To view the message in the console press the F12
key on your keyboard.
To clear the console, double click
the button below:
Clear Console
console.log("GeeksforGeeks is a portal for geeks!");
function clear_console() {
console.clear();
}
輸出:
按下F12鍵時的控制臺視圖:
雙擊清除按鈕后,查看控制臺視圖:
支持的瀏覽器:console.clear()方法支持的瀏覽器如下:
谷歌瀏覽器
IE瀏覽器
火狐瀏覽器
Opera
蘋果瀏覽器
總結
以上是生活随笔為你收集整理的html清空按钮代码,HTML DOM console.clear()用法及代码示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: STM32快速入门
- 下一篇: html输入内容重置代码,HTML 提交