當前位置:首頁 » 操作系統 » html按鈕源碼

html按鈕源碼

發布時間: 2022-12-28 11:15:04

『壹』 HTML中怎麼設置按鈕的大小

html中設置按鈕的大小:可直接給input元素添加寬、高,具體代碼如下:

<input type="submit" value="確定" style="width:100px;height:60px">

下面是未設置input按鈕大小和設置了按鈕大小的對比效果:

源代碼:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>input</title>

<style type="text/css">

body{background: #ddd;}

form{margin:0;padding:0;}

form .btn{

width:100px;

height: 40px;

}

</style>

</head>

<body>

<input type="submit" value="確定" style="width:100px;height:60px;">

<input type="submit" value="確定" style="width:100px;height:100px">

<input type="submit" value="確定" >

<form action="form_action.asp" method="get">

<p>Email: <input type="text" name="email" /></p>

<p>Pin: <input type="text" name="pin" maxlength="18" /></p>

<input type="submit" value="提交" class="btn" />

</form>

</body>

</html>

『貳』 html源碼是什麼

html源碼是什麼就是用html語言寫的什麼標簽,樣式、js之類的計算機代碼(網頁的),
如:在後綴問。html的文件中用記事本打開輸入<input type="button" value="123"> 保存,在用瀏覽器打開,會顯示一個123的按鈕!
上面的 <input type="button" value="123">就是一段html源碼

『叄』 怎麼運行 html5游戲的源代碼

1、打開任意一個網站,根據自己的需要選擇。

『肆』 Struts源碼研究 - html-Link標簽篇

Struts里的:Cancel標簽是在Form中經常運用的一個標簽 主要功能就是cancel當前Form 一般寫法如下 ===========================<:cancel><bean:message key= createuser cancelbutton /></:cancel>===========================這個標簽將生成如下的HTML代碼 <input type= submit name= apacl CANCEL value= 返回 onclick= bCancel=true; >bCancel=true是一段javascript bCancel是在使用Struts的Validator時 Struts自動為我們加的一段Javascript代碼里的一個變數這段Javascript簡略摘要如下 ===========================<script type= text/javascript language= Javascript ><! Beginvar bCancel = false;function validateCreateUserForm(form) {if (bCancel)return true;elsereturn validateMaxLength(form) && validateRequired(form) && validateMinLength(form);}===========================由上可以看到 這個bCancel=true時 Javascript將自動將表單提交(return true) 也就是說 如果我們在後台Action的代碼里沒有對這個Cancel動作寫特定代碼的話 這個Cancel標簽產生的效果和submit按鈕產生的動作完全一致!!(因為這個按鈕的type也等於submit)這一點需要非常的注意!所以 一般來說 我們在Action類的execute方法裡面會加上如下的一段代碼來處理這個Cancel動作 ===========================// Was this transaction cancelled?if (isCancelled(request)) {return (mapping findForward( createusersuccess ));}===========================有了以上的代碼 Cancel動作就有了相應的處理代碼 轉到相關的頁面了 本來事情已經解決 但本著對Struts源碼研究的精神 我們還需要對以上代碼研究一下OK 讓我們來看一下isCancelled這個方法在什麼地方被定義了 內容是什麼?首先發現 這個方法被定義在Action類裡面 代碼如下 ===========================/*** <p>Returns <code>true</code> if the current form s cancel button was* pressed This method will check if the <code>Globals CANCEL_KEY</code>* request attribute has been set which normally occurs if the cancel* button generated by <strong>CancelTag</strong> was pressed by the user* in the current request If <code>true</code> validation performed* by an <strong>ActionForm</strong> s <code>validate()</code> method* will have been skipped by the controller servlet </p>** @param request The servlet request we are processing* @see apacl CancelTag*/protected boolean isCancelled(HttpServletRequest request) {return (request getAttribute(Globals CANCEL_KEY) != null);}===========================哦 原來是在request對象中查找Globals CANCEL_KEY這個key值是否綁定了一個對象 如果是 那麼就代表按下Cancel按鈕後 Struts會在request對象中綁定一個對象 並以這個key值來命名那Struts是在什麼地方綁定了這個對象呢?很自然的 讓我們從頭找起從ActionServlet的process方法開始找起 歷經多次方法調用 終於找到了根源 原來是在RequestProcessor java中 代碼如下 ===========================/*** <p>Process an <code>HttpServletRequest</code> and create the* corresponding <code>HttpServletResponse</code> </p>** @param request The servlet request we are processing* @param response The servlet response we are creating** @exception IOException if an input/output error occurs* @exception ServletException if a processing exception occurs*/public void process(HttpServletRequest request HttpServletResponse response)throws IOException ServletException {//省略代碼若干// Process any ActionForm bean related to this requestActionForm form = processActionForm(request response mapping);//答案就在這個processPopulate方法中processPopulate(request response form mapping);if (!processValidate(request response form mapping)) {return;}/*** Populate the properties of the specified ActionForm instance from* the request parameters included with this request In addition * request attribute <code>Globals CANCEL_KEY</code> will be set if* the request was submitted with a button created by* <code>CancelTag</code> ** @param request The servlet request we are processing* @param response The servlet response we are creating* @param form The ActionForm instance we are populating* @param mapping The ActionMapping we are using** @exception ServletException if thrown by RequestUtils populate()*/protected void processPopulate(HttpServletRequest request HttpServletResponse response ActionForm form ActionMapping mapping)throws ServletException {if (form == null) {return;}// Populate the bean properties of this ActionForm instanceif (log isDebugEnabled()) {log debug( Populating bean properties from this request );}form setServlet(this servlet);form reset(mapping request);if (mapping getMultipartClass() != null) {request setAttribute(Globals MULTIPART_KEY mapping getMultipartClass());}RequestUtils populate(form mapping getPrefix() mapping getSuffix() request);// Set the cancellation request attribute if appropriateif ((request getParameter(Constants CANCEL_PROPERTY) != null) ||(request getParameter(Constants CANCEL_PROPERTY_X) != null)) {request setAttribute(Globals CANCEL_KEY Boolean TRUE);}}===========================OK 看最後幾行代碼 Struts從request中取得Constants CANCEL_PROPERTY這個參數 如果這個參數不為空 那麼他就將TRUE這個對象以Globals CANCEL_KEY為key值 放到了request對象中至於這個Constants CANCEL_PROPERTY這個值是什麼 現在都可以猜到了 顯然就是:Cancel這個標簽生成的HTML代碼中 Cancel這個按鈕的名稱嘛!查了一下 果然是 <input type= submit name= apacl CANCEL value= 返回 onclick= bCancel=true; >而Constants CANCEL_PROPERTY這個值就是 apacl CANCEL lishixin/Article/program/Java/ky/201311/28930

『伍』 幫忙寫個HTML網頁按鈕代碼

<!doctypehtml>
<metacharset="utf-8"/>
<html>
<head>
<styletype="text/css">
html,body{
height:100%;
margin:0;
background:#EEEEEE;
position:relative;
}
button{
position:absolute;
top:50%;
left:50%;
width:400px;
height:100px;
margin:-50px-200px;
background:#ffffff;
font:72px"MicrosoftYaHei";
color:blue;
}
button:hover{
background:#eeeeff;
}
</style>
</head>
<body>
<buttononclick="location.href='#someplace'">進入BBS</button>
</body>
</html>


代碼如上,兼容直到IE6

『陸』 用html如何實現點擊按鈕變換按鈕的樣式

html頁面如下:


<divclass="wrapper">
<divid="focus">
<ul>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/01.jpg"alt="QQ商城焦點圖效果下載"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/02.jpg"alt="QQ商城焦點圖效果教程"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/03.jpg"alt="jquery商城焦點圖效果"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/04.jpg"alt="jquery商城焦點圖代碼"/></a></li>
<li><ahref="http://www.lanrentuku.com/"target="_blank"><imgsrc="img/05.jpg"alt="jquery商城焦點圖源碼"/></a></li>
</ul>
</div>

</div><!--wrapperend-->
</body>

css樣式:


<styletype="text/css">
*{margin:0;padding:0;}
body{font-size:12px;color:#222;font-family:Verdana,Arial,Helvetica,sans-serif;background:#f0f0f0;}
.clearfix:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
.clearfix{zoom:1;}
ul,li{list-style:none;}
img{border:0;}

.wrapper{width:800px;margin:0auto;padding-bottom:50px;}

/*qqshopfocus*/
#focus{width:800px;height:280px;overflow:hidden;position:relative;}
#focusul{height:380px;position:absolute;}
#focusulli{float:left;width:800px;height:280px;overflow:hidden;position:relative;background:#000;}
#focusullidiv{position:absolute;overflow:hidden;}
#focus.btnBg{position:absolute;width:800px;height:20px;left:0;bottom:0;background:#000;}
#focus.btn{position:absolute;width:780px;height:10px;padding:5px10px;right:0;bottom:0;text-align:right;}
#focus.btnspan{display:inline-block;_display:inline;_zoom:1;width:25px;height:10px;_font-size:0;margin-left:5px;cursor:pointer;background:#fff;}
#focus.btnspan.on{background:#fff;}
#focus.preNext{width:45px;height:100px;position:absolute;top:90px;background:url(img/sprite.png)no-repeat00;cursor:pointer;}
#focus.pre{left:0;}
#focus.next{right:0;background-position:righttop;}
</style>

『柒』 網頁設計常用HTML代碼

網頁設計常用HTML代碼大全

HTML是用來描述網頁的一種語言。下面我為大家分享HTML代碼,希望對大家學習html代碼有幫助!

忽視右鍵

<body oncontextmenu="return false">

<body style="overflow-y:hidden">

1.如何幾秒後轉到別的頁面?

<META HTTP-EQUIV="Refresh" CONTENT="時間;URL=地址">

2.點擊關閉窗口

<a href="javascript:top.window.close();">點擊關閉窗口</a>!

3.請問如何去掉主頁右面的滾動條?

<body scroll="no">

<body style="overflow-y:hidden">

4.請問如何做到讓一個網頁自動關閉.

<html>

<head>

<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<param name="Command" value="Close">

</object>

</head>

<body onload="window.setTimeout(‘‘‘‘closes.Click()‘‘‘‘,10000)">

這個窗口會在10秒過後自動關閉,而且不會出現提示. </body>

如何在不刷新頁面的情況下刷新css?

<style>

button{ color:#000000;}

</style>

<button onclick=document.styleSheets[0].rules[0].style.color=‘‘‘‘red‘‘‘‘>點擊按鈕直接修改style標簽里button選擇符使按鈕改為紅色</button>

請問如何讓網頁自動刷新?

在head部記入<META HTTP-EQUIV="Refresh" content="20">其中20為20秒後自動刷新,你可以更改為任意值。

5.如何讓頁面自動刷新?

方法一,用refresh

HTML 代碼片段如下:

<head>

<meta http-equiv="refresh" content="5">

</head>

5表示刷新時間

[Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]

方法二,使用setTimeout控制

<img src=/logo.gif>

<script>

function rl(){

document.location.reload()

}

setTimeout(rl,2000)

</script>

6.如何讓超鏈接沒有下劃線

在源代碼中的<HEAD>…</HEAD>之間輸入如下代碼:

<style type="text/css"> <!--

a { text-decoration: none}

--> </style>

7.請問如何去掉IE的上下滾動條?

<body style=‘‘‘‘overflow:scroll;overflow-y:hidden‘‘‘‘>

</body>

8.怎樣才能把RealPlayer文件在網頁做一個試聽連接?

<embed height=25src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" controls="PlayButton">

9.如何用html實現瀏覽器上後退按鈕的功能?

<a href="java script:history.go(-1)">點擊後退</a>

或者

<script> history.back() </script>

10.請問怎麼在網頁中改變滑鼠的箭頭形狀?

HTML 代碼片段如下:

<body>

<a href="#" style="cursor: auto;">auto</a><br>

<a href="#" style="cursor: crosshair ">crosshair </a><br>

<a href="#" style="cursor: default ">default </a><br>

<a href="#" style="cursor: hand ">hand </a><br>

<a href="#" style="cursor: move ">move </a><br>

<a href="#" style="cursor: e-resize ">e-resize </a><br>

<a href="#" style="cursor: ne-resize ">ne-resize </a><br>

<a href="#" style="cursor: nw-resize">nw-resize</a><br>

<a href="#" style="cursor: n-resize">n-resize</a><br>

<a href="#" style="cursor: se-resize">se-resize</a><br>

<a href="#" style="cursor: sw-resize">sw-resize</a><br>

<a href="#" style="cursor: s-resize">s-resize</a><br>

<a href="#" style="cursor: w-resize">w-resize</a><br>

<a href="#" style="cursor: text">text</a><br>

<a href="#" style="cursor: wait">wait</a><br>

<a href="#" style="cursor: help">help</a><br>

</body>

11.怎樣不使用頁面的緩存?即每一次打開頁面時不是調用緩存中的東西

<META HTTP-EQUIV="Pragma" CONTENT="no-cache">

12.頁面打開時自動彈出一個窗口的代碼怎麼寫?

HTML 代碼片段如下:

<html>

<head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script language="<B style="color:black;background-color:#A0FFFF">javascript</B>">

<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0

window.open(theURL,winName,features);

}

//-->

</script>

</head>

<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_openBrWindow(‘‘‘‘http://www.35ui.cn/‘‘‘‘,‘‘‘‘,‘‘‘‘width=400,height=400‘‘‘‘)">

</body>

</html>

13.如何讓我的頁面出現一個會講話的小人?Merlin

HTML 代碼片段如下:

<HTML>

<HEAD>

<TITLE>默林</TITLE>

<META http-equiv=Content-Type content="text/html; charset=gb2312">

</HEAD>

<BODY>

<p><OBJECT id=sims classid=CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F>

</OBJECT>

<SCRIPT>

var MerlinID;

var MerlinACS;

sims.Connected = true;

MerlinLoaded = LoadLocalAgent(MerlinID, MerlinACS);

Merlin = sims.Characters.Character(MerlinID);

Merlin.Show();

Merlin.Play("Surprised");

Merlin.Speak("大家好");

Merlin.Play("GestureLeft");

Merlin.Think("我是默林!");

Merlin.Play("Pleased");

Merlin.Think("可愛嗎?");

Merlin.Play("GestureDown");

Merlin.Speak("哈哈!");

Merlin.Hide();

function LoadLocalAgent(CharID, CharACS){

LoadReq = sims.Characters.Load(CharID, CharACS);

return(true);

}

</SCRIPT>

</p>

<p> </p>

<p>看此效果必須裝有office2000!!!</p>

</BODY>

</HTML>

14.在頁面中如何加入不是滿鋪的背景圖片,拉動頁面時背景圖不動

HTML 代碼片段如下:

<html><head>

<STYLE>

body {background-image:url(logo.gif);

background-repeat:no-repeat; background-position:center }

</STYLE>

</head>

<body bgproperties="fixed" >

</body>

</html>

[Ctrl+A 全部選擇 提示:你可先修改部分代碼,再按運行]

background-repeat:no-repeat; 是讓背景圖不佔滿整個頁面

body bgproperties="fixed" 是拉動scroll時背景圖不動

15.文本輸入框什麼屬性能實現不可輸入?

HTML 代碼片段如下:

<input type="text" name="textfield" disabled>

或者

<input type="text" name="textfield" readonly>

16.如何禁止自己的頁面在別人的框架里打開?

把以下代碼加至你的<head>區

<script>

if (window.top!=self){

window.top.location=self.location

}

</script>

17.如何實現首頁全屏幕顯示?

HTML 代碼片段如下:

<html>

<body><script language="<B style="color:black;background-color:#A0FFFF">javascript</B>">

var coolw=642

var coolh=400

var coolhuang=window.open("http://www.35ui.cn","coolhuang","width="+coolw+",height="+coolh+",

fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0")

window.close()

</script></body></html>

18.如何監聽一個窗口被關閉了?

HTML 代碼片段如下:

<body onunload="alert(‘‘‘‘你關閉了這個窗口‘‘‘‘)">

19.如何禁止Ctrl+N?

HTML 代碼片段如下:

<body onkeydown=return(!(event.keyCode==78&&event.ctrlKey))>

如何把頁面加入用戶的收藏夾?

HTML 代碼片段如下:

<a href="<B style="color:black;background-color:#A0FFFF">javascript</B>:window.external.AddFavorite(‘‘‘‘http://www.35ui.cn‘‘‘‘,‘‘‘‘無憂腳本‘‘‘‘)">收藏無憂腳本</a>

如何在我的'頁面中加入背景音樂?

IE: <bgsound src="*.mid" loop=infinite>

NS:<embed src="*.mid" autostart=true hidden=true loop=true>

*.mid你的背景音樂的midi格式文件

關於頁面轉換效果

<meta http-equiv="page-enter" content="revealTrans(Duration=4,Transition=23)">

<meta http-equiv="page-exit" content="revealTrans(Duration=4,Transition=23)">

說明:Transition=23是隨機效果,另可以選0-22任一數字固定某個效果

如何設定打開頁面的大小

HTML 代碼片段如下:

<body onload="top.resizeTo(300,200);"><!--(width,height)-->

怎樣雙擊滾屏,單擊停止?

HTML 代碼片段如下:

<html>

<head>

<title>新網頁1</title>

</head>

<body>

<script language"<B style="color:black;background-color:#A0FFFF">javascript</B>">

var currentpos,timer;

function initialize()

{

timer=setInterval("scrollwindow()",10);

}

function sc(){

clearInterval(timer);

}

function scrollwindow()

{

currentpos=document.body.scrollTop;

window.scroll(0,++currentpos);

if (currentpos != document.body.scrollTop)

sc();

}

document.onmousedown=sc

document.ondblclick=initialize

</script>

<p>a</p><p>a</p><p>a</p><p>aa</p><p>aa</p><p>aa</p>

<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p>

<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>aa</p>

<p>aa</p><p>aa</p><p>aa</p><p>aa</p><p>a</p>

</body>

</html>

如何讓body中的文字不被選中?

HTML 代碼片段如下:

<body onselectstart="return false" >aaa</body>

如何讓彈出的窗口不能關閉?

在新開的窗口中加入如下代碼

<body onunload=open(location.href)>

</body>

如何讓瀏覽器在保存頁面時保存失敗?

HTML 代碼片段如下:

<NOSCRIPT>

<<B style="color:black;background-color:#ffff66">IFRAME</B> SRC="*.html">

</<B style="color:black;background-color:#ffff66">IFRAME</B>>

</NOSCRIPT>

表單中如何用圖片按鈕實現 reset?

<html>

<head>

<script>

function aaa(){

document.forms[0].reset()

}

</script>

</head>

<body>

<form>

<textarea rows="2" name="S1" cols="20"></textarea>

<input type="submit" values="提交" name="B1">

<image src="logo.gif" onclick=aaa()>

</form>

</body></html>

進入網頁時彈出的信息對話框

<body onLoad="window.alert(‘‘‘‘歡迎光臨本站‘‘‘‘)">

關閉窗口後彈出對話框

<body onUnload="window.alert(‘‘‘‘謝謝你的光臨!歡迎下次再來!‘‘‘‘)">

告別提示

<body onUnload= alert("再見,感謝你的訪問!")>

右鍵菜單的製作

<OBJECT id=menu type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<PARAM name="Command" value="Related Topics,menu">

<PARAM name="Item1" value="動易;http://www.35ui.cn">

<PARAM name="Item2" value="搜狐;http://www.35hu.cn">

<PARAM name="Item3" value="新浪;http://www.35no.cn">

<PARAM name="Item4" value="網易;http://www.chinsgp.cn">

<PARAM name="Item5" value="互動學院;http://www.35ui.cn">

</OBJECT> <script> if (document.all) document.body.onmousedown=new Function("if (event.button==2) menu.Click();") </script>

下拉菜單

<object id=HHCtrl type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"> <PARAM name="Command" value="Related Topics,Menu"> <PARAM name="Item1" value="aspease;http://www.35ui.cn"> <PARAM name="Item2" value="byhu;http://www.35ui.cn"> <PARAM name="Item3" value="lzz;http://www.35ui.cn"> </object> <a href=javascript:HHCtrl.Click() title="下拉菜單">下拉菜單</a>

;

『捌』 幫我看看一段html 網頁源碼...為什麼點擊按鈕"Click me" 後,輸入框裡面沒有顯示指定的值100呢

一樓說的在IE里邊不支持這個方法但是IE8支持啊,這個方法IE 6 7沒測,
document.getElementsByName(FirstName).value=100;
這一句裡面有兩個錯誤,
第一FirstName要加引號的
第二,這個方法得到是一個數組,所以你的.value=100;這樣寫是不對的,
正確的寫法是
document.getElementsByName("FirstName")[0].value=100;
還有就是一樓說的你方法名寫錯了

『玖』 HTML源代碼是什麼

網頁空白處點擊右鍵 查看源文件 那就是HTML代碼x0dx0a用處就是以瀏覽器認識的格式 來布局網頁 這里包括圖片載入 文字樣式等等信息x0dx0a你看到的東西應該在HTML里都能找到x0dx0ax0dx0a要使用的話 可以用DREAMWEAVER網頁編輯軟體來編輯HTML代碼 這個軟體有圖形操作界面,你布局好 自己就生成相應的HTML代碼

熱點內容
am27系列存儲器 發布:2025-05-10 19:45:48 瀏覽:668
android支持的視頻格式 發布:2025-05-10 19:45:09 瀏覽:494
模擬器安卓版哪個好用電腦玩 發布:2025-05-10 19:41:00 瀏覽:16
浪潮伺服器配置bmc管理ip 發布:2025-05-10 19:26:31 瀏覽:469
兒童編程編 發布:2025-05-10 19:05:46 瀏覽:384
自己在電腦上怎麼搭建伺服器 發布:2025-05-10 19:05:11 瀏覽:426
沖鋒車裡面配置了什麼 發布:2025-05-10 18:55:31 瀏覽:430
c語言typedef的用法 發布:2025-05-10 18:51:35 瀏覽:893
同城網站源碼 發布:2025-05-10 18:47:36 瀏覽:643
怎麼查網易我的世界伺服器ip 發布:2025-05-10 18:46:19 瀏覽:943