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