Need js within js popup?

need js within js popup? it’s a copyright message when someone right clicks. I simple need someway to automatically update the current year within this message. I remember messing with this before and I believe there were some limitations to embedding js within the popup. Is there anyway to do this? Thanks!

here is my code…


var message="Message... Copyright \\251 2002 - 2010. ";
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");

Cool thanks Paul! I will try this soon…

You can use the following code to retrieve the current year.


new Date().getFullYear()

You would just need to concatenate that in place of the existing year.


var message="...2002 - " + new Date().getFullYear() + ". ";

Cool - that worked perfect! :slight_smile: