你好,我需要用java脚本做一个通知,我的网页会改变页面的语言来显示客户端语言的网页。
我使用以下代码:
if ($client_languaje == $system_actual_languaje) {
// Idioma Correcto
} else {
if ($client_languaje == "es") {
$red_idioma = "Spanish";
header('Location: index.php?&language=$red_idioma');
} else if ($client_languaje == "en") {
$red_idioma = "English";
header('Location: index.php?&language=$red_idioma');
} else {
$red_idioma = "English";
header('Location: index.php?&language=$red_idioma');
}
}
我需要通知客户,语言有变化,或者我不提供该语言的翻译。我更喜欢图形化的java脚本通知。我想使用这个:jsNotifications (http://code.google。com/p/jsnotifications)。
这是我想要显示的通知示例:http://www.lewebmonster.com/proyectos/classes-javascript/jsNotifications/demo/
如果需要,可以通过以下链接下载:http://www.lewebmonster.com/proyectos/classes-javascript/jsNotifications/lewebmonster-clase-javascript-jsnotifications.zip
我现在需要加载:这个java脚本在一个clic上运行:
$(function(){
//create a new instance of jsNotifications class and set up the general settings
var objInstanceName=new jsNotifications({
autoCloseTime : 10,
showAlerts: true,
title: 'Notificación de Lenguaje'
});
//check the browser support
if(objInstanceName.isAvailable()){
//show the bar to Chrome/Chromium users
if(objInstanceName.getStatus()==1) $('#divBottomBar').fadeIn(1200);
}
//error message
$('#btnError').on('click',function(){
objInstanceName.show('error','Todavía no contamos con la traducción de tu idioma, ponemos a tu disposición el traductor google para que te ayude a traducir nuestra web',false,
'Error en Lenguaje');
});
//ok message
$('#btnOK').on('click',function(){
objInstanceName.show('ok','Su idioma fue modificado automáticamente para que se sienta más cómodo, puede revertir esta función seleccionando el idioma manualmente del menú desplegable.');
});
//show html notification
$('#btnHTML').on('click',function(){
objInstanceName.showHTML('message.html',true);
});
});
我需要这样写:
If ($a == “a”) {
//show were the notification without need a click on a button
}
我认为我需要改变('click',函数…和从PHP调用,但我需要一些帮助,使这个函数。我将感激并感谢你的帮助。
认为,亚历克斯!
$ (' # body_id) .onload(函数(){//执行决定客户端语言的函数代码
})