通知Java脚本(jsNotifications)更改运行无需点击PHP代码
Notification Java Script (jsNotifications) Change for run without click on a PHP code
你好,我需要用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(函数(){//执行决定客户端语言的函数代码
})
相关文章:
- 如何在php变量中嵌入JQuery代码
- php代码在textbox更改事件上显示null
- 在CodeIgniter视图中将Javascript或jQuery代码作为PHP文件编写可以吗
- 如何检查这个代码点火器php函数是否工作,该函数是否在ajax url中使用
- 使用PHP来阻止用户下载代码,但代码占用cpu
- 使用解析为javascript源的.php,如何使用条件语句将javascript代码封装在php括号之间
- 无法运行php代码,有角度路由问题
- php javascript代码从javascript调用php函数
- jquery中的PHP代码不起作用
- 如何在脚本部分使用php部分代码中的变量
- 获取PHP代码中日期选择器的值
- PHP代码古埃及乘法javascript
- 使用php或javascript根据某种url代码更改网页中的图片
- 代币违法;PHP内部JavaScript代码
- PHP代码中实现的JavaScript |if语句不起作用
- HTML 看不到 Javascript 代码;PHP 代码中的执行中断而没有错误
- 带有哈希密码的代码 PHP 无法工作
- 通过ajax或直接输出的行业标准代码PHP和JSON数据
- 检查MySQL数据库并添加代码PHP
- 将回显的HTML代码(PHP)追加到Javascript