/    Sign up×
Community /Pin to ProfileBookmark

Javascript firefox vs explorer

I have simple code here that works in firefox and not in explorer!
Please help

Code:
var pack=f.paket.value;
var mod=f.modem.value;
if(pack==”Micro WIC”)
if(mod==”Iznajmiti”)
{
alert(“Nije moguća kombinacija Iznajmiti i Micro WIC”);
return False;
}

Branimir

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@Typhoon101Nov 14.2006 — My first thought is there are a couple of curly braces missing. Try this.

[code=html]var pack=f.paket.value;
var mod=f.modem.value;

if(pack=="Micro WIC"){
if(mod=="Iznajmiti"){
alert("Nije moguća kombinacija Iznajmiti i Micro WIC");
return False;
}
}[/code]
Copy linkTweet thisAlerts:
@branemxmauthorNov 14.2006 — it still doesnt work,

my guess is that i dont get the values out of paket and modem,

i write the with alert and no value shows up!

Could you try the same!

Is something wrong with my browser?

I am clueless
Copy linkTweet thisAlerts:
@Typhoon101Nov 14.2006 — could you post more of your code
Copy linkTweet thisAlerts:
@branemxmauthorNov 14.2006 — function validateForm()

{

// validacija polja na formi

// validacija polja na formi

var f=document.forms[0];

var pack=f.paket.value;

var mod=f.modem.value;

if (validateText(f.organizacija, 'Ime i prezime') == false)
return false;
if(validateCombobox(f.modem,"Opcija modema") == false)
return false;
if(validateCombobox(f.paket,"Paket") == false)
return false;
if(validateCombobox(f.placanje,"Način plaćanja") == false)
return false;
if(pack=="Micro WIC"){

if(mod=="Iznajmiti"){

alert("Nije moguća kombinacija Iznajmiti i Micro WIC");

return False;

}

}

if (validateText(f.jmbg, 'Matični broj') == false) {
return false;
} else {
// provjera dužine matičnog broja
var provjera;
provjera = f.jmbg.value.length
if (provjera != 13){
alert ("Neispravan matični broj");
f.jmbg.focus();
return false;
}

// provjera ispravnosti matičnog broja
var suma;
var znamenka;
var koef;
suma = 0;
koef = 7;
var i;
for (i = 0; i<= 11; i++) {
znamenka = parseInt (f.jmbg.value.substr(i,1));
suma += (znamenka*koef);
koef --;
if (koef == 1) {
koef =7;
}
}
var modulo;
var rezultat;
rezultat = 0;
modulo = suma % 11;
if (modulo == 0)
{
rezultat = 0;
}else {
if (modulo == 1)
{
alert ("JMBG je pogrešan");
return false;
}else{
rezultat = 11- modulo;
}
}
if (rezultat != parseInt (f.jmbg.value.substr(12,1)))
{
alert ("JMBG je pogrešan");
return false;
}

var danas = new Date;
var godina = danas.getFullYear()-18;
var mjesec = danas.getMonth()+1;
var dan = danas.getDate();
var kgodina = "1" + f.jmbg.value.substr(4,3);
var kmjesec = f.jmbg.value.substr(2,2);
var kdan = f.jmbg.value.substr(0,2);

//alert ( dan +"." +mjesec +"." + godina +" - " + kdan+"."+kmjesec +"." +kgodina);


if (parseInt(kgodina,10) > parseInt(godina,10))
{
alert ("Maloljetne osobe ne mogu se prijaviti")
return false;
}


if (parseInt(kgodina,10) < parseInt(godina,10))
{
//alert("kgodina: "+kgodina +" godina: "+godina )
} else {
if (parseInt(kgodina,10) == parseInt(godina,10))
{
if (parseInt(kmjesec,10) > parseInt(mjesec,10))
{
alert ("Maloljetne osobe ne mogu se prijaviti")
return false;
} else {if (parseInt(kmjesec,10) == parseInt(mjesec,10)){
if (parseInt(kdan,10) <= parseInt(dan,10)){
alert("kdan: "+kdan +" dan: "+dan )
}else{
alert ("Maloljetne osobe ne mogu se prijaviti")
return false;
}
}

}
}
}
}


if (validateText(f.adresa, 'Adresa') == false)
return false;

if (validateText(f.post_broj, 'Poštanski broj') == false)
return false;
if (validateText(f.mjesto, 'Mjesto') == false)
return false;



//if (validateText(f.telefon, 'Telefon') == false)
// return false;
//if (validateText(f.e_mail, 'e-mail') == false)
// return false;
// provjera dužine mati&#269;nog broja


return true;

}
Copy linkTweet thisAlerts:
@JimJNov 14.2006 — A cheeky suggestion:

If you really want help, try to make your code more understandable.

Your helper doesn't know your logic as well as you.

FIVE closing braces in succession!!

Try a bit of indenting.
×

Success!

Help @branemxm spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...