[jQuery] fadeTo() possible speeds

2009-09-30 Thread kali


here, http://docs.jquery.com/Effects/fadeTo

why are all possible params not listed??

(for example for fadeIn(), fadeOut(), fadeTo()  it just says speed,
but why doesn't it list all possible speeds (slow.. is there a
fast???)

this site is a bit weird, if I go to http://docs.jquery.com/Main_Page
and search for fadeTo it says there is no such page, but if I search
for jQuery fadeTo in google then it directs me to 
http://docs.jquery.com/Effects/fadeTo

please, what are all possible values under speed for the fadeIn/Out/
To methods???

thank you...



[jQuery] Re: event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-30 Thread kali

actually got solution in another forum (http://www.manning-sandbox.com/
thread.jspa?threadID=34108tstart=0)

works like a charm!!  :)  namely:

$('#image' + i).bind('mouseover', i, function(event) {
 $('#image' + event.data).addClass('dim');
});


as to other problem (var elem1 = 'foo'; )

tried various things, like

var thumbnails = [4];  //  this is supposed to create an array of
four elements;
 //   thought I'd create an empty array of four elements, then put
the elements inside it, but didn't work either..

 for (i = 1; i  thumbnails.length; i++) {
thumbnails.push($('a id=link' + i + 'img id=thumb' + i + 
' /
/a'));
//  thumbnails[i] = $('a id=link' + i + 'img id=thumb' + i + 
' /
/a');

but it turns out this was not source of the problem..

it's weird, actually that it works in HTML (client-side) with just
'elem' in that declaration;)

full working example here:
http://www.mayacove.com/dev/jquery/events/test_event_dyn.html

thank you very much...


On Aug 30, 4:02 am, Josh Powell seas...@gmail.com wrote:
   for (i = 1; i  5; i++) {
     $('#thumb' + i).bind('mouseover',function(event) {
        $(this).addClass('dim');
     });
   }

 The 'i' you've called here is a global variable, in a for loop always
 put a var in front of it to have local scope (to the function, not
 block)

   for (var i = 1; i  5; i++) {
     $('#thumb' + i).bind('mouseover',function(event) {
        $(this).addClass('dim');
     });
   }

 but... more importantly, reframe your thoughts on javascript/jquery
 programming to let the selectors do the iteration for you.

 $('img[class=thumb]).mouseover(function () {
      $(this).addClass('dim');

 });

 To your second question:

 var elem%=i% = 'foo';

 works becausejspis compiled server side and outputs the value of i
 onto the page, so that if i is 1, then what the browser sees is

 var elem1 = 'foo';

 which is valid javascript.  But javascript is all done client side so

 var elem + i = 'foo';

 is not valid.  There are several ways to do what you want, none of
 them good.  Use implicit iteration from the jquery selectors instead.
 Stop using id's when you have an unknown or changing number of items
 you are iterating through to do things.  IDs should only be used for
 unique items.  When you have a list of similiar items doing the same
 thing, give them all the same class or custom attribute and let jQuery
 do the iterating for you.

 Josh Powell

 On Aug 30, 12:37 am, Michael Geary m...@mg.to wrote:

  Something I forgot to mention in my previous reply... To make sure it's
  clear what code is actually being run in the browser, never rely on looking
  at yourJSPsource to understand it. That's what threw you off here. The
  browser never sees yourJSPsource, only the HTML/JS/CSS/whatever files that
  yourJSPgenerates.

  Do you have Fiddler? If not, go get it right now and get familiar with it:

 http://www.fiddler2.com/

  It looks like you're using Windows 2000; Fiddler is supposed to run OK there
  if you have the .NET Framework 2.0.

  Fiddler's inspectors are great for examining all of the actual data
  downloaded to your browser. You can of course use other tools such as the
  Web Developer Toolbar and even a View Source for the .html file. But Fiddler
  is terrific.

  The main thing is that when you're debugging anything in the browser, you
  have to forget about theJSPsource and think only in terms of what the
  browser actually receives.

  -Mike

   From: kali

   this works inJSP:

   %  for (int i = 1; i  5; i++) { %
     $('#image%=i%').bind('mouseover',function(event) {
           $('#image%=i%').addClass('dim');
       });
   % } %

   but the same thing, in JavaScript, doesn't work:

   for (i = 1; i  5; i++) {
     $('#thumb' + i).bind('mouseover',function(event) {
        $('#thumb' + i).addClass('dim');
     });
   }


[jQuery] Re: event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-29 Thread kali

yes I know they are two different things, I do know both JSP and
JavaScript, so I do know the difference; I would like to know why what
works in JSP doesn't work in JavaScript..  again:

this works in JSP:

%  for (int i = 1; i  5; i++) { %
  $('#image%=i%').bind('mouseover',function(event) {
$('#image%=i%').addClass('dim');
});
% } %

but the same thing, in JavaScript, doesn't work:

for (i = 1; i  5; i++) {
  $('#thumb' + i).bind('mouseover',function(event) {
 $('#thumb' + i).addClass('dim');
  });
}

in JavaScript this code is applied ONLY when i=5,  in JSP it applies
to all four elements processed in the array and works as expected

ok, to make it easier, forget the comparison to JSP...   why does
above JavaScript code not work?? I create four elements dynamically,
but event-binding does not work for any of the four elements...

thank you...



On Aug 28, 6:56 pm, James james.gp@gmail.com wrote:
 I have difficulties understanding what you're trying to achieve.
 As someone mentioned, Java is to Javascript as Ham is to Hamster.
 They're two different beasts.

 For the 'elem+1' situation, you can do:
     this['elem'+1] = '...';
 to dynamically create variables. But usually you don't have to resort
 to doing something like that if you code things properly.

 On Aug 28, 12:44 pm, kali maya778...@yahoo.com wrote:

  hi,

  I have a problem with binding events to dynamically-generated
  elements; specif. problem is something I'm trying to do with
  JavaScript doesn't work but it works if I do it inJSP:   (and can we
  PLEASE get ability to display CODE in this forum in NON-PROPORTIONAL
  FONT???)

 JSP, event-binding works:
  

          %  for (int i = 1; i  5; i++) { %
                  var elem%=i% = $('a id=link%=i%img id=image%=i
  % //a');

                  $('#image%=i%').bind('mouseover',function(event) {
                                  $('#image%=i%').addClass('dim');
                  });
          }

  JavaScript, event-binding does not work:
  ---

  for (i = 1; i  5; i++) {

    var elem = $('a id=link%=i%img id=image%=i% /

  /a');

    $('#thumb' + i).bind('mouseover',function(event) {
       $('#thumb' + i).addClass('dim');
    });

  }

  (also: this declaration doesn't work in JS:

  var elem+i = $('a id=link%=i%img id=image%=i% //a');

      ^^

  'elem+i' returns a syntax error; why does this declaration 'var elem
  %=i%' work inJSPbut equivalent does not in JS?

  urls (JSPand JS) are here:

 http://www.mayacove.com/dev/jquery/events/test_event_dyn.htmlhttp://w...

  thank you very much..


[jQuery] event-binding to dynamically created elements... (JSP vs JS problem......)

2009-08-28 Thread kali



hi,

I have a problem with binding events to dynamically-generated
elements; specif. problem is something I'm trying to do with
JavaScript doesn't work but it works if I do it in JSP:   (and can we
PLEASE get ability to display CODE in this forum in NON-PROPORTIONAL
FONT???)



JSP, event-binding works:


%  for (int i = 1; i  5; i++) { %
var elem%=i% = $('lt;a id=link%=i%gt;lt;img 
id=image%=i
% /gt;lt;/agt;');

$('#image%=i%').bind('mouseover',function(event) {
$('#image%=i%').addClass('dim');
});
}



JavaScript, event-binding does not work:
---

for (i = 1; i  5; i++) {

  var elem = $('lt;a id=link%=i%gt;lt;img id=image%=i% /
gt;lt;/agt;');

  $('#thumb' + i).bind('mouseover',function(event) {
 $('#thumb' + i).addClass('dim');
  });
}

(also: this declaration doesn't work in JS:

var elem+i = $('lt;a id=link%=i%gt;lt;img id=image%=i% /
gt;lt;/agt;');
^^

'elem+i' returns a syntax error; why does this declaration 'var elem
%=i%' work in JSP but equivalent does not in JS?



urls (JSP and JS) are here:

http://www.mayacove.com/dev/jquery/events/test_event_dyn.html
http://www.mayacove.com/dev/jquery/events/test_event_dyn.jsp

thank you very much..


[jQuery] Re: problem with wrapper arrays.......

2009-05-17 Thread kali



On May 6, 12:18 am, Karl Swedberg k...@englishrules.com wrote:
 On May 6, 2009, at 12:05 AM, kali wrote:

  On May 5, 10:05 pm, mkmanning michaell...@gmail.com wrote:
  Accessing the elements by index returns the element itself. To call
  jQuery methods you'd need to do this:
  divs = $('div');
  div2 = divs[2];

  THIS is what I did

  div2 = divs[2]  -- is IGNORED

 It's NOT ignored. It returns a DOM node ( div id=test3 )

 Please re-read what mkmanning wrote, because he's absolutely correct.



  pls runhttp://www.mayacove.com/dev/jquery/arrays.htmlon Firefox with
  JS console open, you will see it says:
  div2.addClass' is not a function... this is b/c the line div2 = divs
  [2]  is IGNORED...

 No again. It's because you can't attach a jQuery method to a DOM node.

so this   divs = $('div');   is a query object but not this:

   div2 = divs[2];

i.e., var 'divs' is a query object (an array, supposedly, which all
jQuery wrappers return, right?)

but AN ELEMENT in that array (a jQuery object) is not a jQuery
object?

sorry, this IS a bit confusing



[jQuery] Re: problem with wrapper arrays.......

2009-05-17 Thread kali



On May 17, 7:14 am, kali maya778...@yahoo.com wrote:
 On May 6, 12:18 am, Karl Swedberg k...@englishrules.com wrote:



  On May 6, 2009, at 12:05 AM,kaliwrote:

   On May 5, 10:05 pm, mkmanning michaell...@gmail.com wrote:
   Accessing the elements by index returns the element itself. To call
   jQuery methods you'd need to do this:
   divs = $('div');
   div2 = divs[2];

   THIS is what I did

   div2 = divs[2]  -- is IGNORED

  It's NOT ignored. It returns a DOM node ( div id=test3 )
  Please re-read what mkmanning wrote, because he's absolutely correct.

   pls runhttp://www.mayacove.com/dev/jquery/arrays.htmlonFirefox with
   JS console open, you will see it says:
   div2.addClass' is not a function... this is b/c the line div2 = divs
   [2]  is IGNORED...

  No again. It's because you can't attach a jQuery method to a DOM node.

 so this   divs = $('div');   is a query object but not this:

div2 = divs[2];

 i.e., var 'divs' is a query object (an array, supposedly, which all
 jQuery wrappers return, right?)

 but AN ELEMENT in that array (a jQuery object) is not a jQuery
 object?

 sorry, this IS a bit confusing


actually, if you look here,
http://www.manning-sandbox.com/thread.jspa?threadID=32220tstart=0

it looks like here the reference to an array element is NECESSARY for
statement to work..  this is because the stmt is plain JavaScript and
not jQuery, right???

and I thought it was so cool you could combine 'plain' JS with jQuery,
but now I see it's a bit tricky...

so, again: a wrapped set is a jQuery object, but an ELEMENT in the
array returned by the wrapper is a plain JS object??

oh brother  thank you







[jQuery] Re: problem with wrapper arrays.......

2009-05-17 Thread kali



On May 17, 7:14 am, kali maya778...@yahoo.com wrote:
 On May 6, 12:18 am, Karl Swedberg k...@englishrules.com wrote:



  On May 6, 2009, at 12:05 AM,kaliwrote:

   On May 5, 10:05 pm, mkmanning michaell...@gmail.com wrote:
   Accessing the elements by index returns the element itself. To call
   jQuery methods you'd need to do this:
   divs = $('div');
   div2 = divs[2];

   THIS is what I did

   div2 = divs[2]  -- is IGNORED

  It's NOT ignored. It returns a DOM node ( div id=test3 )
  Please re-read what mkmanning wrote, because he's absolutely correct.

   pls runhttp://www.mayacove.com/dev/jquery/arrays.htmlonFirefox with
   JS console open, you will see it says:
   div2.addClass' is not a function... this is b/c the line div2 = divs
   [2]  is IGNORED...

  No again. It's because you can't attach a jQuery method to a DOM node.

 so this   divs = $('div');   is a query object but not this:

div2 = divs[2];

 i.e., var 'divs' is a query object (an array, supposedly, which all
 jQuery wrappers return, right?)

 but AN ELEMENT in that array (a jQuery object) is not a jQuery
 object?

 sorry, this IS a bit confusing


actually, if you look here,
http://www.manning-sandbox.com/thread.jspa?threadID=32220tstart=0

it looks like here the reference to an array element is NECESSARY for
statement to work..  this is because the stmt is plain JavaScript and
not jQuery, right???

and I thought it was so cool you could combine 'plain' JS with jQuery,
but now I see it's a bit tricky...

so, again: a wrapped set is a jQuery object, but an ELEMENT in the
array returned by the wrapper is a plain JS object??

oh brother  thank you







[jQuery] jQuery problem with setTimeout()

2009-05-09 Thread kali


var showDiv= $('#myDiv').html(message);
setTimeout(showDiv,5000);

get error: missing ] after element list

I googled this error, it seems the problem is the jQuery code..
although not sure..

would appreciate some suggestions...

thank you..



[jQuery] Re: jQuery problem with setTimeout()

2009-05-09 Thread kali

I solved this, BUT:

another weird problem:

var message is passed to the function, so I have:

function successHome(message) {
setTimeout('$(#mailSuccess).html(message) 1000);

but it says 'message' is not defined

only this works:

function successHome(message) {
setTimeout('$(#mailSuccess).html(Your email has been sent.pThank
you./p);', 1000);

 this is so bizarre

if I do:

function successHome(message) {
alert(message);//  no probl here
//  but here:
setTimeout('$(#mailSuccess).html(message);', 1000);
 //   it says 'message is not defined'


???

thank you



[jQuery] FRAMES

2009-05-06 Thread kali

hi,

I need to refer to a frame,  in plain JavaScript it is:

 parent.frames.main.emplmain.document.getElementById
('mail').style.display='block';

how would I do this in jQuery (so I can do neat things like fadeIn(),
etc...;)

thank you..




[jQuery] problem with wrapper arrays.......

2009-05-05 Thread kali

my understanding (acc. to book jQuey in Action and other sources,
like http://jquery.open2space.com/node/10) is that the standard jQuery
wrapper always returns an array containing all matching elements..
however, for some very odd reason I can't get an element by referring
to its index in the array...

for example:

divs = $('div');
div2 = divs[2];  // this line is ignored (or SOMETHING
weird is happening here..)
//  div2.addClass('red');   // so get error here that 'div2.addClass'
is not a function..

have a page with above code (and other code) here,
http://www.mayacove.com/dev/jquery/arrays.html

am stumped here, have been dealing with this for days..  don't get
what's happening here (using jQuery version 1.2.1 (maybe this only
works in 1.3?))

now this is actually not a huge deal b/c in troubleshooting this have
found other methods (like filter :eq and other methods.. but still, I
think it's strange that I can't make it work with array index..)

thank you...





[jQuery] test - sorry, ignore -- why can't I see my posts....

2009-04-20 Thread kali

I can't see any posts I post to this group, why is this, WHY is it at
all that you only read this forum if you're logged on to google??
most forums online you just need to register with the forum.. WHY
bring google in

either way, even after logging on to my google acct I can't see my
posts (they get emailed to me if I check send me a copy, but I don't
see the posts here http://groups.google.com/group/jquery-en/topics?gvc=2

thank you...


[jQuery] Re: passing elem id to a JS function...

2009-04-20 Thread kali

thank you very much!!

(why can't I see my posts here? 
http://groups.google.com/group/jquery-en/topics?gvc=2
(I can only see my posts if I search for my uid (kali)

ok, thank you very much.. sorry for two test-posts I have posted..



On Apr 15, 2:47 pm, mkmanning michaell...@gmail.com wrote:
  var img_top  = $(#+curr_img);

 On Apr 15, 8:57 am,kalimaya778...@yahoo.com wrote:

  hi, am trying to do image-hide/img-show with jQuery (now use 'regular'
  JavaScript DOM-scripting..  want to switch to jQuery..  but am having
  some difficulties:

  I have this function-call in interface:

    get_img('photo1','nav1','navAll1','photo2','nav2','navAll2')

  in function -- old way:

  function get_img
  (curr_img,curr_nav,curr_navAll,new_img,new_nav,new_navAll)  {
          var img_top    = document.getElementById(curr_img);
          var img_new    = document.getElementById(new_img);    //  etc..

  how do I do this in jQuery?  I tried:

          var img_top    = $(#curr_img);
          var img_top    = $(curr_img);

  neither one of these is working..  and worst problem is I don't get
  errors in Firefox Error Console (jQuery syntax errors don't show in FF
  Error Console...  is there a place where you can check your jQuery
  syntax??)

  the element id's are passed to the function as string values..  so how
  do I add this string value to a wrapper like this

      $('# id passed to function')

  thank you...

  thank you very much...


[jQuery] passing elem id to a JS function...

2009-04-15 Thread kali

hi, am trying to do image-hide/img-show with jQuery (now use 'regular'
JavaScript DOM-scripting..  want to switch to jQuery..  but am having
some difficulties:

I have this function-call in interface:

  get_img('photo1','nav1','navAll1','photo2','nav2','navAll2')

in function -- old way:

function get_img
(curr_img,curr_nav,curr_navAll,new_img,new_nav,new_navAll)  {
var img_top= document.getElementById(curr_img);
var img_new= document.getElementById(new_img);//  etc..

how do I do this in jQuery?  I tried:

var img_top= $(#curr_img);
var img_top= $(curr_img);

neither one of these is working..  and worst problem is I don't get
errors in Firefox Error Console (jQuery syntax errors don't show in FF
Error Console...  is there a place where you can check your jQuery
syntax??)

the element id's are passed to the function as string values..  so how
do I add this string value to a wrapper like this

$('# id passed to function')

thank you...




thank you very much...