0
我是編程新手,我有一個關於如何將一些東西放在一起的問題。在javascript的右鍵點擊開始倒數計時器
我這裏的代碼,在JavaScript呈現簡單的倒數計時器
var Timer;
var TotalSec;
function CreateTimer(Timer ID, Time){
Timer = document.getElementByID(Timer ID);
TotalSec = Time;
UpdateTimer() window.setTimeout("Tick()", 1000);
}
function Tick() {
if (TotalSeconds <= 0) {
alert(message)
return;
}
TotalSeconds -= 1;
UpdateTimer() window.setTimeout("Tick()", 1000);
}
function UpdateTimer() {
Timer.innerHTML = TotalSeconds;
}
我也有這顯示了當右擊被激活
var message="Right click? You are using it wrong! Thank you for your understanding.";
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
好了,現在味精代碼,什麼我想要做的是,當有人右鍵點擊網站時,它會觸發我的5秒定時器並顯示消息:「你的bla bla bla bla將以+(多少秒)結束」,並且當計數器達到0時,設置味精:「我只是在開玩笑的咩咩...」
有人能幫助我嗎?基本上,我擁有一切,只是不需要`t know how to connect all things. I
m爲博客blogger.com上的一個博客創建一些東西,並希望看到它的工作:)