js禁止右键 + 判断是ipad / iphone + 时间过期

<SCRIPT language="javascript">

    function catchRightClick(e){

    

        if(navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){

            alert("You are not allowed to right click");

            return false;

        } else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 3 || event.button == 2)){

            alert("You are not allowed to right click");

            return false;

        }

        return true;

    }

    

<%-- start 090923 --%>

function setElementDisplay(id, op){

 var obj=document.getElementById(id);

 obj.style.display = op;

}

 

function showElementByTime(id, time, display) {

 if (display == undefined) {

   display = 'block';

 }

 var s = "setElementDisplay('"+ id +"','"+ display +"')";

 setTimeout(s, time);

}

 

function hideElementByTime(id, time) {

 var s = "setElementDisplay('"+ id +"','none')";

 setTimeout(s, time);

}

 

function appendHTML(id, html) {

 document.getElementById(id).innerHTML += html;  

}

<%-- end 090923 --%> 

function checkIsIPad() {

   var ua = navigator.userAgent; 

   var isiPad = /iPad/i.test(ua) || /iPhone/i.test(ua);

   return isiPad;

}  

     

    //document.onmousedown=catchRightClick;

    //document.onmouseup=catchRightClick;

    if(document.layers)

    window.captureEvents(Event.MOUSEDOWN);

    if(document.layers)

    window.captureEvents(Event.MOUSEUP);

    

    //window.onmousedown=catchRightClick;

    //window.onmouseup=catchRightClick; 

</SCRIPT>

 

<script language="javascript">

    function pppsssKeepAlive() {

        messageBox('<%=mmmmm.hk.aaaa2.alogin.view.text.Text.get("timeout_msg")%>');

        var dummy = new Image();

        dummy.src = "<%=mmmmm.hk.aaaa2.alogin.view.text.Text.get("front_controller")%>?action=<%=AloginPageNames.ALOGIN_AW001_11_GO%>&time=" + new Date();

        setTimeout("keepAlive()", <%=aaaaResourceReader.in.getString("Logout.timeout")%>);

    }

 

    setTimeout("pppsssKeepAlive()", <%=aaaaResourceReader.in.getString("Logout.timeout")%>);

</script>

JS中setTimeout()的用法详解

http://www.jb51.net/article/35535.htm

Js的MessageBox

http://www.jb51.net/article/5057.htm

你可能感兴趣的:(iPhone)