Hi
I try to make a javascript that checks what language the user is using. But the if sentence is not running properly, it just goes down to the bottom and continiue running and not giving me correct return.
I try to make a javascript that checks what language the user is using. But the if sentence is not running properly, it just goes down to the bottom and continiue running and not giving me correct return.
Code:
function isSecurity(chkFlag){
if (chkFlag == "true") return true;
if (chkFlag == "false") return false;
return false;
}
function changeH1Class(){
document.getElementById("blockMessage").className = "security";
}
var l_lang;
if (navigator.userLanguage) // Explorer
l_lang = navigator.userLanguage;
else if (navigator.language) // FF
l_lang = navigator.language;
else
l_lang = 'test';
function writeHeaderTest(){
if(isSecurity(securityFlag)){
document.write(l_lang);
changeH1Class();
}
else{
document.write(l_lang);
}
}
if(l_lang == en)
{
function writeHeader(){
if(isSecurity(securityFlag)){
document.write("English123");
changeH1Class();
}
else{
document.write("English456");
}
}
function writeReason(){
if(isSecurity(securityFlag)){
document.write("Sites in this category may pose a security threat to network resources or private information, and are blocked by your organization.");
}
}
function writeWarning(){
if(isSecurity(securityFlag)){
document.write('<span class="warning">Not Recommended</span>');
}
}
function writeWarning1(){
if(isSecurity(securityFlag)){
document.write('This action is not recommended.')
}
}
}
else if(l_lang == no)
{
function writeHeader(){
if(isSecurity(securityFlag)){
document.write("Test123");
changeH1Class();
}
else{
document.write("Test456");
}
}
function writeReason(){
if(isSecurity(securityFlag)){
document.write("Sites in this category may pose a security threat to network resources or private information, and are blocked by your organization.");
}
}
function writeWarning(){
if(isSecurity(securityFlag)){
document.write('<span class="warning">Not Recommended</span>');
}
}
function writeWarning1(){
if(isSecurity(securityFlag)){
document.write('This action is not recommended.')
}
}
}
else{
function changeH1Class(){
document.getElementById("blockMessage").className = "security";
}
function writeHeader(){
if(isSecurity(securityFlag)){
document.write("Norsk 123");
changeH1Class();
}
else{
document.write("Norsk 456");
}
}
function writeReason(){
if(isSecurity(securityFlag)){
document.write("Los sitios de esta categoría pueden representar una amenaza a la seguridad de los recursos de la red o a información privada y, por lo tanto, su organización los bloquea.");
}
}
function writeWarning(){
if(isSecurity(securityFlag)){
document.write('<span class="warning">No recomendado</span>');
}
}
function writeWarning1(){
if(isSecurity(securityFlag)){
document.write('Esta acción no se recomienda.')
}
}
}