[jQuery] Re: Accessing a JSON property from an unknown variable?

2009-02-14 Thread seasoup

It's not really an associative array.  It is the property of an
object, there are two notations for getting at an objects properties:

foo.bar

and

foo['bar']

though you could even:

eval('foo.' + fooProp);

foo.bar is the preferred method, but if the property name has a space
in it or needs to be evaluated the second method is used.  It looks
like an associative array but it will not have any of the array
methods, nor a .length.  This gets really tricky when foo is an array:

var foo = [];
foo['bar'] = 'value';

has the array methods, but has a length of 0.  but if you

foo[1234] = 'value';

then you have an array of length 1235 and the first 1234 value are
undefined.

Josh Powell


On Feb 13, 4:36 pm, Nic Luciano adaptive...@gmail.com wrote:
 Oh wow, I didn't realize JSON would act like an associative array in that
 way...

 Thanks guys!

 On Fri, Feb 13, 2009 at 7:10 PM, Josh Nathanson 
 joshnathan...@gmail.comwrote:



  foo[fooProp] // returns barVal

  Is that what you mean?

  -- Josh

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
  Behalf Of Nic
  Sent: Friday, February 13, 2009 4:06 PM
  To: jQuery (English)
  Subject: [jQuery] Accessing a JSON property from an unknown variable?

  For instance,

  var foo = {
  bar: barVal,
  baz: bazVal
  }

  var fooProp = bar;

  How can I access barVal through fooProp?

  I know this isn't exactly jQuery group discussion but I figured since
  it was part of a jQuery system I could get away with it. Thanks!


[jQuery] transform div into a textfield to change its value nicely

2009-02-14 Thread Chris

Hi guys,

I was wondering how this is usually done if I have a div container and
want to change its value (e.g. a name of a person) just by pressing
the left mouse button for a short moment so that it'll transform
itself into a textfield and well... back when I'm done editing.

Whats the usual design pattern for this?

Thanks,
Chris


[jQuery] Re: dynamically inserted droppable

2009-02-14 Thread Chris

Thanks, it works.

However, it there any way I can design this more nicely so there won't
be unnecessary code repetitions? It just feels a little odd to pass
over all the options again.

On Feb 9, 1:41 am, Richard D. Worth rdwo...@gmail.com wrote:
 After you add the element to the page, just call .droppable() on it.

 $('div class=usergroupnew user
 group/div').appendTo('#container_usergroups').css('display',
 'none').fadeIn('slow').droppable(options);

 - Richard

 On Sat, Feb 7, 2009 at 12:20 PM, Chris ch0...@googlemail.com wrote:

  Hi,

  I am relatively new to developing applications with both javascript
  and the jquery framework. What I can't figure out is what to do if I
  dynamically insert something on my page (imagine I click on a button
  to create a new div-container) and that div should then automatically
  become a droppable or something.

  Right now, I have the following code loaded on the top of my site.
  This is not working when I dynamically load the div but of course is
  when I manually add that markup to the page.

  $('.usergroup').droppable({
 accept: function(draggable) {
 // imagine certain logic that will return true
 },
 drop: function(event, ui) {
 // do something...
 }
  });

  $('#newgroup').live('click', function() {
 $('div class=usergroupnew user group/div').appendTo
  ('#container_usergroups').css('display', 'none').fadeIn('slow');
  });

  How can I make that div actually be droppable / whatever I want it to
  be?

  Thanks,
  Christian


[jQuery] wait end of slideUp()

2009-02-14 Thread Alain Roger
Hi,

i have 2 divs (one on the top and one below).
when user click on top div, the bottom div is SlidingUp slowy and the top
div class should change.
this works well, but to make it perfect i would like to be sure that my
bottom div is completly slided Up before to change class of my top div.

how can i do that ?
thx

-- 
Alain
---
Windows XP x64 SP2 / Fedora 10 KDE 4.2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008


[jQuery] Re: Problem reading rss link tag

2009-02-14 Thread Karl Rudd

link tags only have attributes, they don't contain anything.

Karl Rudd

On Sat, Feb 14, 2009 at 11:31 AM, Karthik
karthick.vijayara...@gmail.com wrote:

 Hi,
  I am trying to parse a rss feed. My code seems to be able to extract
 the value for any tag in the feed except the link tag. I am using
 Firefox 3.0.6.

 $.get(pressRelease1.xml,{},function(d){
$(d).find('item').each(function() {
var $item = $(this);

var title = $item.find('title').text(); //this works
var description = $item.find('description').text(); //this 
 works too
var link = $item.find('link').text(); //this doesnt work
});
 });

 When i turned on Venkman's javascript debugger, the innerHtml had
 something like this:
  linkBla Bla Bla\n .
 It seems to be missing the the end tag for link. I cant seem to
 understand this behavior. I googled a lot but i couldnt find posts
 related to this problem. I am very sure that there is nothing wrong in
 my feed. If you have come across something like this, can you please
 help? Thank you.

 Thanks
 Karthik



[jQuery] Re: wait end of slideUp()

2009-02-14 Thread FCY-Pierre


Hi,

The slideUp effect has a callback function.
It was called when the animation is complete.

So, this code should works

$('#myDiv').slideUp('slow',function(){$('myTopDiv').addClass('myclass');});

pierre

Alain Roger a écrit :

Hi,

i have 2 divs (one on the top and one below).
when user click on top div, the bottom div is SlidingUp slowy and the 
top div class should change.
this works well, but to make it perfect i would like to be sure that 
my bottom div is completly slided Up before to change class of my top div.


how can i do that ?
thx

--
Alain
---
Windows XP x64 SP2 / Fedora 10 KDE 4.2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008





[jQuery] Re: wait end of slideUp()

2009-02-14 Thread Alain Roger
Thanks a lot Pierre.


On Sat, Feb 14, 2009 at 11:28 AM, FCY-Pierre fcy...@gmail.com wrote:


 Hi,

 The slideUp effect has a callback function.
 It was called when the animation is complete.

 So, this code should works

 $('#myDiv').slideUp('slow',function(){$('myTopDiv').addClass('myclass');});

 pierre

 Alain Roger a écrit :

  Hi,

 i have 2 divs (one on the top and one below).
 when user click on top div, the bottom div is SlidingUp slowy and the top
 div class should change.
 this works well, but to make it perfect i would like to be sure that my
 bottom div is completly slided Up before to change class of my top div.

 how can i do that ?
 thx

 --
 Alain
 ---
 Windows XP x64 SP2 / Fedora 10 KDE 4.2
 PostgreSQL 8.3.5 / MS SQL server 2005
 Apache 2.2.10
 PHP 5.2.6
 C# 2005-2008






-- 
Alain
---
Windows XP x64 SP2 / Fedora 10 KDE 4.2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008


[jQuery] Re: Would some please tell me what's wrong with this syntax?

2009-02-14 Thread Rick Faircloth

Hi, Michael...and thanks for the reply.

Yes, with everything but the first line stripped out, it still
throws the error.  However, I can't see anything wrong and no
matter what changes I make to the first line, I still get an error.

