[jQuery] Problem using toggle() function on IE8

2009-07-27 Thread Vincenzo Ferme

Hi, i’m Vincenzo, a web developer from Italy. I use your ajax code
following the guide ad the example: 
http://www.javascripttoolbox.com/jquery/?doctype=strict
. I have some question about my work with your code, if can answer me.

Here the question:

The problem is that my code do not run on explorer 8, when I click on
td where I apply the function, child td are not showed.

Here the code:

%
dim sqlcat, idcat, nome, pos, citta, indirizzo, telefono, cellulare,
sito, mail, persona, arrivare, descrizione, tipologia, mappa,
numcatpres

'- ELENCO RISORSE
-'
sub listRisorse()
%
br /
h1GESTIONE CATEGORIE/RISORSE/h1
div id=notice%= request(notice) %/div
p class=center
input type=button value=Inserisci Nuova Categoria
onclick=window.location.href='%= url %?action=newcat' /
%
  'Conto le categorie perchè il pulsante per aggiungere 
contenuti si
deve attivare solo in caso vi siano categorie
  sqlcat=SELECT COUNT(*) AS numcatpres FROM Categorie
  dbOpen(sqlcat)
  numcatpres=objRS(numcatpres)
  dbClose(true)
  if numcatpres0 then
%
nbsp;nbsp;
input type=button value=Inserisci Nuovo Contenuto
onclick=window.location.href='%= url %?action=new' /
% end if %
!--Precarico le immagini necessarie--
img src=../../images/frecciadown.png style=display:none;
visibility:hidden /
img src=../../images/frecciaup.png style=display:none;
visibility:hidden /
br /br /
/p
%

'Seleziono le eventuali categorie presenti
sqlcat=SELECT C.ID AS idcat, C.nome AS nome, C.pos AS pos FROM
Categorie C ORDER BY C.pos

dbOpen(sqlcat)

if not objRS.EOF then
%
 script
 $(function() {
$('td.title')
.click(function(){
$('tr').siblings('.child-'+this.id).toggle();

if 
($('div.visualizza'+this.id).css('background-image').search(/
frecciadown.png/)!=-1 ) {
$('div.visualizza'+this.id).css('background-image', url
(/images/frecciaup.png));

$('div.visualizza'+this.id).attr(title,Nascondi i contenuti);

$('tr[alt^=bottom'+this.id+']').toggle();
} else {
$('div.visualizza'+this.id).css('background-image', url
(/images/frecciadown.png));

$('div.visualizza'+this.id).attr(title,Mostra i contenuti);

$('tr[alt^=bottom'+this.id+']').toggle();
}

 });
$('div.[class^=visualizza]').css(cursor,pointer);
$('div.[class^=visualizza]').css(background-image, 
url(/images/
frecciadown.png));
$('div.[class^=visualizza]').attr(title,Mostra i 
contenuti);
$('tr[class^=child-]').hide().children('td');
$('tr[alt^=bottomriga]').hide();
% if request(cat)  then %
$('tr[class^=child-riga% =request(cat)%]').toggle();
$('tr[alt^=bottomriga% =request(cat)%]').toggle()
$('div.visualizzariga'+% 
=request(cat)%).attr(title,Nascondi
i contenuti);
$('div.visualizzariga'+% =request(cat)%).css('background-
image', url(/images/frecciaup.png));
% end if %
 });
 /script
%
dim counter, titlecat, classtag
counter=0
titlecat=0

DO WHILE NOT objRS.EOF

'Seleziono gli eventuali contenuti associati alla categoria
sql=SELECT nome FROM Risorse WHERE IDcat=  objRS(idcat)
dbOpen2(sql)
if not objRS2.EOF then
   classtag=title
else
   classtag=titleno
end if
titlecat=objRS(idcat)
%
table id=tabellaRisorse

tbody
   tr
   td colspan=4
   table width=100% style=height:21px;
   tr
   td class=%=classtag% id=riga% =titlecat %
style=width: 20px; height:21px;
   div style=float:left; width:20px; height: 21px; margin-
right: 5px; margin-top: 2px; class=visualizzariga% =titlecat
%nbsp;/div/td
   td
   div style=left: 50%; float: left; margin-top:2px;
   b id=% =objRS(idcat)% class=edit_area%= UCase
(objRS(nome)) %/b
   /div
   /td
   td width=155 style=text-align:left;padding-bottom:
2px;
   bPos:/b b id=% =objRS(idcat)%
class=edit_area_pos%= objRS(pos) %/b
   /td
   td width=30 style=text-

[jQuery] problem with toggle function

2008-06-24 Thread jaredh123


so I am very new to jQuery, so I apologize if this is a dumb question, but
I've coded up an element like this:

p class=comments-count id=comments-count-3 
onclick=javascript:jQuery('#comments-count-3').toggle(function(){jQuery('#comments-count-3').addClass('makered')},function(){jQuery('#comments-count-3').removeClass('makered')});
jQuery('#comments-body-3').slideToggle(400) style=cursor:pointer;5
comments/p

I know that's hard to read, I have to put the jQuery in the markup, because
the numbers in the ids are generated by PHP in a loop.

Anyway, the toggle function works (by adding a class called makered to the
id, in this case #comments-count-3) but it only works every OTHER click,
and only starts working after three clicks.  

(the second jQuery function, the slideToggle on the other element, works
perfectly)

If anyone could shed light on this, I would appreciate it.  
-- 
View this message in context: 
http://www.nabble.com/problem-with-toggle-function-tp18098246s27240p18098246.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Problem with toggle

2007-12-24 Thread JQueryProgrammer

I am facing an issue with the toogle API. I have a tr with dynamic
Id's as Id1, Id2 etc. Within that tr I have many td's in which one
td has an image which needs to be toggled to plus image and minus
image. That is when I click on the image, it should toggle between
plus and minus images. Also when the image is clicked another tr
should be displayed and hidden accordingly. That means a tr within a
tr and the outer tr has an image. I was trying to write the code as:

$([EMAIL PROTECTED]'myImgId']).toggle(
function() {
var $trId = #myTrId + $([EMAIL PROTECTED]'imgId']).index(this);
$($trId).css(display,);
$(this).attr(src,minus.jpg);
},
function() {
var $trId = #myTrId + $([EMAIL PROTECTED]'imgId']).index(this);
$($trId).css(display,none);
$(this).attr(src,plus.jpg);
}
);

But i am not getting the desired functionality of toggling. Please help