新聞中心
用javascript編寫一個按鈕,點擊左鍵彈出你好,右鍵彈出右鍵禁用,2秒鐘之后關閉窗口
html
我們一直強調(diào)做網(wǎng)站、網(wǎng)站建設對于企業(yè)的重要性,如果您也覺得重要,那么就需要我們慎重對待,選擇一個安全靠譜的網(wǎng)站建設公司,企業(yè)網(wǎng)站我們建議是要么不做,要么就做好,讓網(wǎng)站能真正成為企業(yè)發(fā)展過程中的有力推手。專業(yè)網(wǎng)站制作公司不一定是大公司,創(chuàng)新互聯(lián)公司作為專業(yè)的網(wǎng)絡公司選擇我們就是放心。
head
script
function judgeMouseButton(e){
var e=window.event||e;//獲取事件對象
var value=e.button;
if(value==2||value==3){
alert('右鍵禁用');
setTimeout("closeThis();",2000);
}else{
alert('你好');
}
}
function closeThis(){
window.close();
}
/script
/head
body
input type='button' onmousedown="judgeMouseButton()"
/body
/html
javascript求救,在頁面是點左鍵彈出\"你好\",點右鍵彈出\"對不起\"
script
if (window.Event) document.captureEvents(Event.MOUSEUP); function nocontextmenu() {
event.cancelBubble = true
event.returnValue = false;
return false;
}
if (window.Event) document.captureEvents(Event.MOUSEUP);
function c() {
if (event.button == 1)
{
alert("你好");
return false;
}
else
{
alert("對不起");
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.onmousedown = c;
document.oncontextmenu = nocontextmenu;
/script
JavaScript當輸入框為空時彈出“請輸入內(nèi)容”,當不為空時彈出欄內(nèi)容+“你好”!該如何寫?
function chk_test(str){
if (str==""){
alert("請輸入內(nèi)容")
}else{
alert(str+"你好!")
}
}
上面的是一個JS的自定函數(shù),你把它放到JS的標記中
下面是你需要修改的表單中參數(shù)
input id="login_1" type="text" name="login_1"input type="button" value="確定" onclick="chk_test(document.getElementById('login_1').value)"
網(wǎng)頁題目:你好javascript,你好李煥英電影免費版高清在線觀看
轉載注明:http://www.ef60e0e.cn/article/dsdhopj.html