Is there a problem with using dot notation in the variables?

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of Michael Geary
 Sent: Saturday, February 14, 2009 12:12 AM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: Would some please tell me what's wrong with this syntax?
 
 
 Rick, the first thing to do is to take out code and see if the problem goes
 away.
 
 What happens if you take out the entire body of the function?
 
  function getNewSchedule(response.MONTH, response.YEAR) { }
 
 The error is still there, isn't it? Good, that narrows it down a lot.
 
 What does a function definition usually look like? Maybe something like
 this:
 
 function foo( bar, car ) { }
 
 Now do you see what the problem is?
 
 -Mike
 
  From: Rick Faircloth
 
  Good call, James...couldn't see that one...I've been starting
  at it too long!
 
  How about another one?
 
  Here's the error message:
 
  missing ) after formal parameters
  function getNewSchedule(response.MONTH, response.YEAR) {\n
 
  And here's the code...ideas?  Thanks!
 
  script
 
   function getNewSchedule(response.MONTH, response.YEAR) {
 
var formval  =  { dsn:
  'cfoutput#application.dsn#/cfoutput',
  month: response.MONTH,
  day:   '01',
  year:  response.YEAR };
 
  console.log(formval);
 
$.ajax ({ cache: false,
  type:  post,
  url:
  ../components/floor_duty.cfc?method=get_new_schedulereturnFo
  rmat=json,
  dataType:  json,
  data:  formval,
  success:   function(response) {
 
  if
  (response.MESSAGE == 'Success')
  {
  $('#li-none:visible').hide();
 
  $('#schedule-month-year').empty().append('Below is the
  schedule for' + response.MONTH +' '+ response.YEAR);
 
  $('#schedule-instructions').fadeIn(500);
 
  $('#scheduleBody').fadeIn(500);
 
 
  populateDutyTable(response); }
 
else
  {
  $('#li-below:visible').hide();
 
  $('#none-date').empty().append(response.MONTH +'
  '+ response.YEAR);
 
  $('#li-none').fadeIn(500);
 
  $('#scheduleBody').fadeOut(250); }
 
 
 }
});
   }
 
  /script
 
 
 
 
 
 
 
 
 
   -Original Message-
   From: jquery-en@googlegroups.com
  [mailto:jquery...@googlegroups.com]
   On Behalf Of James
   Sent: Friday, February 13, 2009 9:11 PM
   To: jQuery (English)
   Subject: [jQuery] Re: Would some please tell me what's
  wrong with this syntax?
  
  
   The word 'function' is not suppose to be there. It's there
  only when
   you define a function, not when you call it.
  
   On Feb 13, 4:07 pm, Rick Faircloth
  r...@whitestonemedia.com wrote:
Hi, James, and thanks for the reply...
   
I've got a page full of code and two other errors that are
*seemingly* unrelated, however, anything is possible.
   
Let me ask this in relation to the second error message:
   
See anything wrong with this syntax (reponse section of
  an ajax function):
   
success:   function(response) {
   
           if (response.RESULT == 'Success')
   
              { $('#li-month-year-inst').fadeOut(250);
                $('#li-month-year').fadeOut(250);
   
  $('#li-new-schedule-message').empty().append('Here
is the new schedule for '+ response.MONTH +
response.YEAR).hide().fadeIn(500);
   
                function getNewSchedule(response.MONTH,
response.YEAR); }
   
           else
              {
                $('#li-new-schedule-message').empty().append('An
error occured.  Please click
  the
create link to try again.').hide().fadeIn(500);
              }
   
}
   
I'm getting this error message for the function
  getNewSchedule... line in the middle:
   
missing ) after formal parameters
function getNewSchedule(response.MONTH, response.YEAR);\n
   
Ideas?
   
Thanks,
   
Rick
   
 -Original Message-
 From: jquery-en@googlegroups.com
 [mailto:jquery...@googlegroups.com] On Behalf Of James
 Sent: Friday, February 13, 2009 8:50 PM
 To: jQuery (English)
 Subject: [jQuery] Re: Would some please tell me what's
  wrong with this syntax?
   
 I don't see the problem. Do you have more code than
  this somewhere
 that could be causing the error?
   
   

[jQuery] Re: Would some please tell me what's wrong with this syntax?

2009-02-14 Thread Rick Faircloth

Alright...that fixed it.

Thanks Ricardo and Michael!

I didn't understand the proper way to use the variables.
Since they were being passed from the response section of another
function as response.MONTH and response.YEAR, I figured they
would have to be received that way.

Live and learn...

Rick


 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of Ricardo Tomasi
 Sent: Friday, February 13, 2009 11:27 PM
 To: jQuery (English)
 Subject: [jQuery] Re: Would some please tell me what's wrong with this syntax?
 
 
  function getNewSchedule(response.MONTH, response.YEAR) {
 
 the parameteres when you declare a function are variable names, and
 those are invalid. Try
 
  function getNewSchedule(month, year) {
 
 and replace the response.XX references inside the function
 accordingly. You can then call the function passing those object
 properties: getNewSchedule(response.MONTH, response.YEAR) and access
 their values inside the function with the 'month' and 'year'
 variables.
 
 cheers,
 - ricardo
 
 On Feb 14, 1:19 am, Rick Faircloth r...@whitestonemedia.com wrote:
  Good call, James...couldn't see that one...I've been starting at it too 
  long!
 
  How about another one?
 
  Here's the error message:
 
  missing ) after formal parameters
  function getNewSchedule(response.MONTH, response.YEAR) {\n
 
  And here's the code...ideas?  Thanks!
 
  script
 
       function getNewSchedule(response.MONTH, response.YEAR) {
 
            var formval  =  { dsn:       
  'cfoutput#application.dsn#/cfoutput',
                              month:     response.MONTH,
                              day:       '01',
                              year:      response.YEAR };
 
                              console.log(formval);
 
            $.ajax         ({ cache:     false,
                              type:      post,
                              url:
  ../components/floor_duty.cfc?method=get_new_schedulereturnFormat=json,
                              dataType:  json,
                              data:      formval,
                              success:   function(response) {
 
                                              if  (response.MESSAGE == 
  'Success')
                                                  { 
  $('#li-none:visible').hide();
                                                  
  $('#schedule-month-year').empty().append('Below
is
  the schedule for' + response.MONTH +' '+ response.YEAR);
                                                  
  $('#schedule-instructions').fadeIn(500);
                                                  
  $('#scheduleBody').fadeIn(500);
 
                                                  
  populateDutyTable(response); }
 
                                            else
                                                  { 
  $('#li-below:visible').hide();
                                                    
  $('#none-date').empty().append(response.MONTH
+'
  '+ response.YEAR);
                                                    $('#li-none').fadeIn(500);
                                                    
  $('#scheduleBody').fadeOut(250); }
 
                                         }
            });
       }
 
  /script
 
 
 
   -Original Message-
   From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
   Behalf Of James
   Sent: Friday, February 13, 2009 9:11 PM
   To: jQuery (English)
   Subject: [jQuery] Re: Would some please tell me what's wrong with this 
   syntax?
 
   The word 'function' is not suppose to be there. It's there only when
   you define a function, not when you call it.
 
   On Feb 13, 4:07 pm, Rick Faircloth r...@whitestonemedia.com wrote:
Hi, James, and thanks for the reply...
 
I've got a page full of code and two other errors
that are *seemingly* unrelated, however, anything is possible.
 
Let me ask this in relation to the second error message:
 
See anything wrong with this syntax (reponse section of an ajax 
function):
 
success:   function(response) {
 
           if (response.RESULT == 'Success')
 
              { $('#li-month-year-inst').fadeOut(250);
                $('#li-month-year').fadeOut(250);
                $('#li-new-schedule-message').empty().append('Here is 
the new schedule for
'+
response.MONTH + response.YEAR).hide().fadeIn(500);
 
                function getNewSchedule(response.MONTH, response.YEAR); 
}
 
           else
              {
                $('#li-new-schedule-message').empty().append('An error 
occured.  Please
click
  the
create link to try again.').hide().fadeIn(500);
              }
 
}
 
I'm getting this error message for the function getNewSchedule... 
line in the middle:
 
missing ) after formal parameters
function getNewSchedule(response.MONTH, response.YEAR);\n
 
Ideas?
 
Thanks,
 
Rick
 
 

[jQuery] Re: Safari and .remove()

2009-02-14 Thread Karl Rudd

In the past Safari has been a bit... slow to render changes sometimes.
Sometimes it needed a bit of a kick to look at the styles again and
re-layout the page. After a change (that Safari didn't recognise at
once) I used to do something like this:

  $('body').addClass('dummyClass').removeClass('dummyClass');

And it would work. YMMV.

You could try disabling the link before removing it.

Karl Rudd

On Sat, Feb 14, 2009 at 2:13 AM, Olaf Gleba l...@creatics.de wrote:

 I was wrong. The removal works. But it seems, that clicking on a link which
 removes the DOM link tag doesn't affect the browser rendering. So the DOM
 link tag is removed, but i still get a unaltered pageview.

 This regards to Safari Mac and also IE 7 Win.

 On FF 2/3 (Mac, Win) all is fine: Clicking on a link to reset the pageview,
 the appropriate link tag is removed from the DOM AND the styles of the
 former appended stylesheet doesn't affect the pageview no longer.

 Thanks for your help.

 bye
 Olaf


 Am 13.02.2009 um 13:05 schrieb Karl Rudd:


 If the removal really doesn't work you could try disabling the link.
 $(linkHere).attr('disable',true).

 Karl Rudd

 On Fri, Feb 13, 2009 at 7:22 PM, Olaf Gleba l...@creatics.de wrote:

 Hi.

 On a click event i DOM insert (append) a LINK tag into the head.

 var s = document.createElement('link');
 s.href='/gtpls/'+target+'.css';
 s.rel = 'stylesheet';
 s.type = 'text/css';
 s.media = 'screen';
 $('head').append(s);

 There is a link to the  former created DOM Element to set all to
 standard,
 e.g. restores the standard view.

 $('a[rel=default]').click(function() {
  $('HEAD').find('link[href=path-to-css]').remove();
  ...
 });

 Everythings fine except Safari 3.2.1. It seems to find the target link
 tag
 (gives me 1 when i check length), but doesn't remove it on the fly.

 Is that a known issue on safari? Any hints to achive the desired
 behaviour?

 greets
 Olaf

 --
 Olaf Gleba : creatics media.systems
 Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225
 o...@creatics.de : http://www.creatics.de
 PGP-Key http://www.creatics.de/keys/

 Welcompose CMS - Einfach und Effizient
 http://www.welcompose.de








 gruss
 Olaf

 --
 Olaf Gleba : creatics media.systems
 Tel. +49 (0)221 170 67 224 : Fax. +49 (0)221 170 67 225
 o...@creatics.de : http://www.creatics.de
 PGP-Key http://www.creatics.de/keys/

 Welcompose CMS - Einfach und Effizient
 http://www.welcompose.de






[jQuery] Re: Why won't this unbind work?

2009-02-14 Thread Rick Faircloth

.expandable is a reference to the functionality of a plug-in.
It's included in the top of the page by
script src=jquery.expandable.js/script and it's code
provides the functionality to auto-expand and shrink a textarea.

When I click hide, I want to disable the plug-in's functionality
on the textarea, and re-enable it when I click show.

Here's the plug-in's code:

/*! Copyright (c) 2008 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT 
(http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 */

(function($) {

$.fn.extend({
 expandable: function(options) {

  options = $.extend({ duration: 'normal', interval: 750, within: 1, 
by: 2 }, options);

  return this.filter('textarea').each(function() {
   var $this = $(this).css({ display: 'block', overflow: 'hidden' 
}), minHeight =
$this.height(), interval, heightDiff = this.offsetHeight - minHeight,
rowSize = ( parseInt($this.css('lineHeight'), 10) ||
parseInt($this.css('fontSize'), 10) ),
$div = $('div
style=position:absolute;top:-999px;left:-999px;border-color:#000;border-style:solid;overflow-x:hidd
en;visibility:hidden;z-index:0; /').appendTo('body');
   $.each('borderTopWidth borderRightWidth borderBottomWidth 
borderLeftWidth paddingTop
paddingRight paddingBottom paddingLeft fontSize fontFamily fontWeight fontStyle 
fontStretch
fontVariant wordSpacing lineHeight width'.split(' '), function(i,prop) {
$div.css(prop, $this.css(prop));
   });

   $this
.bind('keypress', function(event) { if ( event.keyCode == 
'13' ) check(); })
.bind('focus blur', function(event) {
 if ( event.type == 'blur' ) clearInterval( interval );
 if ( event.type == 'focus'  !interval ) 
setInterval(check,
options.interval);
});

   function check() {
var text = $this.val(), newHeight, height, usedHeight, 
usedRows, availableRows;
$div.html( text.replace(/\n/g, 'nbsp;br') );
height = $this[0].offsetHeight - heightDiff;
usedHeight = $div[0].offsetHeight - heightDiff;
usedRows = Math.floor(usedHeight / rowSize);
availableRows = Math.floor((height / rowSize) - usedRows);

 if ( availableRows = options.within ) {
  newHeight = rowSize * (usedRows + 
Math.max(availableRows, 0) +
options.by);
  $this.stop().animate({ height: newHeight }, 
options.duration);
 } else if ( availableRows  options.by + 
options.within ) {
  newHeight = Math.max( height - (rowSize * 
(availableRows - (options.by
+ options.within))), minHeight )
  $this.stop().animate({ height: newHeight }, 
options.duration);
 }
};
 }).end();
  }
});

})(jQuery);






 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of Michael Geary
 Sent: Saturday, February 14, 2009 12:15 AM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: Why won't this unbind work?
 
 
 Your code is calling .unbind() on the #myTextarea element.
 
 What event handler is bound to the #myTextarea element?
 
 N.B.: .expandable() is not an event handler. Is it? What is it?
 
 -Mike
 
  From: Rick Faircloth
 
  Given these scripts:
 
  $(document).ready(function() {
   $('#myTextarea').hide();
  });
 
  $(document).ready(function() {
   $('#hide').click(function() {
$('#myTextarea').unbind().slideUp();
return false;
   });
  });
 
  $(document).ready(function() {
   $('#show').click(function() {
$('#myTextarea').expandable().slideDown();
return false;
   });
  });
 
  and this HTML:
 
   p
  [ strongNotes concerning textarea/strong ]
  [ notes ]
  [ a id=hide href=#hide/a ]
  [ a id=show href=#show/a ]
  [ export ]
  [ clear ]
   /p
 
   textarea id=myTextarea cols=100/textarea
 
 
  Why won't this code unbind the .expandable function?
  (.expandable is a reference to the .expandable plug-in)
 
  Thanks for any input...
 
  Rick
 




[jQuery] Re: transform div into a textfield to change its value nicely

2009-02-14 Thread Rick Faircloth

Hi, Chris...

I'm not sure how that would be coded, but here's a plug-in
that enables editing-in-place, as you've specified.

http://www.appelsiini.net/projects/jeditable/default.html

Rick


 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of Chris
 Sent: Saturday, February 14, 2009 4:41 AM
 To: jQuery (English)
 Subject: [jQuery] transform div into a textfield to change its value nicely
 
 
 Hi guys,
 
 I was wondering how this is usually done if I have a div container and
 want to change its value (e.g. a name of a person) just by pressing
 the left mouse button for a short moment so that it'll transform
 itself into a textfield and well... back when I'm done editing.
 
 Whats the usual design pattern for this?
 
 Thanks,
 Chris



[jQuery] Re: How to make a secured login form

2009-02-14 Thread phicarre

OK. I understood now. Thank's

On 13 fév, 20:07, James james.gp@gmail.com wrote:
 Okay, here's a simple way to understand it. Suppose in your login.php,
 if the user login is successful, you have login.php echo '1'. If not,
 echo something else, like '0'.

 This response will become stored in the 'msg' variable in your success
 function in your ajax.

 success: function(msg)
 {
     if (msg == '1') window.location.href = window.location.href;  //
 refresh page
     else alert('You failed');

 },

 On Feb 13, 8:50 am,phicarregam...@bluewin.ch wrote:

  I tried by doing header(Location:welcome.php) but the page is not
  displayed  ???
  The first module is waiting for an answer. This is probably that
  doesn't run ???
  Show me how you did it 

  On 13 fév, 19:45, Ashit Vora a.k.v...@gmail.com wrote:

   Hey, why dont u redirect to Welcome.php page from the page where u r
   authenticating the user.

   eg. suppose you make ajax request to auth.php for validation, If
   validation succeed, redirect to welcome.php (and the ajax request
   which was waiting for response will die) and if failed, write response
   back and it will be received by Ajax function waiting for it.

   I 'm doing this way.

   and also... If you check session on your welcome.php, and only allow
   user to continue if the user is validated else redirect back to login
   page than it doesnt matter even if user gets to know about your
   welcome.php page

   If I understood your problem properly than this should help you.

   Thanks :)

   On Feb 13, 10:30 am,phicarregam...@bluewin.ch wrote:

The question was How to call welcome.php from my jquery script in a
secured manner ? because welcome.php is visible from the client side.

On 13 fév, 13:19, Rene Veerman rene7...@gmail.com wrote:

 Rene Veerman wrote:
             //    $pwh = md5 ($users-rec[user_password_hash] .
  $challenge);

 Ehm, best to use Either sha256 OR md5 for BOTH fields ofcourse ;)
 It was a hasty paste.


[jQuery] Re: How to make a secured login form

2009-02-14 Thread phicarre

@james: I forgot to answer to your question ... what I want ? web2.0
style with a solution as you suggested it

On 14 fév, 12:03, phicarre gam...@bluewin.ch wrote:
 OK. I understood now. Thank's

 On 13 fév, 20:07, James james.gp@gmail.com wrote:

  Okay, here's a simple way to understand it. Suppose in your login.php,
  if the user login is successful, you have login.php echo '1'. If not,
  echo something else, like '0'.

  This response will become stored in the 'msg' variable in your success
  function in your ajax.

  success: function(msg)
  {
      if (msg == '1') window.location.href = window.location.href;  //
  refresh page
      else alert('You failed');

  },

  On Feb 13, 8:50 am,phicarregam...@bluewin.ch wrote:

   I tried by doing header(Location:welcome.php) but the page is not
   displayed  ???
   The first module is waiting for an answer. This is probably that
   doesn't run ???
   Show me how you did it 

   On 13 fév, 19:45, Ashit Vora a.k.v...@gmail.com wrote:

Hey, why dont u redirect to Welcome.php page from the page where u r
authenticating the user.

eg. suppose you make ajax request to auth.php for validation, If
validation succeed, redirect to welcome.php (and the ajax request
which was waiting for response will die) and if failed, write response
back and it will be received by Ajax function waiting for it.

I 'm doing this way.

and also... If you check session on your welcome.php, and only allow
user to continue if the user is validated else redirect back to login
page than it doesnt matter even if user gets to know about your
welcome.php page

If I understood your problem properly than this should help you.

Thanks :)

On Feb 13, 10:30 am,phicarregam...@bluewin.ch wrote:

 The question was How to call welcome.php from my jquery script in a
 secured manner ? because welcome.php is visible from the client side.

 On 13 fév, 13:19, Rene Veerman rene7...@gmail.com wrote:

  Rene Veerman wrote:
              //    $pwh = md5 ($users-rec[user_password_hash] .
   $challenge);

  Ehm, best to use Either sha256 OR md5 for BOTH fields ofcourse ;)
  It was a hasty paste.


[jQuery] Re: Why won't this unbind work?

2009-02-14 Thread Rick Faircloth

And my question becomes a mute point when I simply
surround the textarea with a div with hide and show
that div instead of the textarea... simple solution.

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of Michael Geary
 Sent: Saturday, February 14, 2009 12:15 AM
 To: jquery-en@googlegroups.com
 Subject: [jQuery] Re: Why won't this unbind work?
 
 
 Your code is calling .unbind() on the #myTextarea element.
 
 What event handler is bound to the #myTextarea element?
 
 N.B.: .expandable() is not an event handler. Is it? What is it?
 
 -Mike
 
  From: Rick Faircloth
 
  Given these scripts:
 
  $(document).ready(function() {
   $('#myTextarea').hide();
  });
 
  $(document).ready(function() {
   $('#hide').click(function() {
$('#myTextarea').unbind().slideUp();
return false;
   });
  });
 
  $(document).ready(function() {
   $('#show').click(function() {
$('#myTextarea').expandable().slideDown();
return false;
   });
  });
 
  and this HTML:
 
   p
  [ strongNotes concerning textarea/strong ]
  [ notes ]
  [ a id=hide href=#hide/a ]
  [ a id=show href=#show/a ]
  [ export ]
  [ clear ]
   /p
 
   textarea id=myTextarea cols=100/textarea
 
 
  Why won't this code unbind the .expandable function?
  (.expandable is a reference to the .expandable plug-in)
 
  Thanks for any input...
 
  Rick
 




[jQuery] JQuery swapImage

2009-02-14 Thread Nick Y.

http://code.google.com/p/jquery-swapimage/


Anyone tried it is working in Firefox 1.x?

I have tested at Firefox 2  3, it is okay, but not working in Firefox
1.5... poor...


[jQuery] Re: transform div into a textfield to change its value nicely

2009-02-14 Thread Andras Kende


Try this:

http://davehauenstein.com/code/jquery-edit-in-place/

script type=text/javascript src=/js/jquery.js/script
script type=text/javascript src=/js/jquery.inplace.js/script


script language=javascript type=text/javascript
jQuery(document).ready(function() {
jQuery(.edit1).editInPlace({
url: ajaxupdate.php,
bg_over: #99,
show_buttons : false,
default_text: Edit...,
saving_image: /img/loading.gif,
params: ajax=yes
});
})
/script

div class=edit1 id=name_?php echo $topic['Topic']['id']; ?? 
php echo $topic['Topic']['name']; ?/div

ajaxupdate.php basically does the update , and just returns the value  
to display in the div..

try this in firebug to see whats being sent...

Andras


On Feb 14, 2009, at 4:40 AM, Chris wrote:


 Hi guys,

 I was wondering how this is usually done if I have a div container and
 want to change its value (e.g. a name of a person) just by pressing
 the left mouse button for a short moment so that it'll transform
 itself into a textfield and well... back when I'm done editing.

 Whats the usual design pattern for this?

 Thanks,
 Chris

Andras Kende
http://kende.com





[jQuery] Re: How to make a secured login form

2009-02-14 Thread EugeneS

location.href (simply redirection) is so called web 2.0 ? :)

web 2.0 is like a google mail where no redirection at all and all the
content loaded dynamically.

simplest realization can look like:
1) you will have one main script lets name it manager.php to this
script you will send different values, and depending on them our
manager will include different modules and return HTML which you will
insert into some div
2) every module as usually will check if user logged in or not lets
say depending on session
2.1) if logged in then show module content etc
2.2) if not then return lets say login form ...

