views:

35

answers:

4

I have issues with FF & Jquery .show().

my website shows an embedded map from google in clicking a link.i have got a javascript function that handle this, in safari it works great.FF won't show the map.

this is the js. function:

  function mostraPagina(nome){



  if (nome='mappa'){
   $('#mappa').load('contenuti/mappe/mappa_thiene.html');
   $('#dark_background').show(600);
   $('#mappa').show(600);
  }

 }

the embedded code from google maps is:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;amp;source=s_q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;q=Via+Murialdo,+4,+Thiene+italy&amp;amp;sll=45.710686,11.475665&amp;amp;sspn=0.002439,0.005676&amp;amp;ie=UTF8&amp;amp;hq=&amp;amp;hnear=Via+Murialdo,+4,+36016+Thiene+Vicenza,+Veneto,+Italy&amp;amp;ll=45.710222,11.475618&amp;amp;spn=0.001219,0.002838&amp;amp;t=h&amp;amp;z=14&amp;amp;output=embed"&gt;&lt;/iframe&gt;

thank you very much.

+1  A: 

One possible problem:

if (nome='mappa'){

You're assigning the value of nome to 'mappa' which evaluates to true always (because of the way non-empty strings typecast to true). Your code should probably be

if (nome=='mappa'){
Delan Azabani
+1  A: 

are you sure this

if (nome='mappa'){

is what you want? that would just be like if(true)

should be:

if (nome == 'mappa'){

which does the comparison you are looking for I guess

but ACTUALLY it should be:

if (nome === 'mappa'){

which not only comparse the value, but also the type. Well why not do a regexp test?

if (/^mappa$/.test(nome)){

:)

Kind Regards

--Andy

jAndy
A: 

bah, i knew thay problem from PHP.it was my fault. i know operator '=' is for assigning values to vars. operator '==' to compare values.

but what operator '===' is meant for?

thank you for helping.

palominoz
answered below.
jAndy
`==` is equality with type coercion, whereas `===` is strict equality. I.e if you use `==` Javascript will convert both values to the same type before checking for equality, whereas `===` wont. `1=='1'` is `true`, however `1==='1'` is `false`.
Matt
A: 

thank you andy.stackoverflow is great.i'll try to help out too.

palominoz
one great thing on stackoverflow is, you can do comments on postings so you don't need to write another answer.
jAndy
of course, let me get used with the interface :)
Andrea Zironda