在html中,可以利用“<meta>”標簽的“http-equiv”和“content”屬性實現跳轉到指定頁面的功能,語法“<meta http-equiv="refresh" content="跳轉時間; url=指定頁面的地址">”。
本教程操作環境:windows7系統、HTML5版、Dell G3電腦。
在html中,可以利用“<meta>”標簽來跳轉到指定頁面,只需要給<meta>”標簽設置“http-equiv”和“content”屬性即可。
語法:
<meta http-equiv="refresh" content="跳轉時間; url=指定頁面的地址">
-
http-equiv
屬性提供了 content 屬性的信息/值的 HTTP 頭。 -
content
屬性定義與 http-equiv 或 name 屬性相關的元信息。
http-equiv 屬性
當http-equiv 屬性的值設置為“refresh”,可定義文檔自動刷新的時間間隔。
實例:文檔自動刷新的時間間隔為30秒
<meta http-equiv="refresh" content="30">
注釋:值 "refresh" 應該慎重使用,因為它會使得頁面不受用戶控制。
示例:5秒后跳轉到指定頁面https://www.php.cn/
<!DOCTYPE html> <html> <head> <meta http-equiv="refresh" content="5; url=https://www.php.cn/"> </head> <body> 跳轉到指定頁面:PHP中文網 https://www.php.cn/ </body> </html>
推薦教程:《html視頻教程》