① HTML頁面中顯示HTML標簽代碼
HTML頁面中顯示HTML標簽代碼,可以使用<xmp>html標簽內容</xmp>,這樣,在網頁中就會顯示html標簽,如圖:
② 返回到上一頁的html代碼的幾種寫法
返回到上一頁的html代碼的幾種寫法
1.超鏈接返回上一頁代碼:
<a href=」#」 onClick=」javascript :history.back(-1);」>返回上一頁</a>
<a href=」#」 onClick=」javascript :history.go(-1);」>返回上一頁</a>
2.用按鈕代碼:
<input type=」button」 name=」Submit」 onclick=」javascript:history.back(-1);」 value=」返回上一頁」>
3.圖片代碼:
<a href=」javascript :;」 onClick=」javascript :history.back(-1);」><img src=」圖片路徑」 border=」0″ title=」返回上一頁」></a>
[color=#FF0000]幾秒鍾後[/color]自動返回上一頁代碼:(加入兩個head間,3000表示3秒)
<SCRIPT language=javascript>
function go()
{
window.history.go(-1);
}
setTimeout(「go()」,3000);
</SCRIPT>
「>返回上一頁</a>
<script>alert(『發布失敗』);location.href=』index.php』; window.history.go(-1);
</script>
(2)頁面的html代碼怎麼寫擴展閱讀:
跳轉頁面的html代碼的幾種寫法
html的實現
<head>
<!-- 以下方式只是刷新不跳轉到其他頁面 -->
<metahttp-equiv="refresh" content="10">
<!-- 以下方式定時轉到其他頁面 -->
<metahttp-equiv="refresh" content="5;url=hello.html">
</head>
2.javascript的實現
<script language="javascript"type="text/javascript">
// 以下方式直接跳轉
window.location.href='hello.html';
// 以下方式定時跳轉
setTimeout("javascript:location.href='hello.html'", 5000);
</script>
3.結合了倒數的javascript實現(IE)
<spanid="totalSecond">5</span>
<scriptlanguage="javascript" type="text/javascript">
var second = totalSecond.innerText;
setInterval("redirect()", 1000);
function redirect(){
totalSecond.innerText=--second;
if(second<0) location.href='hello.html';
}
</script>
③ 這個怎麼用HTML代碼在網頁中寫出來啊
js在頁面中插入HTML代碼,在js的方法中寫入html代碼,用innerHTML函數,最後在html代碼需要調用的時候,調用該方法即可。
代碼及步驟如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<html>
<head>
<script>
function a(){
var aText = "<table><tr><td>需要插入的數據</td></tr></table>";
document.getElementById("b").innerHTML(aText);
}
</script>
</head>
<body>
<button onclick="a()">點擊</button>
<div id="b"></div>
</body>
</html>
定義和用法
getElementById() 方法可返回對擁有指定 ID 的第一個對象的引用。
定義和用法
innerHTML 屬性設置或返回表格行的開始和結束標簽之間的 HTML。
④ 網頁的背景圖片的 html 代碼怎麼寫
1、CSS外部樣式:
body{background:url(1.jpg) repeat-x;} 前景圖片 平鋪
2、html內部樣式:
<style type="text/css">
body{background:url(1.jpg) repeat-x;} 前景圖片 平鋪
</style>
3、html行內樣式:
<div style="background:url(www.abc/background.jpg)"></div>
如果能幫到你,請採納
⑤ 用html如何製作一個簡單的網頁代碼
1、首先,在計算機桌面上創建一個新文件夾,然後在該文件夾中創建一個新的文本文檔。內
⑥ 注冊/登陸頁面HTML代碼該怎麼寫
以下為個人原創教學例子,任何人引用需註明出自網路知道用戶am7972,樓主可供參考
該例子涵蓋了文本框、密碼框、下拉菜單、單選框、復選框及文本區的使用
同時在數據的使用方面涵蓋了文本型、數值型、日期型、布爾型的使用
也涵蓋了在會員信息入資料庫前,進行嚴格的數據檢查
不足處,JS驗證還不是太完善,不過有服務端認證足夠了
<title>會員注冊</title>
<script type="text/javascript">
<!--function CheckForm()
{
if(document.userinfo.username.value == "")
{ alert("請輸入姓名,姓名不能為空!");
document.userinfo.username.focus();
return false;
}
if(document.userinfo.username.value.length > 10)
{
alert("輸入的姓名長度最多為10個字元!");
document.userinfo.username.focus();
return false;
}
}
//--></script>
</head>
<body>
<table border="1" width="53%" bordercolorlight="#000000" cellspacing="0" id="table1" height="358" bordercolor="#000000" bordercolordark="#FFFFFF" cellpadding="0">
<form method="POST" action="bb.asp" name="userinfo" onsubmit="return CheckForm();">
<tr><td colspan="2" height="37"> <p align="center">會員注員</td> </tr>
<tr> <td width="37%" align="right">姓名:</td> <td width="61%"> <input type="text" name="username" value="libin" size="13"> </td> </tr>
<tr> <td width="37%" align="right">密碼:</td> <td width="61%"> <input type="password" name="userPassword" size="20" value="123"></td> </tr>
<tr> <td width="37%" align="right">性別:</td> <td width="61%"><input type="radio" value="True" checked name="Sex">男 <input type="radio" name="Sex" value="False">女</td> </tr>
<tr> <td width="37%" align="right">生日:</td> <td width="61%"> <input type="text" name="userSR" size="11" value="1985-03-12"></td> </tr>
<tr> <td width="37%" align="right">年齡:</td> <td width="61%"><input type="text" name="userNL" size="9" value="13"></td> </tr>
<tr> <td width="37%" align="right">愛好:</td> <td width="61%"> <input type="checkbox" name="ah" value="sw">上網 <input type="checkbox" name="ah" value="ds" checked>讀書 <input type="checkbox" name="ah" value="ty">體育</td> </tr>
<tr> <td width="37%" align="right">上網方式:</td> <td width="61%">
<select size="1" name="swfs"> <option selected value="bhsw">撥號上網</option> <option value="wxsw">無線上網</option> <option value="gxsw">光纖上網</option> </select>
</td> </tr>
<tr> <td width="37%" align="right">個人簡介:</td> <td width="61%"><textarea rows="9" name="userGrjs" cols="34"></textarea></td> </tr> <tr> <td colspan="2" height="38"> <p align="center"><input type="submit" value="提交" name="B1"> <input type="reset" value="重置" name="B2"></td>
</tr>
</form>
</table>
====bb.asp的會員注冊非法數據監測====
<%
username = Request("username")
userPassword = Request("userPassword")
Sex = Request("Sex")
userSR = Request("userSR")
userNL = Request("userNL")
ah = Request("ah")
swfs = Request("swfs")
userGrjs = Request("userGrjs")
'判斷數據合法性,絕對不能讓非法數據進入系統
'判斷姓名username合不合法,是否包含非法數據
username = Trim(username) '例如:" 張 三 "經過處理之後變成"張 三"
If username ="" Then
Response.write "姓名不能為空"
Response.End
End If
If Len(username)>10 Then
Response.write "姓名字數不能超過10個字" 'Len("Z")=1 Len("國")=2
Response.End
End If
For i = 1 To Len(username)
q = Mid(username,i,1)
If InStr("!@#$%^&*()_-+|<>?/"",.",q)>0 Then
Response.write "姓名不能包含特殊符號!@#$%^&*()_-+|<>?/"",."
Response.End
End If
Next
'判斷密碼合不合法,是否包含非法數據userPassword = Trim(userPassword)If userPassword ="" Then Response.write "密碼不能為空" Response.EndEnd If
If Len(userPassword)>20 Then
Response.write "密碼字數不能超過20個字"
Response.End
End If
'判斷密碼合不合法,是否包含非法數據
Sex = Trim(Sex)
If Sex = "" Then
Response.write "性別不能為空"
Response.End
End If
If Sex <> "True" And Sex <> "False" Then
Response.write "性別不能為不男不女"
Response.End
End If
'判斷生日合不合法,是否包含非法數據
userSR = Trim(userSR)
If userSR ="" Then
Response.write "生日不能為空"
Response.End
End If
If Len(userSR)<8 Or Len(userSR)>10 Then '例如:2012-6-3 2012-11-23
Response.write "你輸入的生日字數不對,應為2012-6-3或2012-11-23格式"
Response.End
End If
If IsDate(userSR)=False Then
Response.write "你輸入的生日格式不能轉化為日期,請核實"
Response.End
End If
If DateDiff("yyyy",userSR,Date())<1 Or DateDiff("yyyy",userSR,Date())>200 Then
Response.write "根據你輸入的生日你可能小於1歲或已經超過200歲了,請核查重新輸入"
Response.End
End If
'判斷年齡合不合法,是否包含非法數據userNL = Trim(userNL)If userNL ="" Then
Response.write "年齡不能為空"
Response.End
End If
If IsNumeric(userNL)=False Then
Response.write "你輸入的年齡不能轉化為數值,請核查"
Response.End
End If
userNL = CInt(userNL)
If userNL<0 Or userNL>200 Then
Response.write "你輸入的年齡不能小於0歲或者大於200歲,請核查"
Response.End
End If
'判斷愛好合不合法,是否包含非法數據ah = Trim(ah) '選擇多個愛好則系統會用,分開 //測試
ah = Replace(ah," ","")
arrAh = Split(ah,",")
For i = LBound(arrAh) To UBound(arrAh)
If arrAh(i)<>"sw" And arrAh(i)<>"ds" And arrAh(i)<>"ty" Then
Response.write i & "你選擇的愛好有問題,請核查" & arrAh(i)
Response.End
End If
Next
'判斷上網方式合不合法,是否包含非法數據swfs = Trim(swfs)If swfs = "" Then
Response.write "上網方式不能為空"
Response.End
End If
If swfs<>"bhsw" And swfs<>"wxsw" And swfs<>"gxsw" Then
Response.write "你選擇的上網方式有問題,請核查"
Response.End
End If
'判斷個人簡介是否為空,是否超出1000個字
userGrjs = Trim(userGrjs)
If userGrjs = "" Then
Response.write "個人簡介不能為空"
Response.End
End If
If Len(userGrjs) > 1000 Then
Response.write "個人簡介不能超過1000個字"
Response.End
End If
Response.write "數據合法性檢測通過"
%>
====登陸的HTML代碼可相信樓主參照會員注冊代碼應該沒問題了====
⑦ 彈出窗口的html的代碼是怎麼寫的
1、最基本的彈出窗口代碼
< SCRIPT LANGUAGE="javascript">
< !--
window.open ("page.html")
-- >
< /SCRIPT>
window.open ("page.html") 用於控制彈出新的窗口page.html,如果page.html不與主窗口在同一路徑下,前面應寫明路徑,絕對路徑(http://)和相對路徑(../)均可。
2、經過設置後的彈出窗口
< SCRIPT LANGUAGE="javascript">
< !--
window.open ("page.html", "newwindow", "height=100, width=400, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no")
->
< /SCRIPT>
< SCRIPT LANGUAGE="javascript"> js腳本開始;window.open 彈出新窗口的命令;"page.html" 彈出窗口的文件名;"newwindow" 彈出窗口的名字(不是文件名),非必須,可用空"代替;
3、用函數控制彈出窗口
< script LANGUAGE="JavaScript">
< !--
function openwin() {
window.open ("page.html", "newwindow", "height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
}
-->
< /script>
這里定義了一個函數openwin(),函數內容就是打開一個窗口。
4、同時彈出2個窗口
< script LANGUAGE="JavaScript">
< !--
function openwin() {
window.open ("page.html", "newwindow", "height=100, width=100, top=0, left=0,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
window.open ("page2.html", "newwindow2", "height=100, width=100, top=100, left=100,toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no")
}
-->
< /script>
為避免彈出的2個窗口覆蓋,用top和left控制一下彈出的位置不要相互覆蓋即可。
5、主窗口打開文件1.htm,同時彈出小窗口page.html
< script language="javascript">
< !--
function openwin() {
window.open("page.html","","width=200,height=200")
}
-->
< /script>
⑧ html頁面怎麼引入html代碼
直接在html文件寫入html代碼即可。 最簡單的方法就是新建一個記事本,然後在記事本裡面寫入自己的html代碼,寫完之後ctrl+shift+s另存為html文件,雙擊打開這個文件就可以自動在瀏覽器運行了。 不過初學者的話建議還是使用一些像DW這樣的編輯器軟體來輔助自己編寫html代碼。 --河南新華網路運營協會為您解答!
⑨ 一個完整的html代碼怎麼編寫
簡單的htm的編寫過程如下:
先新建一個文本文件,可以自己命名,如回下圖,我命答名為測試。
測試是否成功,雙擊 測試.html,如果出現了下面的內容,恭喜你,你已經學會了最簡單的html編寫。