this is the basic concept which will work without page refreshing/
redirecting etc ...

On Feb 14, 1:07 pm, phicarre gam...@bluewin.ch wrote:
 @james: I forgot to answer to your question ... what I want ? web2.0
 style with a solution as you suggested it

 On 14 fév, 12:03, phicarre gam...@bluewin.ch wrote:

  OK. I understood now. Thank's

  On 13 fév, 20:07, James james.gp@gmail.com wrote:

   Okay, here's a simple way to understand it. Suppose in your login.php,
   if the user login is successful, you have login.php echo '1'. If not,
   echo something else, like '0'.

   This response will become stored in the 'msg' variable in your success
   function in your ajax.

   success: function(msg)
   {
       if (msg == '1') window.location.href = window.location.href;  //
   refresh page
       else alert('You failed');

   },

   On Feb 13, 8:50 am,phicarregam...@bluewin.ch wrote:

I tried by doing header(Location:welcome.php) but the page is not
displayed  ???
The first module is waiting for an answer. This is probably that
doesn't run ???
Show me how you did it 

On 13 fév, 19:45, Ashit Vora a.k.v...@gmail.com wrote:

 Hey, why dont u redirect to Welcome.php page from the page where u r
 authenticating the user.

 eg. suppose you make ajax request to auth.php for validation, If
 validation succeed, redirect to welcome.php (and the ajax request
 which was waiting for response will die) and if failed, write response
 back and it will be received by Ajax function waiting for it.

 I 'm doing this way.

 and also... If you check session on your welcome.php, and only allow
 user to continue if the user is validated else redirect back to login
 page than it doesnt matter even if user gets to know about your
 welcome.php page

 If I understood your problem properly than this should help you.

 Thanks :)

 On Feb 13, 10:30 am,phicarregam...@bluewin.ch wrote:

  The question was How to call welcome.php from my jquery script in a
  secured manner ? because welcome.php is visible from the client 
  side.

  On 13 fév, 13:19, Rene Veerman rene7...@gmail.com wrote:

   Rene Veerman wrote:
           //    $pwh = md5 ($users-rec[user_password_hash] .
$challenge);

   Ehm, best to use Either sha256 OR md5 for BOTH fields ofcourse ;)
   It was a hasty paste.


[jQuery] Datepicker Plugin Quesiton

2009-02-14 Thread Hellofrom
Hello every one
Can some one help me setting the datepicker plugin with the following
options
min date =today
date format =-mm-dd

thanks


[jQuery] Re: onclick event on a href calls a function , where to return false to prevent redirection

2009-02-14 Thread goldy
ok but, where to put this
$('a.ToggleClose').click?
ready is ready ok but, after the questionnable a href?

cause like that I cannot control the arguments of this function, cause
in the beginning I don't know these values,
and btw, there are multiple links.toggle, and everyone is with
different arguments


