html按鍵
A. 怎樣在html中插入按鈕
1、打開Sublime text3,新建一個HTML文檔,並且建立好框架。
B. 怎麼把html中按鈕設置為圓形
把html中按鈕設置為圓形很簡單,只需要將按鈕的border-radius屬性設置50%,同時將寬和高設置相同即可並去除邊框線。具體實現代碼如下:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="button" value="按鈕" style="width: 50px; height: 50px; border-radius: 50%;border: none">
</body>
</html>
運行效果如圖
(2)html按鍵擴展閱讀:
HTML的特點
1、簡易性:超級文本標記語言版本升級採用超集方式,從而更加靈活方便。
2、可擴展性:超級文本標記語言的廣泛應用帶來了加強功能,增加標識符等要求,超級文本標記語言採取子類元素的方式,為系統擴展帶來保證。
3、平台無關性:雖然個人計算機大行其道,但使用MAC等其他機器的大有人在,超級文本標記語言可以使用在廣泛的平台上,這也是萬維網(WWW)盛行的另一個原因。
4、通用性:另外,HTML是網路的通用語言,一種簡單、通用的全置標記語言。它允許網頁製作人建立文本與圖片相結合的復雜頁面,這些頁面可以被網上任何其他人瀏覽到,無論使用的是什麼類型的電腦或瀏覽器。
C. 求一個關於鍵盤上按鍵的一個html代碼
不少網友的主頁上都放置了背景音樂,這給網頁增色不少,但有時候訪客並不喜歡這樣,因為,他在打開你的網頁之前可能正在聽別的音樂,或者是別的原因。這個時候應該給來客一個選擇的機會:停止或暫停背景音樂的播放。
如果你的背景音樂是用<embed>方法播放的,那麼控制起來非常容易的。Follow me!
首先我們需要給出<embed>一個id,這個id就是背景音樂的標識,在你的網頁代碼中它必須是唯一的,也就是,其他元素如果也用了id的話,就不能和它重復,否則會出亂。這有點像有兩個黑馬在一塊,你一叫,兩個都有響應,結果就亂了。記住,id要唯一。
下面是定義了id的<embed>語句樣式:
<embed src="音樂文件地址" type=audio/mpeg hidden="true" autostart="true" loop="true" id="music"></embed>
上面代碼中,我們用"music"來做為背景音樂播放機的標識,往下我們就通過對這個標識進行控制,從而達到控制背景音樂的目的。
一般地,用於網頁播放的插件都有對音樂的幾個基本的控制方法:play(播放)、stop(停止)和pause(暫停)。它們的語法約定是:標識.方法(),例如播放音樂的語句是:music.play()。這樣,我們可以設置幾個按鈕,當按鈕被點擊時發出相應的指令。以下就是實現代碼:
<form>
<input type="button" value="播放" onclick="music.play()">
<input type="button" value="停止" onclick="music.stop()">
<input type="button" value="暫停" onclick="music.pause()">
</form>
幾點說明:
一、關於embed
◇ embed可用的媒體格式比較豐富,可放心使用。但如果該媒體格式所使用的插件不提供play、stop等方法(極少有),那我們的設置是無效的;
◇ type應當指定。但是,盡管指定,它仍然依賴於訪客機器中對媒體文件的關聯設置,比如,訪客將MP3和RealPlay做了關聯,那麼,他的機器就會用RealPlay在後台播放背景音樂;
◇ 使用hidden="true"來隱藏播放機比用width=0 height=0效果要理想得多,用後者並不能完全隱藏,不是有一條線就是有一個點出現在網頁里。
二、關於input
◇ type="button":不能改動,button是「按鈕」的意思;
◇ value="播放":按鈕上面的說明文字;
◇ onclick:表示滑鼠左鍵單擊操作,後面用「=方法」向系統發出指令。
以下是實例代碼與效果:
<embed src=http://www.gxblk.com/music/test.mid type=audio/mpeg hidden="true" autostart="true" loop="true" id="music"></embed>
<form>
<input type="button" value="播放" onclick="music.play()">
<input type="button" value="停止" onclick="music.stop()">
<input type="button" value="暫停" onclick="music.pause()">
</form>
附:bgsond的控制方法
<bgsound src="音樂地址" id="music" loop=-1>
<a href="#" onclick="music.src=''">停止</a>
<a href="#" onclick="music.src='音樂地址'">播放</a>
D. html中的按鈕
<input type="submit" value="選擇/修改「 />
E. 在html中如何將button按鈕顯示在網頁的中間
需要准備的材料分別有:電腦、瀏覽器、html編輯器。
1、首先,打開html編輯器,新建html文件,例如專:index.html,輸入屬問題基礎代碼。
F. html觸發按鍵
用ajax 或者手動提交表單
我用後者做把
test.html
<script>
function fn(n) {
document.forms[0].field.value = n;
document.forms[0].submit();
}
</script>
<form method="post" action="action.php">
<input type="button" name="field_name1" value="1" onclick="fn(this.value)">按鈕1
<input type="button" name="field_name2" value="2" onclick="fn(this.value)">按鈕2
<input type="text" name="field" /> <!-- 隱藏元素 -->
</form>
action.php
<?php
資料庫連接並選擇資料庫部分省略
if($_POST) {
$field = $_POST['field'];
$sql = "update tbName set name=".$field
}
header('location:test.htm');
?>
這個只是把 tbName 表中的 name 欄位反復修改成 1 或 2
如果有條件的話 就在 test.htm 中多加幾個隱藏欄位就OK了!
ajax處理 其實跟這個一樣 只不過是通過 ajax非同步提交表單而已
寫起來代碼也比較多 理解起來也比較南 如果需要的話追問把 我到時候在給你補
G. HTML按鈕點擊事件
在<body>里加一個onload="abc()"的屬性就行了,abc()即為處理的方法。
1、設置一個定時觸發事件
$timeout(function () {
alert("這里寫你的點擊會觸發的事件")
}, 500)
0.5秒後執行
2、或者你自己把點擊事件 寫成直接執行不需要點擊。
abc=function(){
alert("你要執行的語句");
}
abc();
注意:不過直接寫有一個缺陷,這涉及到生命周期,如果你多級頁面跳轉,你第一次編譯時會執行,如果有緩存的話他就不會執行了,如果你想每次(不管什麼情況只要進入這個頁面就執行)最好把這個寫到生命周期裡面。
H. html的簡單頁面,2個按鍵,實現功能。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Document</title>
<script src="others/jquery-1.11.3.min.js" type="text/javascript"></script>
</head>
<body>
<div class="box">
<input type="text" />
<input type="text" />
<input type="text" /><br/><br/>
<button id="">復制</button><br/><br/>
</div>
<div class="clearbox">
<input type="text" />
<input type="text" />
<input type="text" /><br/><br/>
<input type="text" />
<input type="text" />
<input type="text" /><br/><br/>
<input type="text" />
<input type="text" />
<input type="text" /><br/><br/>
<button id="clear">清空</button>
</div>
</body>
</html>
<script type="text/javascript">
$("#").click(function(event) {
var val1=$(".box input").eq(0).val();
var val2=$(".box input").eq(1).val();
var val3=$(".box input").eq(2).val();
var cval1=$(".clearbox input").eq(0).val();
var cval2=$(".clearbox input").eq(3).val();
var cval3=$(".clearbox input").eq(6).val();
if(cval1==""){
$(".clearbox input").eq(0).val(val1)
$(".clearbox input").eq(1).val(val2)
$(".clearbox input").eq(2).val(val3)
}else if(cval2==""){
$(".clearbox input").eq(3).val(val1)
$(".clearbox input").eq(4).val(val2)
$(".clearbox input").eq(5).val(val3)
}else {
$(".clearbox input").eq(6).val(val1)
$(".clearbox input").eq(7).val(val2)
$(".clearbox input").eq(8).val(val3)
}
$(".box input").eq(0).val("");
$(".box input").eq(1).val("");
$(".box input").eq(2).val("");
});
$("#clear").click(function(event) {
var length=$(".clearbox input").length;
$(".clearbox input").each(function(index, el) {
if($(el).val()!=""){
$(this).remove();
}
});
});
</script>
I. 求HTML網頁的按鈕代碼
<div style="width:301px;float:left;">
<div style="float:left; width:50px; height:23px; border:1px solid #CC3300; cursor:pointer;" onclick="changeDiv('1','2');">按鈕1</div>
<div style="float:left; margin-left:3px; width:50px; height:23px; border:1px solid #CC3300; cursor:pointer;" onclick="changeDiv('2','1');">按鈕2</div>
<div style="float:left; width:300px; border:1px solid #CC3300; height:100px; margin-top:5px;" id="div1">
按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1按鈕1內容
</div>
<div style="float:left; width:300px; border:1px solid #CC3300; height:100px; margin-top:5px; display:none;" id="div2">
按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2按鈕2內容
</div>
</div>
<script type="text/javascript">
function changeDiv(blockid,noneid){
document.getElementById("div"+blockid).style.display = "block";
document.getElementById("div"+noneid).style.display = "none";
}
</script>
J. 幫忙寫個HTML網頁按鈕代碼
<!DOCTYPEhtml>
<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
<title>首頁</title>
<styletype="text/css">
body{
background-color:#ccc;
margin:0;
padding:0;
text-align:center;
}
.option{
cursor:crosshair;
margin:10pxauto;
padding:10px;
background-color:#fff;
font-family:微軟雅黑;
font-size:36px;
width:330px;
}
a{
color:black;
text-decoration:none;
}
a:hover{
font-size:33px;
}
</style>
</head>
<body>
<divclass="option"style="margin-top:230px;"><ahref="./luntan/index.html">進
入校園BBS</a></div>
<divclass="option"><ahref="./bbs/index.html">進入興趣小組BBS</a></div>
</body>
</html>
我只學了css,不會把框架上下絕對居中.中間的並不是按鈕,而是一個超鏈接,背景圖你也沒給,我盡力了,謝謝