靜態網頁開發中遇到的小問題積累

1.HTML中設置瀏覽器標題前的logo:

在<head></head>標籤之間輸入

<link rel="icon" href="圖片位置" type="image/x-icon"/>

2.在線引入所需框架:

<!--引入jquery-->
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<!--引入bootstrap-->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

3.校驗只能包含字母數字下劃線

<script>
	var str = '123'
	var filt = /^[a-zA-Z0-9_]+$/
	if (!filt.test('123123@34')) {
		alert(12313)
	} else {
		alert(456)
	}
</script>

4.讀程序

<script>
	function myFunc () {
		document.write(a)
		document.write(func())
		var a = 1
		function func () {
			return 2
		}
	}
	myFunc()
</script>

5.當用戶打開一個網頁時,想一直停留在當前打開的頁面,禁止頁面前進和後退的命令是:

window.history.forward(1)

window.history.forward(-1)

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章