On Feb 11, 7:43 pm, mkmanning michaell...@gmail.com wrote:
 Inline JavaScript is generally frowned upon nowadays. A better
 approach, if you can do it, is to separate your behavior from your
 markup, the same as you separate your structure from your
 presentation. It makes for cleaner, more accessible, and more
 maintainable code. For the example above:

 //attach behavior in your jQuery domready function
 ...
 $('a.ToggleClose').click(function(){
 buildingedit('#descr', 'descriptionsadd.php', 'did', ?= $did ?, 2,
 this);
 return false;

 });

 As you've most likely seen with CSS, this separation has many
 advantages relating to purity and maintenance, and unobtrusive
 Javascript tends to focus more on enhancing an existing, functional
 interface. This subtle difference is important when you're talking
 about graceful degradation/progressive enhancement.

 Just saying. :)
 ...
 On Feb 11, 9:26 am, brian bally.z...@gmail.com wrote:

  If you bind your event handlers using an element's onclick attribute
  (or onwhatever) you should write it like so:

  onclick=return myClickHandler(...);

  And return false from the function to avoid having the link followed.

  Note that the attribute should be all lowercase, btw. The camelcase
  version is used when referring to it as a member of a DOM element, eg.
  some_element.onClick = ...

  On Wed, Feb 11, 2009 at 9:28 AM, goldy zlati.pehliva...@gmail.com wrote:

   function buildingedit(searchhtmlid, filename, editid, idnum, addnum,
   obj)
   {
          //closeinst(searchhtmlid);

          var params = $.evalJSON('{'+editid+':'+idnum+',add:'+addnum
   +',showhtml:2}');
          var myelem = document.getElementById('lastid');
          var lastid = myelem.value;

          var $tablerow = $(searchhtmlid+idnum).clone(true);

          $(searchhtmlid+lastid).css('background-color','#FF');
          if(lastid)
          {
                  if(lastid!=idnum)
                  {
                          $.get(filename,
                                                  params,
                                                  function(returned_data)
                                                  {

                                                          var rs = $('div 
   id=editwindow style=display:none;/
   div');
                                                          
   $(searchhtmlid+idnum).hide();
                                                          
   $(searchhtmlid+idnum).after(rs);
                                                          
   //$(searchhtmlid+idnum).css('background-color','#DCE4F5');
                                                          
   $('#editwindow').css('background-color','#DCE4F5');
                                                          
   rs.html(returned_data);
                                                          rs.fadeIn(2000, 
   function(){
                                                                          
   $(this).css('display','block');
                                                                  });
                                                  });

                          myelem.value = idnum;
                          setTimeout(prepareForm(+idnum+), 2000);
                  }
                  else
                  {
                          $('div#editwindow').fadeOut(1000, function(){
                                                                             
                                                                             
              $(this).remove();
                                                                             
                                                                             
              $(searchhtmlid+idnum).show();
                                                                             
                                                                             
              });
                          myelem.value = 0;
                          //closeprev(obj);
                  }
          }
          else
          {
                  $.get(filename,
                                                  params,
                                                  function(returned_data)
                                                  {
                                                          var rs = $('div 
   id=editwindow style=display:none;/
   div');
                                                          
   $(searchhtmlid+idnum).hide();
                                                          
   $(searchhtmlid+idnum).after(rs);
                                                          
   

[jQuery] Re: onclick event on a href calls a function , where to return false to prevent redirection

2009-02-14 Thread goldy
hmm, a have tried this
a class=ToggleClose id=ToggleClose?= $did ?
href=descriptionsadd.php?add=2did=?= $did ?showhtml=2/a
script type=text/javascript
$('a#ToggleClose?= $did ?').click(function(){
buildingedit('#descr', 'descriptionsadd.php', 'did', ?= $did 
?,
2,this);
return false;
});
/script

it's working, but is it what you mean by Inline JavaScript



On Feb 11, 7:43 pm, mkmanning michaell...@gmail.com wrote:
 Inline JavaScript is generally frowned upon nowadays. A better
 approach, if you can do it, is to separate your behavior from your
 markup, the same as you separate your structure from your
 presentation. It makes for cleaner, more accessible, and more
 maintainable code. For the example above:

 //attach behavior in your jQuery domready function
 ...
 $('a.ToggleClose').click(function(){
 buildingedit('#descr', 'descriptionsadd.php', 'did', ?= $did ?, 2,
 this);
 return false;

 });

 As you've most likely seen with CSS, this separation has many
 advantages relating to purity and maintenance, and unobtrusive
 Javascript tends to focus more on enhancing an existing, functional
 interface. This subtle difference is important when you're talking
 about graceful degradation/progressive enhancement.

 Just saying. :)
 ...
 On Feb 11, 9:26 am, brian bally.z...@gmail.com wrote:

  If you bind your event handlers using an element's onclick attribute
  (or onwhatever) you should write it like so:

  onclick=return myClickHandler(...);

  And return false from the function to avoid having the link followed.

  Note that the attribute should be all lowercase, btw. The camelcase
  version is used when referring to it as a member of a DOM element, eg.
  some_element.onClick = ...

  On Wed, Feb 11, 2009 at 9:28 AM, goldy zlati.pehliva...@gmail.com wrote:

   function buildingedit(searchhtmlid, filename, editid, idnum, addnum,
   obj)
   {
          //closeinst(searchhtmlid);

          var params = $.evalJSON('{'+editid+':'+idnum+',add:'+addnum
   +',showhtml:2}');
          var myelem = document.getElementById('lastid');
          var lastid = myelem.value;

          var $tablerow = $(searchhtmlid+idnum).clone(true);

          $(searchhtmlid+lastid).css('background-color','#FF');
          if(lastid)
          {
                  if(lastid!=idnum)
                  {
                          $.get(filename,
                                                  params,
                                                  function(returned_data)
                                                  {

                                                          var rs = $('div 
   id=editwindow style=display:none;/
   div');
                                                          
   $(searchhtmlid+idnum).hide();
                                                          
   $(searchhtmlid+idnum).after(rs);
                                                          
   //$(searchhtmlid+idnum).css('background-color','#DCE4F5');
                                                          
   $('#editwindow').css('background-color','#DCE4F5');
                                                          
   rs.html(returned_data);
                                                          rs.fadeIn(2000, 
   function(){
                                                                          
   $(this).css('display','block');
                                                                  });
                                                  });

                          myelem.value = idnum;
                          setTimeout(prepareForm(+idnum+), 2000);
                  }
                  else
                  {
                          $('div#editwindow').fadeOut(1000, function(){
                                                                             
                                                                             
              $(this).remove();
                                                                             
                                                                             
              $(searchhtmlid+idnum).show();
                                                                             
                                                                             
              });
                          myelem.value = 0;
                          //closeprev(obj);
                  }
          }
          else
          {
                  $.get(filename,
                                                  params,
                                                  function(returned_data)
                                                  {
                                                          var rs = $('div 
   id=editwindow style=display:none;/
   div');
                                                          
   $(searchhtmlid+idnum).hide();
                                                          
   

[jQuery] NEWCOMPUTER

2009-02-14 Thread noorullah m
*http://noorullah-newcomputer.blogspot.com/
* http://noorullah-newcomputer.blogspot.com/


[jQuery] NEWCOMPUTER

2009-02-14 Thread noorullah m
*http://noorullah-newcomputer.blogspot.com/*


[jQuery] Re: transform div into a textfield to change its value nicely

2009-02-14 Thread Chris

Thanks thats just fine.

On Feb 14, 11:58 am, Rick Faircloth r...@whitestonemedia.com
wrote:
 Hi, Chris...

 I'm not sure how that would be coded, but here's a plug-in
 that enables editing-in-place, as you've specified.

 http://www.appelsiini.net/projects/jeditable/default.html

 Rick

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
  Behalf Of Chris
  Sent: Saturday, February 14, 2009 4:41 AM
  To: jQuery (English)
  Subject: [jQuery] transform div into a textfield to change its value nicely

  Hi guys,

  I was wondering how this is usually done if I have a div container and
  want to change its value (e.g. a name of a person) just by pressing
  the left mouse button for a short moment so that it'll transform
  itself into a textfield and well... back when I'm done editing.

  Whats the usual design pattern for this?

  Thanks,
  Chris


[jQuery] anyone tried alternatives to setting wmode on objects (lightbox on top issue)?

2009-02-14 Thread hedgomatic

I'm working for an alt-weekly paper, and we have some animated flash
ads that come from various sources, which aren't setting the WMode of
their flash ads.

further complicating things, our ad server backend is a shared
platform, so I can't go modifying the script that generates the object
tags.

even /further/ complicating things, the ads display in an iframe on a
different domain, so I can't modify the object tag after the fact
(which adobe's stated doesn't work anyway, although I've seen
otherwise?)

I'm wondering if anyone's come up with alternative solutions, like
embedding a swf in a parent div of a lightbox to force it on top of
other flash objects, etc...I'd try it, but I don't have flash :]

My first thought was to import whatever html was needed directly into
a swf in the lightbox, but apparently flash only supports limited html
(still?!?).

Anyone have a novel solution for this? Even if it doesn't work across
all browsers, if we can reduce the number of browsers it's a problem
for, and get our advertisers to start publishing with the windowless
option, it's better than where we're at now.



[jQuery] Re: Superfish: Error: jQuery(ul.sf-menu).superfish is not a function

2009-02-14 Thread manuef

Hello
Same error for me, have you found solution ?
Thanks for your help
emmanuelle

roel a écrit :
 Hi,

 I'm running a Joomla site with the superfish menu (http://
 www.sdspaintball.nl) Menu works fine except when I go to the forum
 section. It displays the menu, but without the downarrow indicator.
 Also the slide effect is not working as it is on the rest of the site.

 Error I'm getting is:
 Error: jQuery(ul.sf-menu).superfish is not a function
 Source File: 
 http://www.sdspaintball.nl/index.php?option=com_fireboardItemid=11func=latest
 Line: 29

 Line 29 contains:
 jQuery(document).ready(function(){ jQuery(ul.sf-menu).superfish
 ({hoverClass:'sfHover', pathLevels:1, delay:800, animation:
 {opacity:'show', height:'show', width:'show'}, speed:'def', autoArrows:
 1, dropShadows:1}) });


 Any thoughts?


[jQuery] Changing scope of a function

2009-02-14 Thread Allan Jardine

Hello all,

I'm running into a few problems with a plug-in I'm developing. What I  
would like to do is to take a function (which is in any old scope,  
global for example) and then execute it in the scope of my plug-in. I  
rather thought I would be able to do something like in my constructor:

this.fnTest = fnGlobalTest;

This would take a reference of the global function and store it in my  
object. It is just a reference being stored, so it looks like it is  
then being executed in the original scope. So I tried:

this.fnTest = function() { fnGlobalTest.call( this ); };

Expecting that to work - it didn't. I can't access any of the private  
functions. Indeed the only way I have managed to do this is to:

this.fnTest = eval( '('+ fnGlobalTest.toString()+')' );

Which is obviously far from ideal...

Does anyone have any suggestions for how I might do this?

Regards,
Allan


[jQuery] Lightbox working local not live?

2009-02-14 Thread Gavin

Hello, I'm currently working on my own website and I got everything to
work perfect locally, but when I upload live, lightbox fails to work.
My jFlow still works, it's just lightbox. As far as I can see it
should be working, but I'm not super familiar with javascript, so I
could have something wrong. Any help is much appreciated, thanks in
advance, Gavin.

http://gedesignz.com/photog.html


[jQuery] Re: triggering a link event that has an image tag?

2009-02-14 Thread Paul Mills

Hi,
In jQuery 1.3 there is a new .live() method that is a subset of the
livequery plugin.
http://docs.jquery.com/Events/live#typefn

I tried this and it works OK - I get 2 alert messages:
$(.flickr-photo a img)
  .live(click, function() {
alert('img click');
});

$(.flickr-photo a)
  .live(click, function() {
alert('a click');
});

Paul



[jQuery] Re: Changing scope of a function

2009-02-14 Thread Michael Geary

JavaScript uses lexical scoping: The scope chain for a function is
determined solely by the location of the function definition in the source
code.

Evaling the function's source code is a clever solution, and probably the
only way to do this. With eval() you're creating a new function from source
code that is treated as if it were in the location of the eval() call.

Could you give a working example of how you'd actually use this? Maybe there
is a different way to approach the problem.

-Mike

 From: Allan Jardine
 
 Hello all,
 
 I'm running into a few problems with a plug-in I'm 
 developing. What I would like to do is to take a function 
 (which is in any old scope, global for example) and then 
 execute it in the scope of my plug-in. I rather thought I 
 would be able to do something like in my constructor:
 
   this.fnTest = fnGlobalTest;
 
 This would take a reference of the global function and store 
 it in my object. It is just a reference being stored, so it 
 looks like it is then being executed in the original scope. 
 So I tried:
 
   this.fnTest = function() { fnGlobalTest.call( this ); };
 
 Expecting that to work - it didn't. I can't access any of the 
 private functions. Indeed the only way I have managed to do 
 this is to:
 
   this.fnTest = eval( '('+ fnGlobalTest.toString()+')' );
 
 Which is obviously far from ideal...
 
 Does anyone have any suggestions for how I might do this?
 
 Regards,
 Allan
 



[jQuery] Re: How to make an element *not* have a function attached...

2009-02-14 Thread QuadCom

Here's my understanding.


unbind will work for events. The expandable function you applied is
not an event. What I would do in this instance is on the hide button,
remove the textarea with the expandable and then insert a new textarea
with the same id. That would appear to remove the expandable
attributes.

Don't forget, if there is text in the textarea, copy it to a var
first, then do the remove/add step.

You could write your own plugin to do all o that in one step ie.
unexpandable



On Feb 13, 3:39 pm, Rick Faircloth r...@whitestonemedia.com wrote:
 Nice try, but no prize yet...

 Given these scripts:

 $(document).ready(function() {
  $('#myTextarea').hide();

 });

 $(document).ready(function() {
  $('#hide').click(function() {
   $('#myTextarea').unbind().slideUp();
   return false;
  });

 });

 $(document).ready(function() {
  $('#show').click(function() {
   $('#myTextarea').expandable().slideDown();
   return false;
  });

 });

 and this HTML:

 div style=padding-left:100px;

  p[ strongNotes concerning textarea/strong ]
 [ notes ]
 [ a id=hide href=#hide/a ]
 [ a id=show href=#show/a ]
 [ export ]
 [ clear ]
  /p

  textarea id=myTextarea cols=100/textarea

 /div

 Why wouldn't your idea work, Josh?
 It makes sense to me.

 I can click #show and #myTextarea becomes .expandable and executes .slideDown.
 But, when I then click #hide and #myTextarea starts to execute .slideUp,
 but then expands again, as it would if .expandable were still bound to it.

 Should I code this differently?

 Thanks,

 Rick

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
  Behalf Of Josh Nathanson
  Sent: Friday, February 13, 2009 3:00 PM
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: How to make an element *not* have a function 
  attached...

  This should work:

  $('#myTextarea').unbind(); // unbinds all handlers

  Then when you want to bind it again:

  $('#myTextarea').expandable();

  -- Josh

  -Original Message-
  From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
  Behalf Of Rick Faircloth
  Sent: Friday, February 13, 2009 11:43 AM
  To: jquery-en@googlegroups.com
  Subject: [jQuery] Re: How to make an element *not* have a function
  attached...

  To answer your question, hopefully, the element, in this case a textarea,
  is set up like this:

  script

   $(function() {
$('#myTextarea').expandable();
 });

  /script

  ...and that's it.  It would be active as expandable all the time.

  So, there's no event, like click, etc., that triggers the function.

  However, I want to be able to click a link and disable the expandable
  functionality, until another link is clicked to re-enable the functionality.

  In other words, having the textarea expandable is not something I want
  on all the time.

   -Original Message-
   From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
  Behalf Of Frederik Ring
   Sent: Friday, February 13, 2009 2:04 PM
   To: jQuery (English)
   Subject: [jQuery] Re: How to make an element *not* have a function
  attached...

   This should be done using $(this).unbind(event,function).
   I don't know from your example how your handle the event so I cannot
   give you a more specific answer.

   On Feb 13, 7:57 pm, Rick Faircloth r...@whitestonemedia.com wrote:
Strange question, perhaps...but...

If I have an element that has an function from a plug-in
attached to it, such as:

$(function() {
$('#myTextarea').expandable();

});

How would I then be able to make #myTextarea not .expandable...

$('#myTextarea').expandable('disable'); ...

Is this something that can be controlled from the page code, or
does something have to be built into the plug-in to allow this?

Thanks,

Rick


[jQuery] Re: How to make an element *not* have a function attached...

2009-02-14 Thread QuadCom

Actually an even easier trick would be to have 2 textareas that mirror
each others content. Hide one without the expandable. Show the other
with expandable. On the hide button, just do a reversal, show the
noexpandable, hide the expandable.

You can add a check on the submit of the form to delete the hidden
textarea so that it doesn't submit with the other form data.

On Feb 14, 2:11 pm, QuadCom supp...@quad-com.ca wrote:
 Here's my understanding.

 unbind will work for events. The expandable function you applied is
 not an event. What I would do in this instance is on the hide button,
 remove the textarea with the expandable and then insert a new textarea
 with the same id. That would appear to remove the expandable
 attributes.

 Don't forget, if there is text in the textarea, copy it to a var
 first, then do the remove/add step.

 You could write your own plugin to do all o that in one step ie.
 unexpandable

 On Feb 13, 3:39 pm, Rick Faircloth r...@whitestonemedia.com wrote:

  Nice try, but no prize yet...

  Given these scripts:

  $(document).ready(function() {
   $('#myTextarea').hide();

  });

  $(document).ready(function() {
   $('#hide').click(function() {
$('#myTextarea').unbind().slideUp();
return false;
   });

  });

  $(document).ready(function() {
   $('#show').click(function() {
$('#myTextarea').expandable().slideDown();
return false;
   });

  });

  and this HTML:

  div style=padding-left:100px;

   p[ strongNotes concerning textarea/strong ]
  [ notes ]
  [ a id=hide href=#hide/a ]
  [ a id=show href=#show/a ]
  [ export ]
  [ clear ]
   /p

   textarea id=myTextarea cols=100/textarea

  /div

  Why wouldn't your idea work, Josh?
  It makes sense to me.

  I can click #show and #myTextarea becomes .expandable and executes 
  .slideDown.
  But, when I then click #hide and #myTextarea starts to execute .slideUp,
  but then expands again, as it would if .expandable were still bound to it.

  Should I code this differently?

  Thanks,

  Rick

   -Original Message-
   From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
   Behalf Of Josh Nathanson
   Sent: Friday, February 13, 2009 3:00 PM
   To: jquery-en@googlegroups.com
   Subject: [jQuery] Re: How to make an element *not* have a function 
   attached...

   This should work:

   $('#myTextarea').unbind(); // unbinds all handlers

   Then when you want to bind it again:

   $('#myTextarea').expandable();

   -- Josh

   -Original Message-
   From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
   Behalf Of Rick Faircloth
   Sent: Friday, February 13, 2009 11:43 AM
   To: jquery-en@googlegroups.com
   Subject: [jQuery] Re: How to make an element *not* have a function
   attached...

   To answer your question, hopefully, the element, in this case a textarea,
   is set up like this:

   script

$(function() {
 $('#myTextarea').expandable();
  });

   /script

   ...and that's it.  It would be active as expandable all the time.

   So, there's no event, like click, etc., that triggers the function.

   However, I want to be able to click a link and disable the expandable
   functionality, until another link is clicked to re-enable the 
   functionality.

   In other words, having the textarea expandable is not something I want
   on all the time.

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
   Behalf Of Frederik Ring
Sent: Friday, February 13, 2009 2:04 PM
To: jQuery (English)
Subject: [jQuery] Re: How to make an element *not* have a function
   attached...

This should be done using $(this).unbind(event,function).
I don't know from your example how your handle the event so I cannot
give you a more specific answer.

On Feb 13, 7:57 pm, Rick Faircloth r...@whitestonemedia.com wrote:
 Strange question, perhaps...but...

 If I have an element that has an function from a plug-in
 attached to it, such as:

 $(function() {
 $('#myTextarea').expandable();

 });

 How would I then be able to make #myTextarea not .expandable...

 $('#myTextarea').expandable('disable'); ...

 Is this something that can be controlled from the page code, or
 does something have to be built into the plug-in to allow this?

 Thanks,

 Rick


[jQuery] getting border with without em or px

2009-02-14 Thread Alain Roger
Hi,

i know how to get border width with jQuery but every time it retrieves also
the format (px or em).
is there an easy way to get the border width without the px or em ? or
should i do a substring ?

thx.

-- 
Alain
---
Windows XP x64 SP2 / Fedora 10 KDE 4.2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008


[jQuery] Re: Feature Detection Best Practice?

2009-02-14 Thread Chris

On Feb 13, 2:34 am, Klaus Hartl klaus.ha...@googlemail.com wrote:
 That will not avoid IE's ClearType issue, since IE is supporting
 opacity and you still end up in the else branch.

 I think it's one of he rare cases where you need to do browser
 sniffing. I don't think there's a way to find out, if the ClearType
 issue is happening or not.

It doesn't go in the else branch for IE 6/7 actually. It works as I
intend. IE 8 however does go in the else branch.


[jQuery] Generate Session ID

2009-02-14 Thread Tim Johnson

I'm transitioning from old-style CGI programming to using
jQuery to access the server via Ajax. It is customary for me
to have the CGI script generate a random string to use as
a session ID. 

Using Ajax with jQuery - would it be practical and safe for the
document to generate a Session ID in the onload or document.ready
phase and pass it to the server-side script?

Comments, caveats and examples are welcome.
thanks
tim


[jQuery] Re: How to make an element *not* have a function attached...

2009-02-14 Thread Rick Faircloth

Thanks for the tips!

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of QuadCom
 Sent: Saturday, February 14, 2009 2:19 PM
 To: jQuery (English)
 Subject: [jQuery] Re: How to make an element *not* have a function attached...
 
 
 Actually an even easier trick would be to have 2 textareas that mirror
 each others content. Hide one without the expandable. Show the other
 with expandable. On the hide button, just do a reversal, show the
 noexpandable, hide the expandable.
 
 You can add a check on the submit of the form to delete the hidden
 textarea so that it doesn't submit with the other form data.
 
 On Feb 14, 2:11 pm, QuadCom supp...@quad-com.ca wrote:
  Here's my understanding.
 
  unbind will work for events. The expandable function you applied is
  not an event. What I would do in this instance is on the hide button,
  remove the textarea with the expandable and then insert a new textarea
  with the same id. That would appear to remove the expandable
  attributes.
 
  Don't forget, if there is text in the textarea, copy it to a var
  first, then do the remove/add step.
 
  You could write your own plugin to do all o that in one step ie.
  unexpandable
 
  On Feb 13, 3:39 pm, Rick Faircloth r...@whitestonemedia.com wrote:
 
   Nice try, but no prize yet...
 
   Given these scripts:
 
   $(document).ready(function() {
$('#myTextarea').hide();
 
   });
 
   $(document).ready(function() {
$('#hide').click(function() {
 $('#myTextarea').unbind().slideUp();
 return false;
});
 
   });
 
   $(document).ready(function() {
$('#show').click(function() {
 $('#myTextarea').expandable().slideDown();
 return false;
});
 
   });
 
   and this HTML:
 
   div style=padding-left:100px;
 
p[ strongNotes concerning textarea/strong ]
   [ notes ]
   [ a id=hide href=#hide/a ]
   [ a id=show href=#show/a ]
   [ export ]
   [ clear ]
/p
 
textarea id=myTextarea cols=100/textarea
 
   /div
 
   Why wouldn't your idea work, Josh?
   It makes sense to me.
 
   I can click #show and #myTextarea becomes .expandable and executes 
   .slideDown.
   But, when I then click #hide and #myTextarea starts to execute .slideUp,
   but then expands again, as it would if .expandable were still bound to it.
 
   Should I code this differently?
 
   Thanks,
 
   Rick
 
-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
Behalf Of Josh
Nathanson
Sent: Friday, February 13, 2009 3:00 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to make an element *not* have a function 
attached...
 
This should work:
 
$('#myTextarea').unbind(); // unbinds all handlers
 
Then when you want to bind it again:
 
$('#myTextarea').expandable();
 
-- Josh
 
-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Friday, February 13, 2009 11:43 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: How to make an element *not* have a function
attached...
 
To answer your question, hopefully, the element, in this case a 
textarea,
is set up like this:
 
script
 
 $(function() {
  $('#myTextarea').expandable();
   });
 
/script
 
...and that's it.  It would be active as expandable all the time.
 
So, there's no event, like click, etc., that triggers the function.
 
However, I want to be able to click a link and disable the expandable
functionality, until another link is clicked to re-enable the 
functionality.
 
In other words, having the textarea expandable is not something I want
on all the time.
 
 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
 On
Behalf Of Frederik Ring
 Sent: Friday, February 13, 2009 2:04 PM
 To: jQuery (English)
 Subject: [jQuery] Re: How to make an element *not* have a function
attached...
 
 This should be done using $(this).unbind(event,function).
 I don't know from your example how your handle the event so I cannot
 give you a more specific answer.
 
 On Feb 13, 7:57 pm, Rick Faircloth r...@whitestonemedia.com wrote:
  Strange question, perhaps...but...
 
  If I have an element that has an function from a plug-in
  attached to it, such as:
 
  $(function() {
  $('#myTextarea').expandable();
 
  });
 
  How would I then be able to make #myTextarea not .expandable...
 
  $('#myTextarea').expandable('disable'); ...
 
  Is this something that can be controlled from the page code, or
  does something have to be built into the plug-in to allow this?
 
  Thanks,
 
  Rick



[jQuery] Re: getting border with without em or px

2009-02-14 Thread mtsmit2

Hey,

There might might be an easier/better way but I always do the
following when I get number values from CSS:

parseInt($(.someclass).css(left));



On Feb 14, 2:30 pm, Alain Roger raf.n...@gmail.com wrote:
 Hi,

 i know how to get border width with jQuery but every time it retrieves also
 the format (px or em).
 is there an easy way to get the border width without the px or em ? or
 should i do a substring ?

 thx.

 --
 Alain
 ---
 Windows XP x64 SP2 / Fedora 10 KDE 4.2
 PostgreSQL 8.3.5 / MS SQL server 2005
 Apache 2.2.10
 PHP 5.2.6
 C# 2005-2008


[jQuery] Re: Changing scope of a function

2009-02-14 Thread theallan

Hi Mike,

Thanks very much for your reply and the information. What I'm hoping
to be able to do is to provide a plug-in API for my jQuery plug-in
which will allow the new API functions to be able to access the
private methods which I use. I know you can't force something to
expose private methods (or they wouldn't be private!) but what I was
wondering was if it was possible to allow access to those methods if
you know that you want to do this (without making everything
public)...

Here is the basic idea for what I want to do in code (and with the
eval/toString method I described above):

fnApi = function () {
console.log( 'API function is running with required scope: 
'+iPi );
}

fnContainer = function () {
var iPi=3.141592;

this.fnApi = eval( '('+ fnApi.toString()+')' );
};

var oContainer = new fnContainer();
oContainer.fnApi();

Many thanks,
Allan


On Feb 14, 5:53 pm, Michael Geary m...@mg.to wrote:
 JavaScript uses lexical scoping: The scope chain for a function is
 determined solely by the location of the function definition in the source
 code.

 Evaling the function's source code is a clever solution, and probably the
 only way to do this. With eval() you're creating a new function from source
 code that is treated as if it were in the location of the eval() call.

 Could you give a working example of how you'd actually use this? Maybe there
 is a different way to approach the problem.

 -Mike


[jQuery] Re: Generate Session ID

2009-02-14 Thread C.Everson

On Sat, 14 Feb 2009 10:41:05 -0900, Tim Johnson wrote:

 Using Ajax with jQuery - would it be practical and safe for the
 document to generate a Session ID in the onload or document.ready
 phase and pass it to the server-side script?

Tim,

IMHO the ONLY way to ensure a unique session ID is to generate it server
side.

Otherwise no matter what you do (client side) there is a chance of
duplication.

Chuck



[jQuery] Re: Generate Session ID

2009-02-14 Thread Tim Johnson

On Saturday 14 February 2009, C.Everson wrote:
 On Sat, 14 Feb 2009 10:41:05 -0900, Tim Johnson wrote:
  Using Ajax with jQuery - would it be practical and safe for the
  document to generate a Session ID in the onload or document.ready
  phase and pass it to the server-side script?

 Tim,

 IMHO the ONLY way to ensure a unique session ID is to generate it server
 side.

 Otherwise no matter what you do (client side) there is a chance of
 duplication.
  Understood. I'll stick with my tried-and-true cgi methods.
  thanks
  tim


[jQuery] Re: Changing scope of a function

2009-02-14 Thread Mike Alsup


 Thanks very much for your reply and the information. What I'm hoping
 to be able to do is to provide a plug-in API for my jQuery plug-in
 which will allow the new API functions to be able to access the
 private methods which I use. I know you can't force something to
 expose private methods (or they wouldn't be private!) but what I was
 wondering was if it was possible to allow access to those methods if
 you know that you want to do this (without making everything
 public)...

 Here is the basic idea for what I want to do in code (and with the
 eval/toString method I described above):

         fnApi = function () {
                 console.log( 'API function is running with required scope: 
 '+iPi );
         }

         fnContainer = function () {
                 var iPi=3.141592;

                 this.fnApi = eval( '('+ fnApi.toString()+')' );
         };

         var oContainer = new fnContainer();
         oContainer.fnApi();

 Many thanks,
 Allan


Here's one approach (view source):

http://jquery.malsup.com/test/feb14.html


[jQuery] [superfish] how do i make a menu disappear as user clicks on it?

2009-02-14 Thread rokomotibu

now menus disappear from screen only after user moves cursor away from
menu, but i want it to disappear right after user has chosen an item..


[jQuery] jquery.corner remove problem..

2009-02-14 Thread merihsaka...@yahoo.com

Hi all,

I am using jQuery corner plugin (version 1.92)
and I am adding corner style using onclick method..
But I didnt remove it.

function addCorner(){
  jQuery('#divName).corner(fray 8px);
}

function removeCorner(divName){
  jQuery('#divName).corner(none);
}

Actually I also tried to change it but the old one was also there..
jQuery('#divName).corner(round);

Do you know how can I remove it?

thanks


[jQuery] Need help with scrambled open/shut script

2009-02-14 Thread David Blomstrom
I downloaded jQuery a few months ago and used it to make a simple open-shut
script. While redesigning/upgrading my websites, I messed it up. I'm not
sure if I deleted a critical file, nixed the link to a critical file or
what.

I published a simplified version of a page at
http://www.geobop.org/Test.phpThere are four open/shut scripts on the
page:

MyRegions (top center)

Microsoft notice (top right)

Links (bottom)

Books (bottom)

I think it might actually be a CSS problem, not JavaScript. When I hover my
cursor over the Microsoft banner, the page moves in response (in Opera, at
least), though the related display div doesn't open.

The MyRegions box was frozen open until I added the following styles:

style type='text/css'
.trigger {
  position:relative;
  cursor:pointer;
  z-index:2;
}
.menu {
  position:absolute;
  visibility:hidden;
  overflow:hidden;
  z-index:1;
  margin:0;
  padding:4px;
  background:#BF8660;
}
/style

Now it's frozen shut.

I suspect the fix is a simple one, but I'm confused between JavaScript, CSS
and all my PHP includes. I may simply have several things in the wrong
order.

Thanks for any tips.

-- 
David Blomstrom
Writer  Web Designer (Mac, M$  Linux)
www.geobop.org


[jQuery] case insensitive :contains()

2009-02-14 Thread Patrick Aljord

Hey all,

I tried various solutions to have a case insensitive :contains() on
google but couldn't find one that works with jquery 1.3:

http://dev.jquery.com/ticket/278
http://mkhairul.com/2008/11/26/making-jquery-selectorcontains-case-insensitive/

any suggestion? also it would be good to include this selector in the
official jquery =)

Thanks in advance,

Pat


[jQuery] simple getting elements from ajax response not working

2009-02-14 Thread pedalpete

I've got what should be a very simple script, but I can't seem to get
anything but 'null' or 'undefined' when trying to get an elements html
or id.

The 'html(response) gets filled with ther response, but I can't get
either html or attribute id from the li.
The response has 10 li's, so I'm trying to get all of them, but
figured I would do an 'each' or something if I could just manage to
grab one. But I can't get that work?
Is there something wrong with my code?
Here's the code I've got
[code]
 success: function(response){
 var bidDate=$('li.show', response).attr('id');
 alert(bidDate);
$('div.#holdForecast').html(response);
[/code]


[jQuery] Re: simple getting elements from ajax response not working

2009-02-14 Thread Mike Alsup

 The 'html(response) gets filled with ther response, but I can't get
 either html or attribute id from the li.
 The response has 10 li's, so I'm trying to get all of them, but
 figured I would do an 'each' or something if I could just manage to
 grab one. But I can't get that work?
 Is there something wrong with my code?
 Here's the code I've got
 [code]
  success: function(response){
              var bidDate=$('li.show', response).attr('id');
              alert(bidDate);
         $('div.#holdForecast').html(response);
 [/code]


What is 'response'?  Is it XML? HTML? A document? A fragment?

If it's an HTML fragment what does it look like?  Just a bunch of LIs?





[jQuery] Re: simple getting elements from ajax response not working

2009-02-14 Thread pedalpete

Hi Mike,

yes, the response is an html with just a bunch of li's with a bunch of
other within each li.


On Feb 14, 3:40 pm, Mike Alsup mal...@gmail.com wrote:
  The 'html(response) gets filled with ther response, but I can't get
  either html or attribute id from the li.
  The response has 10 li's, so I'm trying to get all of them, but
  figured I would do an 'each' or something if I could just manage to
  grab one. But I can't get that work?
  Is there something wrong with my code?
  Here's the code I've got
  [code]
   success: function(response){
               var bidDate=$('li.show', response).attr('id');
               alert(bidDate);
          $('div.#holdForecast').html(response);
  [/code]

 What is 'response'?  Is it XML? HTML? A document? A fragment?

 If it's an HTML fragment what does it look like?  Just a bunch of LIs?


[jQuery] Re: Feature Detection Best Practice?

2009-02-14 Thread Klaus Hartl


 Are you saying that IE changes its UA string depending on whether
 ClearType is enabled or not?

No.


[jQuery] Re: Feature Detection Best Practice?

2009-02-14 Thread Klaus Hartl



On 14 Feb., 20:31, Chris cpot...@siolon.com wrote:
 On Feb 13, 2:34 am, Klaus Hartl klaus.ha...@googlemail.com wrote:

  That will not avoid IE's ClearType issue, since IE is supporting
  opacity and you still end up in the else branch.

  I think it's one of he rare cases where you need to do browser
  sniffing. I don't think there's a way to find out, if the ClearType
  issue is happening or not.

 It doesn't go in the else branch for IE 6/7 actually. It works as I
 intend. IE 8 however does go in the else branch.

Interesting. I assumed $.support.opacity would be true in IE since it
does support it, even though not as standard CSS3 property.


--Klaus


[jQuery] Re: simple getting elements from ajax response not working

2009-02-14 Thread Mike Alsup

 Hi Mike,

 yes, the response is an html with just a bunch of li's with a bunch of
 other within each li.

Ok, then I would think this should work:

success: function(response) {
var $li = $('div/').append(response).find('li.show');
var id = $li.attr('id);
...
}


[jQuery] jQuery.validate not working properly?

2009-02-14 Thread Mark

If I leave all the fields blank, the errors show up as they should.
But if I correctly fill out even just one of them, the form gets
submitted. Why is this happening?

Here's the JS:

script type=text/javascript
$(document).ready(function() {
$(form).validate({
rules: {
email: {
required: true,
email: true
},
fname: {
required: true,
minLength: 2
},
lname: {
required: true,
minLength: 2
},
city: {
required: true,
minLength: 2
},
password1: {
required: true,
minLength: 6
},
password2: {
equalTo: #password1
}
},
messages: {
email: *,
fname: *,
lname: *,
city: *,
password1: *,
password2: *
}
});
});
/script

The page is visible here: http://whitechocolateent.com/register


[jQuery] Can't Get Data Back from $.ajax() Call in IE7?

2009-02-14 Thread Vik

I've been testing this past few weeks in IE7, and I've got one
specific case where $.getJSON() seems to call the server
intermittently, and usually not at all. I use $.getJSON() a lot.  In
FF and Safari it always works, and even in IE7 it usually seems to
work, but not in this case for some reason.  I've tried setting cache
to false:

$.ajaxSetup({
cache: false
});

...but that doesn't seem to have fixed it yet.

So now I'm trying plain $.ajax() instead of $.getJSON:

$.ajax({
url: /myFunction?type=json,
cache: false,
mode: sync,
data:
{
theDataToCheck:theDataToCheck,
GramsOrML: GramsOrML,
UnitCount: UnitCount,
UnitsOfMeasurement: UnitsOfMeasurement,

LetOtherPeopleUseThisInfo:LetOtherPeopleUseThisInfo,
ajax_call: 'true'
},
dataType: jsonp,
success: function(data) {
//handle data
//data comes back undefined in IE7
}
});


This always sends the call to the server, so I'm part of the way there
towards fixing this bug.  However, although this $.ajax() call always
works in FireFox and Safari, in IE7, the data seems to come back
undefined. Here's the skeleton of the PHP code:

$JasonCallBack = $_REQUEST['callback'];

//put return data in $theData array

$S = $this-json-encode($theData);

$S = $JasonCallBack . '(' . $S . ');';

echo $S;

What can I do to get the data variable to be decoded properly in my
$.ajax() call in IE7?


[jQuery] Tablesorter support

2009-02-14 Thread Jthomas

Can anyone get tablesorter's default pager function to work?  The
pager functions don't show up for me.  The actual pager div is empty.
It DOES limit my table to 10 rows, but when I click on a header to
sort a row, my tbody is all the sudden empty.  Never have I actually
seen the pager control.

As a workaround, I'm using .pager() for now.

Using jquery 1.3.1 (also tried with 1.2.6, which leads me to believe
I'm doing something wrong)
Using tablesorter 2.0

Code:

script type=text/javascript src=${newJqueryURL}/
jquery-1.3.1.js/script
script type=text/javascript src=${newJqueryURL}/jquery-ui-
personalized-1.6rc6.js/script
script type=text/javascript src=${newJqueryURL}/
jquery.tablesorter.js/script
script type=text/javascript src=${newJqueryURL}/
jquery.tablesorter.pager.js/script

script type=text/javascript
$(document).ready(function() {
$(#actionListTable)
.tablesorter({widthFixed: false, widgets: ['zebra']})
.tablesorterPager({container: $(#pageit)});
});
/script

My table uses a thead and tbody.  After the /table tag, I've
included an empty div like this:
div id=pageit class=pageit/div

Thanks!
-Jon Thomas



[jQuery] getting element numbers

2009-02-14 Thread introvert

Hello.

I have a simple div list where one of the inner divs is being passed
as a this element to the function.
 How can I get the total number of divs (divisions) inside the div list? In 
 this case it would be 3.

div id=list
divfirst/div
divsecond/div
div.../div
/div

 How to get number of the specific div which is getting passed to the function?
For instance: lets say that second div was selected - how can I get
the number of the div (2 in this case)?

Many thanks in advance!


[jQuery] click events on links

2009-02-14 Thread introvert

Hello.

I have a simple anchor href link on which I put on click event
handler:

a href=# id=pause/a
$(#pause).click(function () {
//do something
});

When I click the link the action will be preformed and the browser
would scroll to the top of the page (because of # in the href
attribute). How do I prevent that?

Thanks for help!


[jQuery] undefinedjquery.block.js

2009-02-14 Thread Neil Bailey
I am just getting started w/ jQuery, so if this is just a ridiculous
question that has been answered a million times, I apologize in advance.  I
googled, and didn't find ANYTHING, so I am hoping that maybe someone on this
list has seen it.

 

I have the following code:

 

html

head

! jquery/ajaxCFC includes 

script type=text/javascript
src=js/jquery/jquery131.js/script

script type=text/javascript
src=js/jquery/jquery.ajaxCFC.js/script



link href=style.css type=text/css
rel=stylesheet /



! EXT files/dependancies 

!

link rel='stylesheet' type='text/css'
href='ext2/resources/css/ext-all.css' /

script type='text/javascript'
src='ext2/adapter/ext/ext-base.js'/script

script type='text/javascript'
src='ext2/ext-jquery.js'/script



script type=text/javascript

 
$.AjaxCFCHelper.setDebug(false);

 
$.AjaxCFCHelper.setBlockUI(true);

 
$.AjaxCFCHelper.setUseDefaultErrorHandler(true);

 
$.AjaxCFCHelper.setSerialization('json'); // json, wddx



//fire the AJAX event 

 
$(document).ready(function(){

//create a
test object to send to the server

var _o =
{bindings: [

 
{ircEvent: PRIVMSG, method: newURI, regex: ^http://.*},

 
{ircEvent: PRIVMSG, method: deleteURI, regex: ^delete.*},

 
{ircEvent: PRIVMSG, method: randomURI, regex: ^random.*}

 
], foo : bar,

 
baz : thud

};



alert(_o);



/*

$.AjaxCFC({

  url:
http://www.healthpro-rehab.com/oldsite/components/echoTest.cfc;,

  method:
echo,

  data: _o,

  //data:
'rob',

  //data:
['simple string', 'two'],

 
//unnamedargs: true,

 
//serialization: json,

  //blockUI:
true,

 
//useDefaultErrorHandler: true,

  success:
function(data) {

 
sDumper(data);

  },

 
failure:function(){alert(No Good!);}

});*/

})

/script

/head

body



/body

/html

 

In firefox, I can view the source of both the JS files, and they both appear
to be fine.  However, there are FOUR files attached - one being
undefinedjquery.block.js, and the other being undefinedjson.js.

 

I thought at first it was something I was doing incorrectly w/ the AJAX
call, but I am still having the issue even after commenting the ajax call
out.

 

Any help would be MUCH appreciated.

 

Thanks in advance, 

 

nb



[jQuery] strange loop with livequery click

2009-02-14 Thread pedalpete

I've got a page that I'm loading via ajax, and the first time I load
the page, the click function works great.
If I make a second ajax request and load new data, the clicks are
triggering the function twice.
Even though I empty the div before loading the new data, and then call
livequery on the click.

Any idea why livequery would do this, and what the solution would be?

[code]
function loadForecast(lat, long){
$('div#holdForecast').empty();

 var i=1;
 $.ajax({
  type: GET,
  url: widgets.php,
  data: lat=+lat+long=+long,
  success: function(response){

$('div#holdForecast').html('ul class=List'+response+'/
ul');

 });


$(li.reItem).livequery('click', function(event){

  alert(i);
  i++;
}
[/code]

when I run this code, the alert shows (1) if i've only run the
loadForecast function once. but if I get a second loadForecast
function, then the alert shows the number of times I've called the
funciton (2 or more).
So that is how I'm figuring that the 'click' function is being called
more than once per click.

Other alerts further down in the code also get called multiple times
as a result of the click.



[jQuery] why my ajax call is not working in IE?

2009-02-14 Thread cindy

Following code works in firefox, but doesn't work in IE.  why?

sendRequest:function(mode, request, argument)
{
if(mode==prototype)
return $.ajax({
url: xml/+request+.xml,
error: function(){
alert('Error loading xml');
},
async: false,});

else
{
 var queryStr='';
 if(request==summary)
queryStr='opcode=get_datatype=8';
 else if(request==connectivity)
queryStr='opcode=get_datatype=4';
 else if(request==ping)
queryStr='opcode=executecmd=pingargument=' + argument;
 return $.ajax({
type: get,
url: rap_util.urlroot,
data: queryStr,
error: function(){
alert('Error loading '+request);
},
async: false,
dataType: 'xml'});
}
},


[jQuery] Re: click events on links

2009-02-14 Thread pedalpete

i've done this before just leaving out the href in the a tag. if you
aren't going to use it, you may as well not put it in.

On Feb 14, 5:48 pm, introvert aljaz.faj...@gmail.com wrote:
 Hello.

 I have a simple anchor href link on which I put on click event
 handler:

 a href=# id=pause/a
 $(#pause).click(function () {
     //do something

 });

 When I click the link the action will be preformed and the browser
 would scroll to the top of the page (because of # in the href
 attribute). How do I prevent that?

 Thanks for help!


[jQuery] Re: Can't Get Data Back from $.ajax() Call in IE7?

2009-02-14 Thread Rick Faircloth

Hi, Vik...

You appear to have much more experience with AJAX than I do,
but, so far, I've always put returnFormat=json at the end
of my URL's, rather than just return=json...

Don't know if that makes any difference or not.

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of Vik
 Sent: Saturday, February 14, 2009 7:47 PM
 To: jQuery (English)
 Subject: [jQuery] Can't Get Data Back from $.ajax() Call in IE7?
 
 
 I've been testing this past few weeks in IE7, and I've got one
 specific case where $.getJSON() seems to call the server
 intermittently, and usually not at all. I use $.getJSON() a lot.  In
 FF and Safari it always works, and even in IE7 it usually seems to
 work, but not in this case for some reason.  I've tried setting cache
 to false:
 
 $.ajaxSetup({
   cache: false
   });
 
 ...but that doesn't seem to have fixed it yet.
 
 So now I'm trying plain $.ajax() instead of $.getJSON:
 
   $.ajax({
   url: /myFunction?type=json,
   cache: false,
   mode: sync,
   data:
   {
   theDataToCheck:theDataToCheck,
   GramsOrML: GramsOrML,
   UnitCount: UnitCount,
   UnitsOfMeasurement: UnitsOfMeasurement,
   
 LetOtherPeopleUseThisInfo:LetOtherPeopleUseThisInfo,
   ajax_call: 'true'
   },
   dataType: jsonp,
   success: function(data) {
   //handle data
   //data comes back undefined in IE7
   }
   });
 
 
 This always sends the call to the server, so I'm part of the way there
 towards fixing this bug.  However, although this $.ajax() call always
 works in FireFox and Safari, in IE7, the data seems to come back
 undefined. Here's the skeleton of the PHP code:
 
   $JasonCallBack = $_REQUEST['callback'];
 
   //put return data in $theData array
 
   $S = $this-json-encode($theData);
 
   $S = $JasonCallBack . '(' . $S . ');';
 
   echo $S;
 
 What can I do to get the data variable to be decoded properly in my
 $.ajax() call in IE7?



[jQuery] Re: click events on links

2009-02-14 Thread Rick Faircloth

add return false; to your code...

$('#pause').click(function() {
 do something;
 return false;
});

See if that helps...

Rick

 -Original Message-
 From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
 Behalf Of pedalpete
 Sent: Saturday, February 14, 2009 9:39 PM
 To: jQuery (English)
 Subject: [jQuery] Re: click events on links
 
 
 i've done this before just leaving out the href in the a tag. if you
 aren't going to use it, you may as well not put it in.
 
 On Feb 14, 5:48 pm, introvert aljaz.faj...@gmail.com wrote:
  Hello.
 
  I have a simple anchor href link on which I put on click event
  handler:
 
  a href=# id=pause/a
  $(#pause).click(function () {
      //do something
 
  });
 
  When I click the link the action will be preformed and the browser
  would scroll to the top of the page (because of # in the href
  attribute). How do I prevent that?
 
  Thanks for help!



[jQuery] Re: undefinedjquery.block.js

2009-02-14 Thread Rick Faircloth
Hi, Neil.

 

I know you've checked your jQuery source file links, 

but the error seems to indicate that you need to

include a src link to a jquery.block.js file.

 

I haven't used the blocking function, so I'm not sure

if that should be a separate file or not.

 

That's what the error seems to indicate, however.

 

hth,

 

Rick

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf 
Of Neil Bailey
Sent: Saturday, February 14, 2009 8:49 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] undefinedjquery.block.js

 

I am just getting started w/ jQuery, so if this is just a ridiculous question 
that has been answered
a million times, I apologize in advance.  I googled, and didn't find ANYTHING, 
so I am hoping that
maybe someone on this list has seen it.

 

I have the following code:

 

html

head

! jquery/ajaxCFC includes 

script type=text/javascript
src=js/jquery/jquery131.js/script

script type=text/javascript
src=js/jquery/jquery.ajaxCFC.js/script



link href=style.css type=text/css 
rel=stylesheet /




! EXT files/dependancies 

!

link rel='stylesheet' type='text/css'
href='ext2/resources/css/ext-all.css' /

script type='text/javascript'
src='ext2/adapter/ext/ext-base.js'/script

script type='text/javascript' 
src='ext2/ext-jquery.js'/script



script type=text/javascript

$.AjaxCFCHelper.setDebug(false);


$.AjaxCFCHelper.setBlockUI(true);


$.AjaxCFCHelper.setUseDefaultErrorHandler(true);


$.AjaxCFCHelper.setSerialization('json'); // json,
wddx



//fire the AJAX event 

$(document).ready(function(){

//create a test 
object to send to
the server

var _o = 
{bindings: [

 
{ircEvent: PRIVMSG, method: newURI, regex: ^http://.*},

 
{ircEvent: PRIVMSG, method: deleteURI, regex: ^delete.*},

 
{ircEvent: PRIVMSG, method: randomURI, regex: ^random.*}


], foo : bar,


baz : thud

};



alert(_o);



/*

$.AjaxCFC({

  url:
http://www.healthpro-rehab.com/oldsite/components/echoTest.cfc;,

  method: 
echo,

  data: _o,

  //data: 'rob',

  //data: 
['simple string', 'two'],

  
//unnamedargs: true,

  
//serialization: json,

  //blockUI: 
true,

  
//useDefaultErrorHandler: true,

  success: 
function(data) {


sDumper(data);

  },

  
failure:function(){alert(No
Good!);}

});*/

})

/script

/head

body



/body

/html

 

In firefox, I can view the source of both the JS files, and they both appear to 
be fine.  However,
there are FOUR files attached - one 

[jQuery] Re: undefinedjquery.block.js

2009-02-14 Thread David Andrews

Hi Neil,

Check this out

In the following code I'm including more than what is necessary for  
AjaxCFC to function. The only bits required for AjaxCFC to work are:  
json.js, wddx.js, and wddxDes.js (depending on which you intend to use  
for serialization). I just include json.js because I don't really use  
wddx. However, this shows an example of how you could use one script  
tag to include lots of different .js files


from the website

http://cjordan.us/index.cfm/2007/7/8/jQuery--AjaxCFC-Tutorial-Part-1-Setting-Up-Your-AJAX-Call

HTH
Dave



On 15 Feb 2009, at 01:49, Neil Bailey wrote:

I am just getting started w/ jQuery, so if this is just a ridiculous  
question that has been answered a million times, I apologize in  
advance.  I googled, and didn’t find ANYTHING, so I am hoping that  
maybe someone on this list has seen it.


I have the following code:

html
head
! jquery/ajaxCFC includes 
script type=text/javascript  
src=js/jquery/jquery131.js/script
script type=text/javascript  
src=js/jquery/jquery.ajaxCFC.js/script


link href=style.css type=text/ 
css rel=stylesheet /


! EXT files/dependancies 
!
link rel='stylesheet' type='text/ 
css' href='ext2/resources/css/ext-all.css' /
script type='text/javascript'  
src='ext2/adapter/ext/ext-base.js'/script
script type='text/javascript'  
src='ext2/ext-jquery.js'/script


script type=text/javascript
 
$.AjaxCFCHelper.setDebug(false);
 
$.AjaxCFCHelper.setBlockUI(true);
 
$.AjaxCFCHelper.setUseDefaultErrorHandler(true);
 
$.AjaxCFCHelper.setSerialization('json'); // json, wddx


//fire the AJAX event
$ 
(document).ready(function(){
// 
create a test object to send to the server
var  
_o = {bindings: [
{ircEvent 
: PRIVMSG, method: newURI, regex: ^http://.*},
{ircEvent 
: PRIVMSG, method: deleteURI, regex: ^delete.*},
{ircEvent 
: PRIVMSG, method: randomURI, regex: ^random.*}
], foo 
 : bar,
baz 
 : thud

};

 
alert(_o);


/*
 
$.AjaxCFC({
   
url: http://www.healthpro-rehab.com/oldsite/components/echoTest.cfc;,
   
method: echo,
   
data: _o,
  // 
data: 'rob',
  // 
data: ['simple string', 'two'],
  // 
unnamedargs: true,
  // 
serialization: json,
  // 
blockUI: true,
  // 
useDefaultErrorHandler: true,
   
success: function(data) {
sDumper 
(data);

  },
   
failure:function(){alert(No Good!);}

});*/
})
/script
/head
body

/body
/html

In firefox, I can view the source of both the JS files, and they  
both appear to be fine.  However, there 

[jQuery] Re: case insensitive :contains()

2009-02-14 Thread Dave Methvin

 I tried various solutions to have a case insensitive :contains() on
 google but couldn't find one that works with jquery 1.3:

This seems to work fine:

$.extend($.expr[:], {
containsNC: function(elem, i, match, array){
return (elem.textContent || elem.innerText || ).toLowerCase
().indexOf((match[3]||).toLowerCase()) = 0;
}
});


[jQuery] JQuery XML parsing is not working in IE?

2009-02-14 Thread cindy

Hi, all,

I have used following code to parse XML file, it works very well for
firefox, but not for IE. Can any one told me why and solution ?
Thanks!

(rXml).find(wired_port).each(function()
{
var o=new Object();
o.port=$(number,this).text();
o.mac_address=$(mac_addr,this).text();

var enabled=$(enable,this).text();
var interface_status=$(interface_status,this).text();
var link_status=$(link_status,this).text();

if(link_status==1)
o.status =Connected;
else if(interface_status == 1)
o.status = Link Down;
else if (enabled== 0)
o.status = Disabled;
else
o.status = Error;

var speed=$(speed,this).text();
var auto_neg=$(auto_neg,this).text();

if(auto_neg==1)
o.speed=speed+(auto);
else
o.speed=speed;

var duplex=$(duplex,this).text();
if(duplex==0)
o.duplex_type=Half;
else
o.duplex_type=Full;


o.fwd_mode=rap_util.formatFwdMode($(fwd_mode,this).text());
o.wired_port_empty=;
o.user=$(user_count,this).text();

o.tx_packets=rap_util.formatPackets($(tx_packets,this).text());

o.rx_packets=rap_util.formatPackets($(rx_packets,this).text());
wiredPorts.push(o);
});


[jQuery] How to set before and after callbacks properly

2009-02-14 Thread MH1988

I am using the jQuery cycle plugin which is working perfectly.
However, I would like to add some more functionality to the image
gallery I have created. What I would like to do is after an image
fades in, I would like a caption to be display along with the image as
well. I think the easiest way perhaps is display the image's alt or
title? How would I correctly setup the javascript for this?

Thanks!

jQuery(document).ready(function(){
jQuery('#frame1').cycle({
fx:'fade',
speed:'500',
timeout: 0,
next:'#next2',
prev:'#prev2',
});
});



[jQuery] optimizing

2009-02-14 Thread Bob O

hello,
Im trying to figure out a better way to do this. it works but its very
sluggish, so i think theyre might be a better way to iterate?

i have an input field = .searchbox

and then i have a YUI datatable that contains about 65 rows.
when i start to type in the search field, it iterates over all the
tr's looks at 2 cell text values and then uses the indexOf method to
determine whether or not to display the tr

is there a way that i can iterate once and put those values into cache
or something?

here is my code.

$(document).ready(function () {
  var searchbox = $('.member_search_input');
  var member_row = $('#members_data_table_wrap table tbody tr');
  searchbox.click(function() {
$(this).val('');
  });
   searchbox.bind('change keyup', function() {
  member_row.each(function() {
var number = $(this).find('.yui-dt1-col-PhoneNumber div
a').text();
var name = $(this).find('.yui-dt1-col-Name div').text();
var search_check_value = (name + number);
var search_value = searchbox.val();
 if (search_check_value.indexOf(search_value)  -1) {
   $(this).show();
  } else {
  $(this).hide();
}
  });
});
});