[jQuery] Simple .html problem in 1.4

2010-01-18 Thread Bruce MacKay

Hi folks,

The following function works fine in jQ1.3, but not in jQ1.4

function getArchive(pID){
$.get("scripts/ajax_editor.asp?id=getArc&epID="+pID+"&q=" + new 
Date().getTime(),

function(responseText){
//console.log(responseText);
$('#archive').html(responseText).show();
});
$('#archiveOn').hide();$('#archiveOff').show(5);
};

In both instances, the "responseText" is returned, but whereas it is 
injected into the div 'archive' and displayed when using jQ1.3, nothing 
happens when 1.4 is used.


Any idea of where I should be looking for a solution?

Thanks, Bruce


[jQuery] Re: Reset range slider values

2010-01-18 Thread Bruce
For single silder this works
jQuery(id).slider('option', 'value', 1);

You can see the handle is moved back to the start position.

Thanks.

On Jan 18, 9:49 am, Bruce  wrote:
> I setup a slider using
> jQuery(id).slider({ range:true,  min: 1, max: 100,  step: 1, values:
> [1, 100]}
>
> After I moved the slider handles I try to reset the values:
> jQuery(id).slider('option', 'min', 1); //works
> jQuery(id).slider('option', 'max', 100); //works
> jQuery(id).slider('option', 'values', [1,100]); //does not work!
>
> The min and max are reset but the handles stay where they are. Is this
> a bug?
>
> For single silder this works
> jQuery(id).slider('option', 'value', 1);
>
> Thanks!
> Bruce


[jQuery] Reset range slider values

2010-01-18 Thread Bruce
I setup a slider using
jQuery(id).slider({ range:true,  min: 1, max: 100,  step: 1, values:
[1, 100]}

After I moved the slider handles I try to reset the values:
jQuery(id).slider('option', 'min', 1); //works
jQuery(id).slider('option', 'max', 100); //works
jQuery(id).slider('option', 'values', [1,100]); //does not work!

The min and max are reset but the handles stay where they are. Is this
a bug?

For single silder this works
jQuery(id).slider('option', 'value', 1);

Thanks!
Bruce


[jQuery] jQuery Equivalent of Prototype Function.bind

2010-01-05 Thread Bruce
Is there a jQuery way of doing this Prototype bind?

var func = myFunction;
setTimeout(func.bind(this), 1000);

Thanks.


[jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be released?

2010-01-04 Thread Bruce
this alpha 2 fixed stack overflow.
Thanks


On Jan 4, 4:32 pm, Bruce  wrote:
> I need 1.4 for the bind object feature mentioned in this arctile:
>
> http://brandonaaron.net/blog/2009/05/12/jquery-edge-bind-with-a-diffe...
>
> I will check outhttp://blog.jquery.com/2009/12/18/jquery-14-alpha-2-released/.
> It is 4 days older than the nightly build.
>
> Thanks
>
> On Jan 4, 4:11 pm, MorningZ  wrote:
>
>
>
> > > January 14th  is only 10 days away.
>
> > and yet, there's no official announcement anywhere about it..i
> > wouldn't bet on it.. as it stands right this second, Alpha 2 is the
> > latest "official" announced version:
>
> >http://blog.jquery.com/2009/12/18/jquery-14-alpha-2-released/
>
> > chances that it will go through a beta process and be released as
> > "ready for production use" in a 10 day period doesn't seem
> > likely.   and take it from people like me who on Day # 1 use the
> > latest and greatest.  plan on waiting a little bit, even a day or
> > two  i recall on the last two "big" releases (1.2.4 and 1.3) that
> > they were quickly updated versions addressing some major issue...
>
> > > Hope it will be on time.
>
> > anything you are coding in particular that requires 1.4 ?  if that
> > version is absolutely necessary, did you create a ticket when that
> > stack overflow error you hit, is there an update for it by someone on
> > the jQuery team?  are you using the nightly builds as suggested above
> > to see if it has been fixed along the way?
>
> > Lots of things to consider. we all want the latest and greatest,
> > but it's got to be solid :-)- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be released?

2010-01-04 Thread Bruce
I need 1.4 for the bind object feature mentioned in this arctile:

http://brandonaaron.net/blog/2009/05/12/jquery-edge-bind-with-a-different-this

I will check out http://blog.jquery.com/2009/12/18/jquery-14-alpha-2-released/.
It is 4 days older than the nightly build.

Thanks


On Jan 4, 4:11 pm, MorningZ  wrote:
> > January 14th  is only 10 days away.
>
> and yet, there's no official announcement anywhere about it..i
> wouldn't bet on it.. as it stands right this second, Alpha 2 is the
> latest "official" announced version:
>
> http://blog.jquery.com/2009/12/18/jquery-14-alpha-2-released/
>
> chances that it will go through a beta process and be released as
> "ready for production use" in a 10 day period doesn't seem
> likely.   and take it from people like me who on Day # 1 use the
> latest and greatest.  plan on waiting a little bit, even a day or
> two  i recall on the last two "big" releases (1.2.4 and 1.3) that
> they were quickly updated versions addressing some major issue...
>
> > Hope it will be on time.
>
> anything you are coding in particular that requires 1.4 ?  if that
> version is absolutely necessary, did you create a ticket when that
> stack overflow error you hit, is there an update for it by someone on
> the jQuery team?  are you using the nightly builds as suggested above
> to see if it has been fixed along the way?
>
> Lots of things to consider. we all want the latest and greatest,
> but it's got to be solid :-)


[jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be released?

2010-01-04 Thread Bruce
Yes. I could not even load it in IE.  I got statck overflow 1456 error
in IE.  I heard it was fix but the fix is not in nightly build.
FF , Chrome work ok.

Thanks
Bruce


On Jan 4, 3:38 pm, "Jeffrey Kretz"  wrote:
> Have you tested the 1.4 nightly with your code?  Any issues with it?
>
>
>
> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On 
> Behalf Of Bruce
> Sent: Monday, January 04, 2010 1:28 PM
> To: jQuery (English)
> Subject: [jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be 
> released?
>
> January 14th  is only 10 days away.
> Hope it will be on time.
>
> On Dec 31 2009, 4:13 pm, Šime Vidas  wrote:
> > I read somewhere, on January 14th- Hide quoted text -
>
> - Show quoted text -


[jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be released?

2010-01-04 Thread Bruce
January 14th  is only 10 days away.
Hope it will be on time.

On Dec 31 2009, 4:13 pm, Šime Vidas  wrote:
> I read somewhere, on January 14th


[jQuery] Re: Does anybody know when jquery 1.3.3 or 1.4 will be released?

2009-12-31 Thread Bruce
Thanks for the info.
I will check out the new beta to fix my stack overflow.

On Dec 31, 2:38 pm, Dave Methvin  wrote:
> There should be an announcement of another beta within a few days. The
> stack overflow has been reported/fixed.


[jQuery] Does anybody know when jquery 1.3.3 or 1.4 will be released?

2009-12-31 Thread Bruce
Does anybody know when jquery 1.3.3 or 1.4 will be released?

  I am using 1.4 pre but I got statck overflow 1456 error in IE.

Thanks

Bruce


[jQuery] parent selectors (I think) and tabs

2009-12-20 Thread Bruce MacKay
Hi folks,

I'm hoping for some help/direction in a problem I'm having with some
tab switch code (originally presented @ 
http://www.mind4m.com/stories.php?pageid=10)
that I've introduced onto a test page @ 
http://rudderlive.bito.org.nz/employment_dev.asp

While the tab "a links" are working in so far as being correctly
selected and the appropriate CSS changes applied, the same is not true
for the divs holding the contents of each tab.  I'm sure the problem
is with the selectors, but I don't have the headspace to work out how
to debug the code to work out which elements are actually being
selected by the code.

The code being used is:
$('ul.tabNav a').click(function() {
var curChildIndex = $(this).parent().prevAll().length + 1;
//console.log(curChildIndex);
$(this).parent().parent().children('.current').removeClass
('current');
$(this).parent().addClass('current');
$(this).parent().parent().next('.tabContainer').children
('.current').fadeOut('fast',function() {
$(this).removeClass('current');

$(this).parent().children('div:nth-child('+curChildIndex+')').fadeIn
('normal',function() {
$(this).addClass('current');
});
});
return false;
});
});

Any help will be appreciated a lot

THanks,

Bruce


[jQuery] visible divs and selectors

2009-12-11 Thread Bruce MacKay
Hi folks,

I'm having difficulty with a flicker/repaint of an 'unhidden' div in
the following scenario

A user clicks on a region of an image map and triggers the following
function which 'unhides' previously populated divs, each with an id of
the clicked region and each containing a list of businesses in that
region.  I'm sure there is a more elegant way of doing this, but what
my code below is sort of doing is to hide all visible divs and then
unhide the one associated with the clicked region on the map.  There
is a bulldozer in there as I hide all divs, whether they are visible
or not - simply because I don't know how to specify the one that is
showing (or to exclude the one to be shown).  These points of good
style aside, the code does most of what I require.

What I can't understand is that when I click a second region (placing
"me" in the first part of the if statement), the unhidden div becomes
visible but then disappears before returning to stay.

I thought that by putting the .."$("#"+ej).show(600);".. bit in a
function after the divs were hidden would mean that the unhiding of
the ej div would occur after all the others had been (re)hidden.

The code behind this is:

function chooseRegion(ej){
var pj = $('#regions div');
if (pj.is(':visible')){
//console.log("1 " + ej);
$(pj).hide(100,function(){
$("#"+ej).show(600);});
} else {
//console.log("2 " + ej);
$("#"+ej).show(500);
};
}

How do I stop the refresh/flicker - or how can I approach this in a
better way?

Thanks,

Bruce


[jQuery] New question

2009-12-04 Thread bruce
Hi.

Not sure if this is a good place for my question, but I'll give it a shot..

I'm looking for a couple of sies that I can rip apart to see how they work.
I'm looking for test sites that allow a user to match items from different
columns together.

Basicaly, if I give the user a list of items, then the user would want to
select items from the next list, and match the items in colA, with items in
colB.

The lists/cols, would be generated from an underlying database, the UI
portion of the site, would be in ajax.

I'm just trying to get my head around how this could be accomplished..

My test is going to simulate students who would be taking classes, and
matching the books required for their classes...

thoughts/comments are appreciated..

thanks

-bruce



[jQuery] Re: Binding a function to >1 'a' tag - which approach is best?

2009-11-28 Thread Bruce MacKay
Thanks Michel - I appreciate the time you took here to provide such a
useful answer - javascript algebra in essence.

Cheers,  Bruce

On Nov 28, 12:18 am, Michel Belleville 
wrote:
> Now let's try to simplify this a bit :
>
> $('a.c_update').each(function() {
> var $a = $(this);
> var q = $a.attr('id');
> $a.bind("click", function() {
> doStuff('getitem',q); // hmm, I don't like this variable much...
> return false;
>
> });
> });
>
> $('a.c_update').each(function() {
> var $a = $(this);
> $a.bind("click", function() {
> doStuff('getitem', $a.attr('id');); // there, no need
>  return false;
>  });
>  });
>
> $('a.c_update').each(function() {
> var $a = $(this);
> $a.bind("click", function() { // wait, if I've bound my event to the link,
> why bother keep it as a variable before ?
> doStuff('getitem', $a.attr('id');); // there, no need
>  return false;
>  });
>  });
>
> $('a.c_update').each(function() {
> $(this).bind("click", function() { // feels better
> doStuff('getitem', $(this).attr('id'););
>  return false;
>  });
>  });
>
> $('a.c_update').each(function() { // hey, why bother looping, I could do it
> all with the .bind() function on the whole collection anyway
> $(this).bind("click", function() {
> doStuff('getitem', $(this).attr('id'););
>  return false;
>  });
>  });
>
> $('a.c_update').bind("click", function() { // how sleaker
> doStuff('getitem', $(this).attr('id'););
>  return false;
>  });
>
> So, basically you can reduce #1 to #2 breaking nothing, without any
> significan loss (in fact I think it's a net gain).
>
> Michel Belleville
>
> 2009/11/27 Bruce MacKay 
>
> > Hello folks,
>
> > I have some html returned via ajax that contains several 'a' tags to
> > which I am binding a function.
>
> > Both of the following methods does the job, but my perception of other
> > posts about this general practice from more wiser folk than me is that
> > the first method is the "better" method.  Is this the case?  Which is
> > the "best" method - and more importantly, why?
>
> > method #1
> > $('a.c_update').each(function() {
> >  var $a = $(this);
> >  var q = $a.attr('id');
> >  $a.bind("click",function() {doStuff('getitem',q);return
> > false;});
> >  });
>
> > method #2
> > $('a.c_update').bind("click",function() {doStuff
> > ('getitem',this.id);return false;});
>
> > Thanks,
> > Bruce


[jQuery] Binding a function to >1 'a' tag - which approach is best?

2009-11-27 Thread Bruce MacKay
Hello folks,

I have some html returned via ajax that contains several 'a' tags to
which I am binding a function.

Both of the following methods does the job, but my perception of other
posts about this general practice from more wiser folk than me is that
the first method is the "better" method.  Is this the case?  Which is
the "best" method - and more importantly, why?

method #1
$('a.c_update').each(function() {
  var $a = $(this);
  var q = $a.attr('id');
  $a.bind("click",function() {doStuff('getitem',q);return
false;});
 });

method #2
$('a.c_update').bind("click",function() {doStuff
('getitem',this.id);return false;});

Thanks,
Bruce


[jQuery] Re: Accordion, fieldset and selectors question

2009-11-27 Thread Bruce MacKay
Excellent Adriana - thanks very much - also for quietly pointing out
that I'd forgotten the return false bit.

Cheers/Bruce

On Nov 27, 2:45 pm, Adriana  wrote:
> Hi Bruce,
>
> Try this:
>
>     $('.accord > h6').click(function() {
>         $(this).toggleClass('expand_group').siblings
> ('h6.expand_group').removeClass('expand_group');
>         $(this).next('fieldset').slideToggle('fast').siblings
> ('fieldset:visible').slideUp('fast');
>         return false;
>     });
>
> Regards,
> Adriana
>
> On Nov 26, 11:41 am, Bruce MacKay  wrote:
>
> > Hello folks,
>
> > I have an operational accordion based on a series of fieldset tags
> > (the content) and h6 tags (the triggers).
>
> > It is initiated by:
>
> > $('.accord > h6').click(function() {
> >         $(this).next('fieldset').slideToggle('fast').siblings
> > ('fieldset:visible').slideUp('fast');
>
> > });
>
> > The trigger tags are set up as
> >         h6 - span - Trigger title - /span - /h6
>
> > I want to add a class to the current h6 tag that will result in an
> > "open folder" image to appear next to tag when its associated fieldset
> > is open, and have that class removed when it or another h6 tag is
> > clicked.
>
> > I can add the class easily enough - but I can't work out the code/
> > selectors to remove the class when the clicked current trigger title
> > is re-clicked (to close the fieldset) or another trigger title is
> > clicked (to open its associated fieldset.
>
> > $('.accord > h6').click(function() {
> >         $(this).addClass('expand_group');
> >         $(this).next('fieldset').slideToggle('fast').siblings
> > ('fieldset:visible').slideUp('fast');
>
> > });
>
> > I'd  really appreciate some direction to a solution if possible.
>
> > Thanks, Bruce


[jQuery] Accordion, fieldset and selectors question

2009-11-26 Thread Bruce MacKay
Hello folks,

I have an operational accordion based on a series of fieldset tags
(the content) and h6 tags (the triggers).

It is initiated by:

$('.accord > h6').click(function() {
$(this).next('fieldset').slideToggle('fast').siblings
('fieldset:visible').slideUp('fast');
});

The trigger tags are set up as
h6 - span - Trigger title - /span - /h6

I want to add a class to the current h6 tag that will result in an
"open folder" image to appear next to tag when its associated fieldset
is open, and have that class removed when it or another h6 tag is
clicked.

I can add the class easily enough - but I can't work out the code/
selectors to remove the class when the clicked current trigger title
is re-clicked (to close the fieldset) or another trigger title is
clicked (to open its associated fieldset.

$('.accord > h6').click(function() {
$(this).addClass('expand_group');
$(this).next('fieldset').slideToggle('fast').siblings
('fieldset:visible').slideUp('fast');
});

I'd  really appreciate some direction to a solution if possible.

Thanks, Bruce


[jQuery] Superfish Examples

2009-11-08 Thread Bruce A
This post is intended for the author of Superfish (Joel Birch)...

As a relative novice to css xhtml, I endeavor to research and then use
best practice code wherever I can.
It helps me to not get into any bad habits and to see how things
'should be done'.
Necessarily this implies I may not be the author of the code. This has
led me to want to use Superfish, as it seems to have a venerable
heritage (through suckerfish) and great standards compliance.

However, as a beginner I would like to point out that it would be
extremely helpful to have access to examples of the code in action.
While you have your own much appreciated examples, I would love to see
various Superfish implementations 'in the wild'.

Would it be possible to have a section on your website where examples
of superfish sites could be posted?

Thanks for writing such great code!


Re: [jQuery] Re: SimpleModal problem in IE7

2009-11-01 Thread Bruce MacKay
Excellent - Thanks very much Eric, I appreciate your attention to 
this - I rely on your brilliant plugin on several sites.


Cheers, Bruce


At 02:45 a.m. 31/10/2009, you wrote:

I fixed the issue and released 1.3.3[1]. I updated the demo downloads,
but all you need to do is use the newest version of SimpleModal.

-Eric

[1] http://code.google.com/p/simplemodal/downloads/list

On Oct 30, 6:20 am, Eric Martin  wrote:
> Bruce,
>
> Thanks for reporting the issue. I was able to reproduce the issue and
> will work on a fix.
>
> -Eruc
>
> On Oct 29, 10:51 pm, Bruce MacKay  wrote:
>
> > Hi folks,
>
> > I've just updated a previously functioning piece of code that uses
> > the simplemodal plugin - the code does an ajax call to a file
> > containing a email form and loads it into a modal layer.
>
> > The code now longer works in IE7 using the latest version of
> > simplemodal
> > (http://www.ericmmartin.com/simplemodal-1-3-2-released/)  - I notice
> > that the "contact form" example at eric's site
> > (http://www.ericmmartin.com/projects/simplemodal-demos/-from which
> > I developed my code) no longer works either - the modal layer is
> > formed but the content is garbled, just as it occurs with mine.
>
> > Anyone else noticed this problem?
>
> > Thanks,
>
> > Bruce





[jQuery] SimpleModal problem in IE7

2009-10-29 Thread Bruce MacKay

Hi folks,

I've just updated a previously functioning piece of code that uses 
the simplemodal plugin - the code does an ajax call to a file 
containing a email form and loads it into a modal layer.


The code now longer works in IE7 using the latest version of 
simplemodal 
(http://www.ericmmartin.com/simplemodal-1-3-2-released/)  - I notice 
that the "contact form" example at eric's site 
(http://www.ericmmartin.com/projects/simplemodal-demos/ - from which 
I developed my code) no longer works either - the modal layer is 
formed but the content is garbled, just as it occurs with mine.


Anyone else noticed this problem?

Thanks,

Bruce




[jQuery] Superfish - arrows & top menu width

2009-10-25 Thread Bruce A

Apologies if this is a css issue and I am barking up the wrong tree...

It seems to me that the arrows which are added create an additional
width on the menu elements.

I would like to specify a fixed width for the top elements in my menu.
It appears that the arrows are added automagically by the JS (neat!).
I am guessing they are an additional width to anything specified in
the skin css.

Is there any way to use the arrows but to reserve space for the arrow
width, so it doesn't change the top level menu width?
I would like to be able to use a fixed width, so that I can use a non-
repeating css background image.
To complicate matters, I am using Supersubs (maybe I should be using
the standard superfish?)

Thanks to the developer for producing this cool bit of code!


[jQuery] Printing contents of a tab within a lightbox-clone

2009-09-05 Thread Bruce MacKay


Hello folks,

I'm having difficulty getting the contents of a particular tab within 
a jquery-ui Tabs collection that is present in a "lightbox" (Fancybox)


My print.css sheet is:

html, body {
display:block;
}
body * {
display:none;
}
#printresults {
display:block!important;
opacity:1.0!important;
}

#printresults is the div within a tab that I want printed.  But when 
I print (via an 'a' tag window.print() link) I get a magnificient blank page.


Ideas/solutions/leads?

Thanks/Bruce




[jQuery] Re: toggle and logic confusion

2009-08-12 Thread Bruce MacKay


Yes, you are right - what I described was like an accordion, but I 
left out the description of the actual links on which the div's are 
opened/closed.


The links exist as 3 buttons in a horizontal list that remains 
stationery while the divs open/close beneath them.


This UI makes what I'm trying to do not an accordion.

Thanks for your input, nevertheless.

Bruce

At 09:32 p.m. 12/08/2009, you wrote:


Hi Bruce

are trying to do something like an accordion.

http://jqueryui.com/demos/accordion/

I tried to do what you described a few days ago and then found the
jquery UI at the above link.

On Aug 12, 10:00 am, Bruce MacKay  wrote:
> Hi folks,
>
> I have a set of 3 divs with a class element of "hideme".   Through
> the code that follows (it's not mine; it works!), I can click a
> dedicated a.tag for each div to toggle the visibility (or not) of the
> contents of the associated div.
>
> What I'd like to be able to achieve is that if say, div#1 was visible
> and the user clicked the a tag for div#2, then div#1 would disappear
> and div#2 appear in its place.
>
> The code in the inserted line #5 allows me to achieve this slightly,
> but it requires the associated a tag link to be double clicked in
> order for their associated div to become visible and the currently
> visible div to be hidden.
>
> I'd appreciate someone illuminating a path to a solution for me.
>
> Thanks/Bruce
>
> 1$('#fsheet').find('.hideme').hide().end();
> 2$('a.showme').each(function(i) {
> 3   var $match =
> $('div.hideme').eq(i);
> 4   $(this).toggle(function() {
> 5   //  $('div.hideme:not(eq(i))').hide('slow');
> 6   $match.show('slow');
> 7   }, function () {
> 8   $match.hide('slow');
> 9   }
> 10  );
> 11});





[jQuery] toggle and logic confusion

2009-08-12 Thread Bruce MacKay

Hi folks,

I have a set of 3 divs with a class element of "hideme".   Through 
the code that follows (it's not mine; it works!), I can click a 
dedicated a.tag for each div to toggle the visibility (or not) of the 
contents of the associated div.


What I'd like to be able to achieve is that if say, div#1 was visible 
and the user clicked the a tag for div#2, then div#1 would disappear 
and div#2 appear in its place.


The code in the inserted line #5 allows me to achieve this slightly, 
but it requires the associated a tag link to be double clicked in 
order for their associated div to become visible and the currently 
visible div to be hidden.


I'd appreciate someone illuminating a path to a solution for me.

Thanks/Bruce


1$('#fsheet').find('.hideme').hide().end();
2$('a.showme').each(function(i) {
3   var $match = 
$('div.hideme').eq(i);

4   $(this).toggle(function() {
5   //  $('div.hideme:not(eq(i))').hide('slow');
6   $match.show('slow');
7   }, function () {
8   $match.hide('slow');
9   }
10  );
11});   

[jQuery] Re: Identifying the type of parent

2009-06-30 Thread Bruce MacKay

The answer I needed - and found in the jQuery documents - was

var parentTag = $('#'+ni).parent().get(0).tagName;

I should have looked more closely sooner.

Cheers,
Bruce



At 04:58 p.m. 30/06/2009, you wrote:

Hello folks,

I have a function, triggered when a particular type of link is 
clicked, which collects and inserts some text after the parent of 
the clicked link.


This function works fine when the parent is a p tag, but I'm having 
trouble when the link is within a list tag.  In this instance I 
would want the new text to be presented after the closing list item tag.


How do can I distinguish whether the clicked link is within a p tag 
or within an li tag?


Thanks,

Bruce


function fnGetSnippet(ni){
$.get("../scripts/ajax_fsheets.asp?id=getDD&ddID=" + ni + "&q=" 
+ new Date().getTime(), function(responseText){

$('#'+ni).parent().after(responseText);
$('#'+ni).unbind('click.drill').addClass('showme');
var $match = $('#hide'+ni);
$('#'+ni+'.showme').toggle(function() {
$match.fadeOut('slow');
}, function () {
$match.fadeIn('slow');
}
);
});
}


[jQuery] Identifying the type of parent

2009-06-29 Thread Bruce MacKay

Hello folks,

I have a function, triggered when a particular type of link is 
clicked, which collects and inserts some text after the parent of the 
clicked link.


This function works fine when the parent is a p tag, but I'm having 
trouble when the link is within a list tag.  In this instance I would 
want the new text to be presented after the closing list item tag.


How do can I distinguish whether the clicked link is within a p tag 
or within an li tag?


Thanks,

Bruce


function fnGetSnippet(ni){
$.get("../scripts/ajax_fsheets.asp?id=getDD&ddID=" + ni + "&q=" 
+ new Date().getTime(), function(responseText){

$('#'+ni).parent().after(responseText);
$('#'+ni).unbind('click.drill').addClass('showme');
var $match = $('#hide'+ni);
$('#'+ni+'.showme').toggle(function() {
$match.fadeOut('slow');
}, function () {
$match.fadeIn('slow');
}
);
});
} 

[jQuery] Re: Removing an emptied paragraph from the DOM

2009-06-20 Thread Bruce MacKay
Thanks Mauricio, I hadn't tried that angle, but 
unfortunately it didn't make any difference.


I've also tried adding a class to the initial 
parent p and then trying to remove all paragraphs 
containing that class name - and have achieved the same nil outcome.


Thanks for your input.

Cheers, Bruce


At 11:40 p.m. 20/06/2009, you wrote:

How about?

$('.buggybox').next('p').remove();

Maurício
-Mensagem Original-
De: <mailto:b.mac...@massey.ac.nz>Bruce MacKay
Para: <mailto:jquery-en@googlegroups.com>jquery-en@googlegroups.com
Enviada em: sábado, 20 de junho de 2009 08:20
Assunto: [jQuery] Removing an emptied paragraph from the DOM

Hello folks,

I have an application which removes an image 
from within a paragraph, wraps that image in a 
div and places it in front of the paragraph.


I now want to remove that paragraph.

Why doesn't the following use of remove() not 
achieve my objective?  I've tested the length - 
it is 0, yet the remove doesn't happen.


Thanks, Bruce


var parnt = $(this).parent();   //the 
parent p tag containing the image to be processed
$(this).insertBefore(p).wrap("class='buggybox clearfix' id='g" + i +"'>");


if (parnt.length=0) {
parnt.remove();
}


[jQuery] Removing an emptied paragraph from the DOM

2009-06-20 Thread Bruce MacKay

Hello folks,

I have an application which removes an image from within a paragraph, 
wraps that image in a div and places it in front of the paragraph.


I now want to remove that paragraph.

Why doesn't the following use of remove() not achieve my 
objective?  I've tested the length - it is 0, yet the remove doesn't happen.


Thanks, Bruce


var parnt = $(this).parent();   //the parent p tag containing 
the image to be processed
$(this).insertBefore(p).wrap("");


if (parnt.length=0) {
parnt.remove();
} 

[jQuery] History and ajax has me stuck

2009-06-16 Thread Bruce MacKay

Hi folks,

I'm having difficulty understanding how to get Klaus's history plugin 
working in my application.I have an "ebook" application in which 
the page has a static index of pages which, when an individual link 
is clicked, a file is loaded into an adjacent div (#ebook).


Upon being loaded, the file is scanned and any a.linkto tags are 
scanned for as these tags are my "between" page links which I was 
hoping to get the history plugin to capture and do its magic.  Once 
found, the a.linkto tags are prepared - as far as I can understand - 
for the history plugin.  However, my attempt has gone all pear-shaped 
and I cannot find any reference/article/documentation via Google to 
help me see my error.


What tends to happen is that upon clicking an a.link from within 
#ebook, a copy of the entire current page, sans the targetted page, 
is loaded into #ebook.


Any help would be appreciated - even if it is a suggestion to try a 
different approach.


Thanks, Bruce

$(document).ready(function() {
$.ajaxHistory.initialize();
var pgname = $('a.eb0').attr('id');
fnGetEbookFile(pgname);
});

function fnGetEbookFile(pgname){
$.get('textfiles/' + pgname + '.html?q=' + new 
Date().getTime(),function(txt){

$("#ebook").html(txt).show();
$('a').each(function() {
var $a = $(this);
var theid = $a.attr('id');
var q = $a.attr('class');
if (q=='linkto') {
$a.attr("id",'#textfiles/' + theid + 
'.html').remote('#ebook').bind("click",function() 
{fnGetEbookFile(theid);});

};
});
});
}; 

[jQuery] Re: Moving a div container from within to before a p container

2009-06-08 Thread Bruce MacKay

Thank you all for your input into this query.

@Jack - I appreciate your guidance re style
@mkmanning - thanks for your solution - it lead me to one I needed; 
due to my poor description, your solution (as I read it) took ALL the 
content of the parent p, wrapped it  in the div and inserted it 
before the parent p.  I actually wanted the text (not the caption) to 
remain in the p tag and while I tried to filter just the image and 
the caption via the children() call (i.e. .children("img, 
p.imgcaption")) I couldn't get it to work.


Finally, I settled to focus first on the image and move it, and then 
wrap it and insert its caption.


function fnDoImages() {
$('img.imgposl,img.imgposr,img.imgposc,img.tblposl,img.tblposr,img.tblposc').each(function(i) 
{
var p = $(this).parent();   //the parent 
p tag containing the image to be processed
$(this).insertBefore(p).wrap("");
var alt = 
$(this).attr('alt');  //alt tag on image
var thg = 
$(this).attr('class').substr(0,3);//table or image
var postn = 
$(this).attr('class').substr(6);//position of thg - l, r, or c
var title = 
$(this).attr('title');  //image caption or table 
title is in the title
var width = 
$(this).attr('width');  //width of image

if (alt.length=0) {
$(this).attr('alt',''+ title +'');
}
if (thg == 'tbl' && title.length>0) {
$(this).before("" + title + "");

} else if (title.length>0){
$(this).after("" + title + "");

};
$("#g"+i).addClass("img" + postn).css({width:width + 'px'});
});
}

Thanks again,

Bruce


 At 11:14 a.m. 7/06/2009, you wrote:


Waseem's answer doesn't look good for a couple reasons, most
importantly calling obj.remove(). That will delete the image from the
DOM, which renders every action before it pretty useless :P

It also doesn't take into account the OP's request to also include the
caption text if it exists.

Try this to get familiar with chaining and manipulation:
$('p').wrapInner('').children().insertBefore($('p'));

If you're working from having a reference to the image (where this ==
your image):
var p = $(this).parent();
p.wrapInner('').children().insertBefore(p);

HTH

On Jun 6, 3:48 pm, infoaddicted  wrote:
> wasseem's answer looks good, I'd just like to off a little friendly
> advice on coding style, advice meant to make revisiting
> your own code in the future easier as well as making it under-
> standable to others.
>
> in a block like:
>
> {
> var a= $(this).attr('alt');
> ...
> }
>
> consider using more user friendly variables names, like
>
> var alt = ...
> var substr_1 = ...
>
> and putting spaces around operators like the concatenation
>
> "foo" + "bar"
>
> the few bytes added to your code size is a very small percentage
> of your total page size.
>
> You can find a lot of good advice in the same vein here:
>
> Code Conventions for the JavaScript Programming Language
>  -http://javascript.crockford.com/code.html
>
> On Jun 6, 5:11 pm, Bruce MacKay  wrote:
>
> > Hi folks,
>
> > The following function takes an image tag (or table) that appears
> > within a p tag container in the form
> > < p>  text < /p>
>
> > and wraps the image (and caption if a title is present) into a div
> > for floating left, right, or centering.
>
> > My problem is that I don't know how to shift the processed image from
> > within the p container to immediately before it (so that the created
> > div is not within a p container)
>
> > I'd appreciate help in this next step.
>
> > Thanks,
>
> > Bruce
>
> > function fnDoImages() {
> > 
$('img.imgposl,img.imgposr,img.imgposc,img.tblposl,img.tblposr,img.tblposc' 
).each(function(i)

> > {
> >  var a = $(this).attr('alt');
> >  var q = $(this).attr('class').substr(0,3);
> >  var p = $(this).attr('class').substr(6);
> >  var t = $(this).attr('title');
> >  var w = $(this).attr('width');
> >  if (a.length=0) {
> >  $(this).attr('alt',''+t+'');
> >  }
> >  $(this).wrap(" > id='g"+i+"'>");
> >  if (q=='tbl' && t.length>0) {
> >  $(this).before(" > style='width:"+w+"px;'>"+t+"");
> >  } else if (t.length>0){
> >  //$(this).after(" > style='width:"+w+"px;'>"+t+"");
> >  };
> >  $("#g"+i).addClass("img"+p).css({width:w+'px'});
> >  });
>
> > }


[jQuery] Moving a div container from within to before a p container

2009-06-06 Thread Bruce MacKay

Hi folks,

The following function takes an image tag (or table) that appears 
within a p tag container in the form

< p>  text < /p>

and wraps the image (and caption if a title is present) into a div 
for floating left, right, or centering.


My problem is that I don't know how to shift the processed image from 
within the p container to immediately before it (so that the created 
div is not within a p container)


I'd appreciate help in this next step.

Thanks,

Bruce

function fnDoImages() {
$('img.imgposl,img.imgposr,img.imgposc,img.tblposl,img.tblposr,img.tblposc').each(function(i) 
{

var a = $(this).attr('alt');
var q = $(this).attr('class').substr(0,3);
var p = $(this).attr('class').substr(6);
var t = $(this).attr('title');
var w = $(this).attr('width');
if (a.length=0) {
$(this).attr('alt',''+t+'');
}
$(this).wrap("id='g"+i+"'>");

if (q=='tbl' && t.length>0) {
$(this).before("style='width:"+w+"px;'>"+t+"");

} else if (t.length>0){
//$(this).after("style='width:"+w+"px;'>"+t+"");

};
$("#g"+i).addClass("img"+p).css({width:w+'px'});
});

}


[jQuery] Re: this.appendChild(E) error

2009-04-19 Thread Bruce MacKay

Thanks Jordon - but alas this adjustment made no difference to IE.

Bruce


At 09:57 a.m. 20/04/2009, you wrote:

Try doing $("#editorbox").fadeIn(500).html(field.doeditor);

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] 
On Behalf Of Bruce MacKay

Sent: Sunday, April 19, 2009 4:16 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] this.appendChild(E) error

Hello folks,

I'm getting an IE-only error (IE6/7) on a page for which I cannot 
find a solution.  IE reports an error (Unexpected call to method or 
property access) at line 12.  The Script Debugger is pointing to 
"this.appendChild(E) " in jquery (v1.3.2 rev. 6246).


The context of the code is below - IE chokes at the line 
indicated.  I have loaded the json field 'doeditor' with nothing and 
with simple text and the error is still thrown, so I don't believe 
it is anything in the field per se that is causing the problem.


Any directions gratefully accepted.

Thanks,
Bruce

function showResponse(json) {
if (json.fields) {
$("#busy").hide();
for (var i = 0; i < json.fields.length; i++) {
var field = json.fields[i];
switch(field.zone) {
case "newtext":
switch(field.yesno) {
case "Y":
 $('#newfile,#sidebar,#selectlist,#archiveOff').hide();

$('#contentwrapper').css('background-image','url(images/blank.gif)');
-->   $("#editorbox").html(field.doeditor).fadeIn(500);
 $("#editor > ul").tabs({fxFade: true, fxSpeed: "fast",selected: 1});

$("a.showarchive").bind("click",function(){getArchive(this.id);return false});
 setTinyMCE('400px');
 var options = {dataType: 'json', beforeSubmit: 
showRequest,success: showResponse};
 $('#editor_form').submit(function() 
{tinyMCE.triggerSave();$(this).ajaxSubmit(options);return false;});

break;
case "N":

$("#addnewpage").animate({backgroundColor:'red'},2000).animate({backgroundColor:'#FFF'},1000);
 $("#xfback").html(field.msg);
}
break;
[snip]


[jQuery] this.appendChild(E) error

2009-04-19 Thread Bruce MacKay

Hello folks,

I'm getting an IE-only error (IE6/7) on a page for which I cannot 
find a solution.  IE reports an error (Unexpected call to method or 
property access) at line 12.  The Script Debugger is pointing to 
"this.appendChild(E) " in jquery (v1.3.2 rev. 6246).


The context of the code is below - IE chokes at the line 
indicated.  I have loaded the json field 'doeditor' with nothing and 
with simple text and the error is still thrown, so I don't believe it 
is anything in the field per se that is causing the problem.


Any directions gratefully accepted.

Thanks,
Bruce

function showResponse(json) {
if (json.fields) {
$("#busy").hide();
for (var i = 0; i < json.fields.length; i++) {
var field = json.fields[i];
switch(field.zone) {
case "newtext":
switch(field.yesno) {
case "Y":
 $('#newfile,#sidebar,#selectlist,#archiveOff').hide();
 $('#contentwrapper').css('background-image','url(images/blank.gif)');
-->   $("#editorbox").html(field.doeditor).fadeIn(500);
 $("#editor > ul").tabs({fxFade: true, fxSpeed: "fast",selected: 1});
 $("a.showarchive").bind("click",function(){getArchive(this.id);return 
false});

 setTinyMCE('400px');
 var options = {dataType: 'json', beforeSubmit: 
showRequest,success: showResponse};
 $('#editor_form').submit(function() 
{tinyMCE.triggerSave();$(this).ajaxSubmit(options);return false;});

break;
case "N":

$("#addnewpage").animate({backgroundColor:'red'},2000).animate({backgroundColor:'#FFF'},1000);
$("#xfback").html(field.msg);
}
break;
[snip]


[jQuery] [Quite OT] charsets, chr values, & errant characters

2009-03-09 Thread Bruce MacKay


My apologies in advance for posting this question here - but I feel 
I've exhausted other avenues available/known to me and I don't know 
where else to seek help.  Even direction to more appropriate forums 
to post such a query would be very helpful.


I'm having difficulty identifying a strange character that is being 
entered by forum users through a WYSIWIG editor (tinyMCE) running on 
a MS ASP site with an Access database.


The character appears as a box in IE and diamond/question mark in FF.

I've tried the following attempted fixes:
1. I've changed the charset from iso-8859-1 to UTF-8 without success. 
(see http://lifewriting226.massey.ac.nz/dumpthis.asp  (iso-8859-1 
charset) and http://lifewriting226.massey.ac.nz/dumpthis2.asp (UTF-8 charset).

2. I've added 'accept-charset="UTF-8"' to the form - without success.
3. I've made sure that the charset meta tag comes immediately after 
the head statement - no improvement.
4. I've tried to identify the chr() value of the character.  However, 
when I load an "infected" file into a hex viewer, 3 characters 
'occupy' the space of the character - EF BF BD - but when I enter 
their chr() equivalents - 239, 191, 189 - in a 'search and destroy' 
operation, I cannot erase the character.

5. I've changed the WYSIWIG editor but still get the problem.
6. I've tried Experts Exchange for a solution without success.

This character seems to be mainly associated with either a space 
character - if I use the spacebar to insert two spaces between a word 
then one of those spaces is often 'translated' into the errant 
character - or if I add a blank line between two paragraphs - the 
character will appear between the p tags of the blank line that the 
editor inserts.


How can I solve this problem?  How can I identify the character so 
that I can strip it out of the data stream before it is stored?


Thanks - Bruce




[jQuery] Re: Cancelling the behaviour of a link-initiated function

2009-02-26 Thread Bruce MacKay
I found a solution (thanks to Steven Bristol - 
http://codesnippets.joyent.com/posts/show/1345 - )...

which namespaced the click event.

Then, but detailing the id of the a tag you want to "cancel", you can 
unbind the behaviour from that link (id) and that link only.



$(document).ready(function() {
$('a.txtload').bind("click.txtload",function() {
var target = $(this).attr('id');
fnGetEbookFile(target);
$('#'+target).unbind('click.txtload');
});

});

Cheers,
Bruce



At 03:39 p.m. 26/02/2009, you wrote:

Hi folks,

I'm after some help/ideas of how to link a couple of "things" together.

I have a page which holds several pieces of text that are hidden on 
pageload.  These are toggled into and out of view via a function 
tied to an a.showme class combo.


I also have functionality to load content into the page via an ajax 
call after page load.  I bind an a.txtload combo to a function that 
loads the content.


In some instances I have both classes ('showme' and 'txtload') on 
the same link - I want to load material in on a link click and then 
reveal that material.


Thus far fine.

My problem is that when I click the a tag to toggle the newly 
inserted text out of view, I also initiate another AJAX call.


How can I set things up that once material is loaded via ajax, it 
won't be loaded again when the link is clicked?


I tried adding $(this).removeClass('txtload'); before the call to 
fnGetEbookFile (line 2 of the code below)  to remove the txtload 
from the specific link that has been clicked, but despite Firebug 
showing that the class has been removed, its behaviour on that link continues.


Thanks,

Bruce



$(document).ready(function() {

$('a.txtload').bind("click",function()
{fnGetEbookFile($(this).attr('id'));});

$('#main').find('.hideme').fadeOut().end();
$('a.showme').each(function(i) {
var $match = 
$('.hideme').eq(i);

$(this).toggle(function() {
$match.fadeIn('slow');
}, function () {
$match.fadeOut('slow');
}
);
});
});


function fnGetEbookFile(ni){
$.ajax({
url: 'textfiles/'+ni+'.txt',
type: 'GET',
cache: false,
dataType: 'html',
timeout: 5000,
success: function(responsetxt){
$('#'+ni).html('');
$('#'+ni).append(responsetxt);
}
});
}


[jQuery] Cancelling the behaviour of a link-initiated function

2009-02-25 Thread Bruce MacKay

Hi folks,

I'm after some help/ideas of how to link a couple of "things" together.

I have a page which holds several pieces of text that are hidden on 
pageload.  These are toggled into and out of view via a function tied 
to an a.showme class combo.


I also have functionality to load content into the page via an ajax 
call after page load.  I bind an a.txtload combo to a function that 
loads the content.


In some instances I have both classes ('showme' and 'txtload') on the 
same link - I want to load material in on a link click and then 
reveal that material.


Thus far fine.

My problem is that when I click the a tag to toggle the newly 
inserted text out of view, I also initiate another AJAX call.


How can I set things up that once material is loaded via ajax, it 
won't be loaded again when the link is clicked?


I tried adding $(this).removeClass('txtload'); before the call to 
fnGetEbookFile (line 2 of the code below)  to remove the txtload from 
the specific link that has been clicked, but despite Firebug showing 
that the class has been removed, its behaviour on that link continues.


Thanks,

Bruce


$(document).ready(function() {
$('a.txtload').bind("click",function() 
{fnGetEbookFile($(this).attr('id'));});


$('#main').find('.hideme').fadeOut().end();
$('a.showme').each(function(i) {
var $match = 
$('.hideme').eq(i);

$(this).toggle(function() {
$match.fadeIn('slow');
}, function () {
$match.fadeOut('slow');
}
);
});
});


function fnGetEbookFile(ni){
$.ajax({
url: 'textfiles/'+ni+'.txt',
type: 'GET',
cache: false,
dataType: 'html',
timeout: 5000,
success: function(responsetxt){
$('#'+ni).html('');
$('#'+ni).append(responsetxt);
}
});
}  

[jQuery] testing

2009-02-19 Thread bruce

sorry for the test guys!!


[jQuery] Re: Duplicating the last row of a table

2009-02-12 Thread Bruce MacKay


Thanks RobG - sorry about the layout - I didn't send it like it 
appeared.  I didn't notice the missing tr tags and wouldn't have 
thought of the tbody + id solution.


Cheers, Bruce



At 06:48 p.m. 13/02/2009, you wrote:




On Feb 13, 1:36 pm, Bruce MacKay  wrote:
> Hello folks,
>
> The code and HTML below are from a quiz editor - I have an onClick
> function that fires duplicateRow to add another question box onto the
> end of the table.

Posted code should be formatted to be as easily read and understood as
possible, yours isn't.


> Firefox does what I expect to happen - it selects the last 
> row.  IE7 and Safari, on the other hand, appear to treat the 
> as the last tr in the table.

Your markup is invalid.  Even allowing for accidental omission of the
opening table tag, there is no tr tag in the tfoot element so you are
depending on error correction - all bets are off as to the DOM
structure that will result from that.


> Is there a way to satisfy the interpretation of all three browsers?

Yes, use valid markup.  You will then discover that Firefox does what
Safari and IE are doing - duplicating the last row of the tfoot (which
is the last row of the table). To fix that, add tbody tags in the
markup and move the table's id to the tbody.


--
Rob





[jQuery] Duplicating the last row of a table

2009-02-12 Thread Bruce MacKay

Hello folks,

The code and HTML below are from a quiz editor - I have an onClick 
function that fires duplicateRow to add another question box onto the 
end of the table.


Firefox does what I expect to happen - it selects the last  
row.  IE7 and Safari, on the other hand, appear to treat the  
as the last tr in the table.


Is there a way to satisfy the interpretation of all three browsers?

Thanks,

Bruce


function duplicateRow(){
var clonedRow = $("#question_table tr:last").clone();
var iRowID =  parseFloat(clonedRow.attr("id").replace('t',''));
iNewID = iRowID + 1;
$("#bc"+ iRowID , clonedRow).attr( { "id" : "bc" + 
iNewID,"name" : "correctans" + iNewID, "checked":false } );
$("#lba"+ iRowID , clonedRow).attr( { "id" : "lba" + 
iNewID,"for" : "theans" + iNewID } );
$("#lbb"+ iRowID , clonedRow).attr( { "id" : "lbb" + 
iNewID,"for" : "bc" + iNewID } );
$("#lbc"+ iRowID , clonedRow).attr( { "id" : "lbc" + 
iNewID,"for" : "fb" + iNewID } );

$("#sL"+ iRowID , clonedRow).attr( { "id" : "sL" + iNewID} );
$("#fb"+ iRowID , clonedRow).attr( { "id" : "fb" + 
iNewID,"name" : "feedback" + iNewID, "value":"" } );
$("#theans"+ iRowID , clonedRow).attr( { "id" : "theans" + 
iNewID,"name" : "answer" + iNewID, "value":""} );

$("#question_table").append(clonedRow);
$("#question_table tr:last").attr( "id", "t" + iNewID);
$("#sL"+iNewID).html("Answer "+parseFloat(iNewID+1));
$("#noptions").attr({"value":iNewID});
};


id="lba4" for="theans4">Answer 
5class="qinput30">lateral buds onlyclass="label7" for="bc4" id="lbb4">Correct?name="correctans4" id="bc4" value="1" type="checkbox">id="lbc4" class="label7" 
for="fb4">Feedback(standard)name="feedback4" id="fb4" class="qinput30">while they do occur in 
axillary/lateral buds, they also occur at terminal 
budstitle="Add more options to this question">class="timg" alt="Add more options" width="16" height="16"> Add 
more possible answers




[jQuery] Re: I can't get Shadowbox to fire!

2009-02-07 Thread Bruce MacKay


That's strange - Firebug is not displaying any error messages here.

I've "turned on" a load-the-language command - it's made no 
difference to my display - what about from your end?


Cheers,

Bruce


At 11:20 p.m. 7/02/2009, you wrote:


I'm getting "No Shadowbox language loaded" error message!


Read jQuery HowTo Resource  -  http://jquery-howto.blogspot.com



On Sat, Feb 7, 2009 at 2:54 PM, Bruce MacKay  wrote:
>
> Hi folks,
>
> I've tried a zillion combinations but I can't find the one that will make
> Shadowbox (http://mjijackson.com/shadowbox/index.html) fire.
>
> I am running jQuery 1.3.1 and Shadowbox v2.
>
> Would someone mind checking out my test page at
> http://horticulture127.massey.ac.nz/dumpthis.htm and letting me know what
> I'd doing wrong.  For example, clicking on the "site" hyperlink 
should bring

> up a Shadowbox containing an image - I just get a new page containing the
> image
>
> Thanks
>
> Bruce
>
>
>





[jQuery] I can't get Shadowbox to fire!

2009-02-07 Thread Bruce MacKay


Hi folks,

I've tried a zillion combinations but I can't find the one that will 
make Shadowbox (http://mjijackson.com/shadowbox/index.html) fire.


I am running jQuery 1.3.1 and Shadowbox v2.

Would someone mind checking out my test page at 
http://horticulture127.massey.ac.nz/dumpthis.htm and letting me know 
what I'd doing wrong.  For example, clicking on the "site" hyperlink 
should bring up a Shadowbox containing an image - I just get a new 
page containing the image


Thanks

Bruce




[jQuery] Re: the new whitehouse.gov - jQuery powered

2009-01-20 Thread bruce

hi andy...

just how do you know this are you going from the fact that there were no
actual attacks on the US? if this is the case, can we also say he kept us
safe from killer bee attacks, or from attacks of killer asteroids?

or should we blame him for the serious numbers of what i call terroristic
killings from gangs dealing drugs in our cities...

so just what is he getting the credit/blame for...

personally, i think bush was an ok guy, who got into a situation that was
way over his head... and his vp decided to start calling the plays..

without the iraq quagmire.. we don't have the financial hole we're in.. we
don't have a stack market at 8000... this is legacy baby... he has to own
it!



-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com]on
Behalf Of Andy Matthews
Sent: Tuesday, January 20, 2009 12:58 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: the new whitehouse.gov - jQuery powered



Technically only the last 6 years and 3 months.

;)

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Rick Faircloth
Sent: Tuesday, January 20, 2009 2:32 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: the new whitehouse.gov - jQuery powered


I don't appreciate the humorless disrespect, guys.

I don't know where you're from, but if you're in the US, the one thing you
can say is that "POTUS43" kept our butts safe for the last 8 years.  We'll
have to see if the new liberal in the White House has the same guts.

Now, I'll drop this, if you will.

Rick

> -Original Message-
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com]
> On Behalf Of rolfsf
> Sent: Tuesday, January 20, 2009 3:06 PM
> To: jQuery (English)
> Subject: [jQuery] Re: the new whitehouse.gov - jQuery powered
>
>
>
> $('#POTUS43').hide(fast);
>
>
> On Jan 20, 11:36 am, brian  wrote:
> > $(nation).ready(function()
> > {
> >    $('.POTUS').not('#a_jackass').change();
> >
> > });
> > On Tue, Jan 20, 2009 at 2:21 PM, rolfsf  wrote:
> >
> > > I just noticed that team Obama pushed a new website live today -
> > > powered with jQuery!
> >
> > >http://www.whitehouse.gov




[jQuery] auto testing/parsing/scraping javascript/ajax webistes

2009-01-12 Thread bruce

Hi List!

Trying to get my head/hands around how to web scrape/test websites that use
javascript/ajax libraries...

Are there any tools/suggestions that you might suggest in this area.
Basic/initial research for google suggests that things like seamonkey,
and/or headless browser apps might work. Any
"Open Source" solutions that could be used to attack this issue would be
seriously useful.

thanks...




[jQuery] What is IE7 barfing at this js?

2008-12-29 Thread Bruce MacKay

Hi folks,

The following snippet processes a JSON string sent back to the 
browser (it is part of a poll)


function loadResults(data) {
  var OPT_VOTES = 2;
  var total_votes = 0;

  for (id in data) {
total_votes = total_votes+parseInt(data[id][OPT_VOTES]);
alert("total_votes="+total_votes+" --- " + 
data[id][OPT_VOTES]);

  }
}

The JSON string looks like this...

[["1","High cost","23","What is the biggest challenge to recycling 
irrigation water?"],["2","Disease and algae 
management","12","5"],["3","Plentiful and cheap water","8","4"]]


The problem I'm having is that IE7 appears to see 4 rows in the array 
- and consequently returns "total_votes=NaN --- undefined" at the 
first alert and "total_votes=NaN --- 23" at the second loop and so on.


FF, Opera, and Safari all handle the code without problem - can 
anyone help me understand what IE7 is getting upset about?


Thanks,

Bruce 

[jQuery] Selector difficulty/removeClass

2008-12-11 Thread Bruce MacKay


Hello folks,

I want to remove a css class (.qyes) from every label element inside 
a single div (id="quiz").


Each label element has an ID of the form "fb***" where *** represents 
a unique identifier (that is not in numerical sequence and is not 
related to the label element's position or order in the div in any way).


Can someone help me with the necessary selectors to identify the 
label elements in the div (so as to invoke a .removeClass) - I'm 
completely stumped.



Thanks,

Bruce




[jQuery] Re: .serialize and form elements in tables

2008-10-03 Thread Bruce MacKay
I haven't set breakpoints before - will follow that up now - but if 
it helps, my code is


function saveForm(ej) {
var temp=new Array();
alert(ej);
temp=ej.split('*');
var sct = temp[0];
var fID = temp[1];
alert('#'+sct);
var str = $('#'+sct).serialize();
alert(str);
$.ajax({

}

ej comes in as the id of the form and a record identifier as formID*recordID

The first two alerts are "filled" appropriately, the third one is 
empty.  Yet, if I drop the table structure around the form elements, 
everything works properly.


Thanks, Bruce


At 02:07 p.m. 4/10/2008, you wrote:


So are you calling it via $("#processthis").serialize()?

Serialize doesn't fire, you just call it. If you set a breakpoint in
Firebug in serialize, does it ever get there?


[jQuery] Re: .serialize and form elements in tables

2008-10-03 Thread Bruce MacKay


I appreciate the input (no pun intended!) but that workaround didn't 
do the job.


Cheers, Bruce


At 01:54 p.m. 4/10/2008, you wrote:


a quick workaround that springs to mind is $
("#form :input").serialize();

On Oct 3, 6:26 pm, Bruce MacKay <[EMAIL PROTECTED]> wrote:
> Hello folks,
>
> I've been successfully using .serialize() to prepare input data when
> my form has the structure
>
> Your name id="d1" type="text" name="dStartDate"> etc...
> 
>
> However, if the input elements are enclosed within a table structure
> within the form, like so ...
>
> Your
> name etc..
> 
>
> ... the serialize call doesn't do the necessary preparation - it
> doesn't appear to fire at all.
>
> There is something obviously wrong with my approach (and removing the
> table is not a solution - its use is appropriate to the contents of
> the form), but I cannot find any clues in the jQuery documents or
> this list's archives.
>
> I'd appreciate some illumination here.
>
> Thanks,
> Bruce





[jQuery] Re: .serialize and form elements in tables

2008-10-03 Thread Bruce MacKay


Thank you Dave.

The tables were formed fine (I'd checked that) but I had managed to 
include duplicate form IDs in the page and once that was fixed, the 
.serialize() is now working as expected.


Cheers,
Bruce


At 02:54 p.m. 4/10/2008, you wrote:


That code looks okay.

Have you run the HTML through the W3C validator? Maybe you're missing
a tag somewhere.





[jQuery] .serialize and form elements in tables

2008-10-03 Thread Bruce MacKay

Hello folks,

I've been successfully using .serialize() to prepare input data when 
my form has the structure


Your nameid="d1" type="text" name="dStartDate"> etc...



However, if the input elements are enclosed within a table structure 
within the form, like so ...


Your 
name etc..



... the serialize call doesn't do the necessary preparation - it 
doesn't appear to fire at all.


There is something obviously wrong with my approach (and removing the 
table is not a solution - its use is appropriate to the contents of 
the form), but I cannot find any clues in the jQuery documents or 
this list's archives.


I'd appreciate some illumination here.

Thanks,
Bruce



[jQuery] Getting the id of the next form

2008-09-30 Thread Bruce MacKay

Hello folks,

I have a page containing a number of forms e.g.


[an image]

[various form elements]




[an image]

[various form elements]



The class "ctrl_s" is bound to a function that will serialize the 
contents of the form and send the contents (via ajax) to the server 
for processing


$("a.ctrl_s").bind("click",function() {saveForm( [the id of the next 
form] );});


How do I get the "id of the next form" for sending to the "saveForm" 
function?   I'm afraid that I just don't yet understand selectors and 
traversing well enough to nut this out myself.


Thanks,

Bruce 

[jQuery] Re: [jEditable] dynamically updating a parameter value - FIXED

2008-09-29 Thread Bruce MacKay
Fixed the problem.  My earlier attempt at unbinding did not work 
because I didn't get the syntax correct - now with unbind() the 
problem is solved.


Thanks Mike for prompting me to revisit the area.

Cheers,

Bruce



At 07:43 a.m. 30/09/2008, you wrote:

Hello Mike,

I'm not sure if this is the key - if it is, then I don't know how to 
implement it.


The getDashItem function does fire after the first cycle - new 
content is loaded.  The problem is that the fID value is not 
updating in the jEditable piece of the function.


I also know the fID is being feed to the code (checked via the 
alert).  I had tried unbinding ($(".edit").unbind;) but this attempt 
(more of good intention than knowledgeable practice) did not help me.


case "Y":

$("#alerts").html(field.dash_alerts);$("#desc").html(field.dash_desc);$("#staff").html(field.dash_staff);

$("#dates").html(field.dash_dates);$("#d_title").html(field.dash_title);$("#d_outcome").html(field.dash_outcome);
alert(fID);
//$(".edit").unbind;
$(".edit").editable("scripts/ajax_tasks.asp?id=jedit&fID="+fID, {
indicator : "",
submit: 'OK',
id: 'jID',
submitdata : function() {
return {foo: fID}
},
type      : 'textarea',
width : '95%',
tooltip   : "Click to edit..."
});


At 12:51 a.m. 30/09/2008, you wrote:



On Sep 29, 2008, at 11:55 AM, Bruce MacKay wrote:

> The following function loads a div on the current page with new
> content relating to an item ID of fID (selected from a list of items
> in another div on the page).  I then use jEditable to allow the user
> to update the content of that item.  That bit works fine on the
> first cycle.
>
> However, when I select and load in another item with a different
> fID, I cannot get jEditable to update its value for fID, either in
> the URL (first arrow) or through the submitdata function (second
> arrow).


Maybe related to this:

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F 



?


--
Mika Tuupola
http://www.appelsiini.net/


[jQuery] Re: [jEditable] dynamically updating a parameter value

2008-09-29 Thread Bruce MacKay

Hello Mike,

I'm not sure if this is the key - if it is, then I don't know how to 
implement it.


The getDashItem function does fire after the first cycle - new 
content is loaded.  The problem is that the fID value is not updating 
in the jEditable piece of the function.


I also know the fID is being feed to the code (checked via the 
alert).  I had tried unbinding ($(".edit").unbind;) but this attempt 
(more of good intention than knowledgeable practice) did not help me.


case "Y":

$("#alerts").html(field.dash_alerts);$("#desc").html(field.dash_desc);$("#staff").html(field.dash_staff);

$("#dates").html(field.dash_dates);$("#d_title").html(field.dash_title);$("#d_outcome").html(field.dash_outcome);
alert(fID);
//$(".edit").unbind;
$(".edit").editable("scripts/ajax_tasks.asp?id=jedit&fID="+fID, {
indicator : "",
submit: 'OK',
id: 'jID',
submitdata : function() {
return {foo: fID}
},
type  : 'textarea',
width : '95%',
tooltip   : "Click to edit..."
});


At 12:51 a.m. 30/09/2008, you wrote:



On Sep 29, 2008, at 11:55 AM, Bruce MacKay wrote:

> The following function loads a div on the current page with new
> content relating to an item ID of fID (selected from a list of items
> in another div on the page).  I then use jEditable to allow the user
> to update the content of that item.  That bit works fine on the
> first cycle.
>
> However, when I select and load in another item with a different
> fID, I cannot get jEditable to update its value for fID, either in
> the URL (first arrow) or through the submitdata function (second
> arrow).


Maybe related to this:

http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_AJAX_request.3F

?


--
Mika Tuupola
http://www.appelsiini.net/


[jQuery] [jEditable] dynamically updating a parameter value

2008-09-29 Thread Bruce MacKay

Hello folks,

I want to dynamically update a parameter value when using jEditable.

The following function loads a div on the current page with new 
content relating to an item ID of fID (selected from a list of items 
in another div on the page).  I then use jEditable to allow the user 
to update the content of that item.  That bit works fine on the first cycle.


However, when I select and load in another item with a different fID, 
I cannot get jEditable to update its value for fID, either in the URL 
(first arrow) or through the submitdata function (second arrow).


How do I alter my function to make this possible?

function getDashItem(fID){
$.ajax({
type: 'GET',
url: "scripts/ajax_tasks.asp?id=getdashitem&fID="+fID+"&q=" 
+ new Date().getTime(),

dataType: "json",
success: function(json){
if (json.fields) {
for (var i = 0; i < json.fields.length; i++) {
var field = json.fields[i];
switch(field.yesno) {
case "Y":
   
$("#alerts").html(field.dash_alerts);$("#desc").html(field.dash_desc);
--->>> 
$(".edit").editable("scripts/ajax_tasks.asp?id=jedit&fID="+fID, {
  indicator : "src='images/indicator.gif'>",

  submit: 'OK',
  id: 'jID',
--->>>submitdata : function() {
  return {foo: fID}
  },
  type  : 'textarea',
  width   : '95%',
  tooltip   : "Click to edit..."
  });
break;
case "N":
$("#help1").html(field.message).fadeIn(500);
}
   }
}
}
});



[jQuery] Disappearing accordion elements

2008-09-08 Thread Bruce MacKay


Hi folks,

I'm having trouble with lower elements (correct usage of the term???) 
of "disappearing" under the footer div of my page.


A test page is here: 
http://www.watereducationalliance.net/technology.asp  (click on "key info")


In both IE7 and FF3, the lower two items of the accordion are not 
fully viewable, sliding in "behind" the footer.


I suspect the solution is through CSS, but my attempts at placing a 
"clear:both" styled break tag after the last item of the accordion 
has not been successful and I'm unsure how to proceed.


Ideas/suggestions/solutions gratefully accepted.

Cheers,

Bruce




[jQuery] Validating a form in a tab

2008-07-11 Thread Bruce MacKay

Hello folks,

I'm finding it difficult to get jquery.validate to work in a form 
that is within a tab.


My code is:

$("#editorbox").html(responseText).fadeIn(500);
$("#editor > ul").tabs({selected: 1,fxFade: true, fxSpeed: 
"fast"}).bind('tabsload', function(e, ui) {

 var errors = $('div.errors');
 $("#editor_form").validate();
});

This code throws no errors but also does not respond to deliberate 
validation errors entered into the input elements of the form and the 
form submitted.


Can anyone spot my error.

Thanks
Bruce 

[jQuery] Re: IE7 doesn't properly download images for jQuery cycle?

2008-07-03 Thread Bruce

 I use iQuery to ajax this abc.html:


My text

Only "My text" is loaded in to IE 7.
FF loads the image so you can see it.

This is my ajax code:   $("#dsp1").load("abc.html");

Why IE can not do this simple thing?



[jQuery] $("#dsp1").load(url) not working in IE7?

2008-07-03 Thread Bruce

I am testing jQuery. This simple code does not work in IE. This image
link  in the returned html segment is not shown in IE. Just a blank.

This is the code:

 $("#dsp1").load("abc.html");

where abc.html has this contents:



some text

IE only shows "some text".
Firefox shows everything correctly. (some text and an image that can
be clicked on).

Thanks.
Bruce



[jQuery] Re: Check if window exists before opening

2008-07-02 Thread Bruce MacKay

More searching has led me to a solution, and another question

$("a.openW").click(
 function() {
var sTarget = this.href;
if (!winRef.open){
 winRef=window.open(sTarget);
 return false;
 }else {
 winRef.focus();
 return false;
}
 });

This code does the necessary check, but it won't move focus to the 
existing opened window (that contains the help file).


What am I not doing correctly?

Thanks,

Bruce



At 01:11 p.m. 3/07/2008, you wrote:

Hello folks,

I can't find the answer I need in the archives (Nabble), so my 
question is how do I check to see if a window exists before I open it?


When a user of my application clicks on a help link, I want the help 
file to load into a new window.  I'm doing that via...


$("a.openW").click(
 function() {
 window.open(this.href); return false;
 });

But I want to first make sure that a window containing the help file 
isn't already open before a new one (another one) is opened.


Help/direction appreciated.

Thanks,

Bruce


[jQuery] Check if window exists before opening

2008-07-02 Thread Bruce MacKay

Hello folks,

I can't find the answer I need in the archives (Nabble), so my 
question is how do I check to see if a window exists before I open it?


When a user of my application clicks on a help link, I want the help 
file to load into a new window.  I'm doing that via...


$("a.openW").click(
 function() {
 window.open(this.href); return false;
 });

But I want to first make sure that a window containing the help file 
isn't already open before a new one (another one) is opened.


Help/direction appreciated.

Thanks,

Bruce 

[jQuery] Re: The Cycle plugin and "residue"

2008-07-01 Thread Bruce MacKay


Thank you Mike - and my apologies - as soon as I saw your response I 
remembered that I'd posed the same question several months ago and 
had received the solution then.  So much to remember in such little space! ;-)


Cheers,

Bruce


At 01:20 p.m. 2/07/2008, you wrote:




On Jul 1, 8:58 pm, Bruce MacKay <[EMAIL PROTECTED]> wrote:
> Hello folks,
>
> I'm using the Cycle plugin to display annotated slideshows - I'm
> having problems with "it" remembering and presenting the titles of
> previous slideshows.
>
> My sequence is this:
>
> 1. The page is loaded and the current slideshow is started
>
> $(document).ready(function() {
>  ...
>   $('#s1').cycle({fx:'fade', timeout: 8000, after: onAfter,pause:
> 1,next: '#s1',delay: -3000});
>  ...
>
> });
>
> function onAfter() {
>  $('#ssoutput').html(this.title);
>
> }
>
> 2.  If the user clicks a link of other slideshows, an ajax call
> delivers the new slideshow, complete with a new div wrapper (s1) and
> overwrites the existing slideshow.
>
> 3. The images of the second show are displayed as expected, but for
> each slide of the second show, the title of the slide and of one from
> the previous show are sequentially displayed.
>
> 4. If a third show is loaded, then for each slide of the new show,
> three titles are shown (2 of which are of the previous shows).
>
> Am I not "flushing" something properly?
>
> Thanks for any assistance,
>
> Cheers/Bruce


Bruce,

Before replacing the slideshow you should stop it.

$('#s1').cycle('stop');

That will terminate the timer associated with that slideshow.

Mike




[jQuery] The Cycle plugin and "residue"

2008-07-01 Thread Bruce MacKay

Hello folks,

I'm using the Cycle plugin to display annotated slideshows - I'm 
having problems with "it" remembering and presenting the titles of 
previous slideshows.


My sequence is this:

1. The page is loaded and the current slideshow is started

$(document).ready(function() {
...
 $('#s1').cycle({fx:'fade', timeout: 8000, after: onAfter,pause: 
1,next: '#s1',delay: -3000});

...
});

function onAfter() {
$('#ssoutput').html(this.title);
}

2.  If the user clicks a link of other slideshows, an ajax call 
delivers the new slideshow, complete with a new div wrapper (s1) and 
overwrites the existing slideshow.


3. The images of the second show are displayed as expected, but for 
each slide of the second show, the title of the slide and of one from 
the previous show are sequentially displayed.


4. If a third show is loaded, then for each slide of the new show, 
three titles are shown (2 of which are of the previous shows).



Am I not "flushing" something properly?

Thanks for any assistance,

Cheers/Bruce




[jQuery] Re: jQuery Cycle question

2008-05-27 Thread Bruce MacKay


Thanks Mike, that did solve the problem.

Cheers/Bruce


At 11:25 a.m. 28/05/2008, you wrote:


> Hello Mike,
>
> Thanks for your interest.
>
> A link is here...http://ramosus.massey.ac.nz/jQuery.htm
>
> Cheers/Bruce
>

Since the first slideshow was never explicitly stopped you actually
have two running slideshows, one of which is cycling elements that are
no longer part of the DOM.  But that first slideshow still has its
'after' callback invoked and that's why you see two captions.  More
recent versions of the Cycle plugin automatically stop a running
slideshow if you start another one on the same container, so if you
upgrade your problem should go away.

Cheers.

Mike




[jQuery] Re: jQuery Cycle question

2008-05-27 Thread Bruce MacKay


Hello Mike,

Thanks for your interest.

A link is here...
http://ramosus.massey.ac.nz/jQuery.htm

Cheers/Bruce


At 12:24 a.m. 28/05/2008, you wrote:


> In its simplest form my problem is this.  Suppose I have two
> slideshows, A and B.  Slideshow A runs properly.  However, when I
> replace slideshow A with slideshow B through an ajax call, the
> captions associated with slideshow A are also shown along with those
> of slideshow B.  The images associated with each slideshow are not
> being confounded, just the captions that are fed into the ssoutput div.

How are you "replacing" the slideshow?  Are you stopping slideshow A
before starting slideshow B?  Can you post a link?




[jQuery] Re: IE7, simple AJAX, and nothing - fixed!

2008-05-12 Thread Bruce MacKay


Sorry folks - I was looking in the wrong place - the file being 
loaded had a malformed div tag and IE7 was responding to that.


Cheers,

Bruce

 At 11:45 p.m. 12/05/2008, you wrote:


On 12 Mag, 12:57, Bruce MacKay <[EMAIL PROTECTED]> wrote:
> Hello folks,

uhm... it's kinda strange O_o
maybe this line:

>  $("#justlist,#tech").hide();

is hiding something it should not?
just guessing ^^




[jQuery] IE7, simple AJAX, and nothing!

2008-05-12 Thread Bruce MacKay

Hello folks,

I'd appreciate insight to the fault in this function which works in 
FF and Safari but not in IE7. Specifically, the returned ajax file is 
not displayed.


function fnGetEbookFile(ni){
$.ajax({
url: 'textfiles/'+ni+'.txt',
type: 'GET',
cache: false,
dataType: 'html',
timeout: 2000,
success: function(responsetxt){
$("#justlist,#tech").hide();
//alert("here " + responsetxt);
$("#stext").html(responsetxt).show();
}
});
}

As far as I can determine, the ajax call is successful - the alert 
box show the returned html - but the display within the div "stext" 
is not successful.  I can see the "stext" div in Firebug, so it is 
not as if its target doesn't exist.


Thanks,

Bruce 

[jQuery] Why won't this get the image's width?

2008-05-04 Thread Bruce MacKay

Hello folks,

This piece of code

if (($('#theImage').length>0)) {
var img_width = $('#theImage').width();
 $.log(img_width);
$("#sCaption").css("width",img_width);
};

follows an ajax call to bring content to an existing div...

$.get("scripts/ajax_ramosus_client_second.asp?brm="+ej +"&q="  + 
new Date().getTime(), function(responseText){

$("#wrapper").html(responseText);

I don't understand why the width is always being reported as 0.

The relevant portion of the HTML being returned is...

class="pad5" alt="">Lorem 
ipsum dolor sit amet, consectetuer adipiscing elit. Duis in ipsum. 
Donec faucibus sodales lacus?



Any ideas?

Is it, perhaps, that if the image hasn't loaded before the code is 
processed, then the width of theImage will be 0.  If so, how do I 
code around this issue?


Thanks,
Bruce 

[jQuery] Finding the size of an image

2008-05-02 Thread Bruce MacKay

Hello folks,

I am wanting to find the width of an image loaded via an ajax call so 
that I can alter the width of a div holding the caption for that image.


The image that is loaded is always tagged with an id of 
'theImage'.  Each image loaded with each ajax call has a slightly 
different width.


The fitCaption function below doesn't work and I don't understand why 
- can someone help me please?


function getNextPage(ej) {
$.get("scripts/ajax_ramosus_client_second.asp?brm="+ej +"&q="  + 
new Date().getTime(), function(responseText){

$("#wrapper").html(responseText);
fitCaption();
});
};

function fitCaption(){
var img_width=50;
if (($('#theImage').length>0)) {
img_width = $('#theImage').width();
};
alert (img_width);
$("#sCaption").css("width",img_width);
}

The alert call displays 0 all the time.

My mistake is???

Thanks,

Bruce 

[jQuery] loading metadata with Ajax

2008-04-19 Thread Bruce McKenzie


Hello,

I'm having trouble getting the metadata plugin to DWIW when the metadata
is loaded with Ajax.

The metadata is contained within div elements like this:

some stuff . . .
( {"keywords":["manufacturing","field 
</tt><tt>service"],"categories":["Field Service","Manufacturing"], 
</tt><tt>"industry":["Field Service"]} )



The metadata plugin handles this nicely, with or without the parens 
before and after the brackets, when loaded normally.


However, I want to grab the page with an Ajax call, delete the chrome, 
extract the HTML I want (which includes the divs with metadata) and load 
it into a tab.


When I first tried it, I got an "invalid label" error for each script. A 
Google search produced a tip suggesting surrounding the JSON with parens 
-- which solved that problem.


However, the scripts don't appear to be evaluated or recognized by the 
metadata plugin when loaded via Ajax. If I display the html in the 
Firebug console, I can see the script/json text -- but the scripts don't 
show up as objects in the DOM.


Thx for suggestions.


Bruce McKenzie



[jQuery] Re: check/uncheck via toggle

2008-04-03 Thread Bruce MacKay


Thanks all for your solution.

Just to wrap up the point that Karl raised about 
the  $(this).attr('checked', true)  part - in my earlier attempts I 
didn't have that in, but I found that clicking the check box wouldn't 
check/uncheck it by default.  The background colour change was fired, 
but the checkbox was left unchanged.


Anyway, with the solutions you kindly provided, that is now neither 
here or there.


Cheers,

Bruce



- At 03:52 p.m. 3/04/2008, you wrote:


*head smack* I missed that version of the function. It's definitely
not something I've used.

Karl Rudd

On Thu, Apr 3, 2008 at 1:47 PM, Karl Swedberg <[EMAIL PROTECTED]> wrote:
>
>  Actually, .toggle() is a little like .load() in that it can be 
used for two

> different things. There is the .toggle() effect and the .toggle(fn, fn)
> event, with the .toggle(fn, fn) doing an "every other" event thing.
>
>
>  http://docs.jquery.com/Effects/toggle
>  http://docs.jquery.com/Events/toggle#fnfn
>
>  Still, Bruce's $(this).attr('checked', true) part doesn't make much sense
> because clicking a checkbox will check/uncheck it by default. Setting the
> checked attribute only seems to make sense when it's being 
triggered by some

> other element. Or maybe I'm missing something.
>
>
>  --Karl
>  _
>  Karl Swedberg
>  www.englishrules.com
>  www.learningjquery.com
>
>
>
>
>
>  On Apr 2, 2008, at 10:23 PM, Karl Rudd wrote:
>
>
> >
> > The "toggle()" function is used to hide and show items, nothing to do
> > with clicking or changing of state.
> >
> > http://docs.jquery.com/Effects/toggle
> >
> > What you want is something like:
> >
> > $('[EMAIL PROTECTED]').click(
> >   function() {
> > if ( this.checked )
> >
> 
$(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#FFF'},1000);

> > else
> >
> 
$(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#E0F88F'},1000);

> >   }
> > );
> >
> > Karl Rudd
> >
> > On Thu, Apr 3, 2008 at 12:41 PM, Bruce MacKay <[EMAIL PROTECTED]>
> wrote:
> >
> > >
> > > Hello folks,
> > >
> > > I have a table of data, with each row containing a checkbox.  What I
> want
> > > users to be able to do is tick the box of each row of data they want to
> > > delete (and after ticking, they will submit the form etc etc.
> > >
> > > As a visual aid, I want to alter the background colour of the row - and
> if
> > > they untick a selection, to reverse that background colour change.
> > >
> > > My code as follows achieves the background colour toggle, but the
> > > checkboxes are neither checked or unchecked.
> > >
> > > I'd appreciate someone pointing out my error?
> > >
> > >
> > > $('[EMAIL PROTECTED]').toggle(
> > >function() {
> > >  $(this).attr('checked',true);
> > >
> > >
> 
$(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#FFF'},1000);

> > >},
> > >function() {
> > >  $(this).attr('checked',false);
> > >
> > >
> 
$(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#E0F88F'},1000);

> > >}
> > > );
> > >
> > > Thanks
> > > Bruce
> > >
> >
>
>




[jQuery] IE and onClick - not!

2008-04-03 Thread Bruce MacKay

Hello all,

The following function forms the first part of a two step 
confirmation sequence for deleting either a quiz or a slideshow.


The onclick element is correctly produced for the second step of confirmation.

Unfortunately, whereas FF fires the onclick event, IE7 does nothing, zip.


function confirmDel(what,where,which,ht,pb){
$("#"+where+"b").hide();
$("#"+where).fadeIn(500).css("height",""+ht+"");
switch(what) {
case "sshow":
var sWhat = 1;
break;
case "quiz":
var sWhat = 2;
break;
}
$("#"+where).find('a').eq(0).attr('onclick', 'deleteItem(' + 
which + ','+pb+',1,'+sWhat+');return false;');

};

My googling has revealed that IE has a problem with dynamically 
produced "onClicks", but that's about as far as my understanding 
goes.  Is this problem a total block and/or are there alternative 
approaches I should be taking to pass the variables to the ajax call 
that does the final deletion?


Thanks,

Bruce 

[jQuery] check/uncheck via toggle

2008-04-02 Thread Bruce MacKay

Hello folks,

I have a table of data, with each row containing a checkbox.  What I 
want users to be able to do is tick the box of each row of data they 
want to delete (and after ticking, they will submit the form etc etc.


As a visual aid, I want to alter the background colour of the row - 
and if they untick a selection, to reverse that background colour change.


My code as follows achieves the background colour toggle, but the 
checkboxes are neither checked or unchecked.


I'd appreciate someone pointing out my error?


$('[EMAIL PROTECTED]').toggle(
function() {
  $(this).attr('checked',true);
  
$(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#FFF'},1000);
},
function() {
  $(this).attr('checked',false);
  
$(this).parents('tr').animate({backgroundColor:'#9C3'},2000).animate({backgroundColor:'#E0F88F'},1000);
}
);

Thanks
Bruce 

[jQuery] Re: File uploading with the jQuery form plugin

2008-04-01 Thread Bruce MacKay


Hi Mike,

I've finally seen my problem - 6 hours after starting - the forms 
plugin that I was using was an old version.  I downloaded the most 
recent version, changed the options statement appropriately, and 
voila - the form works as expected.


Sorry for the false report.

Cheers/Bruce


At 12:08 a.m. 2/04/2008, you wrote:


>  Is there anything here that I'm overlooking?

Must be, but I don't see it either. Can you post a link?




[jQuery] File uploading with the jQuery form plugin

2008-04-01 Thread Bruce MacKay

Hello folks,

I'm having difficulty getting a successful file upload working with 
the form plugin for which I'd appreciate assistance.


My backend is ASP - I can "catch" the posted elements using 
request.form(..), but not via the objUpload object created by my 
upload program (Persits.Upload) as I would expect. I know the latter 
is "working" as I have tested to see if the object is created (it is) 
and the server side code works fine in other applications where I'm 
submitting the form back to the originating page.


When I look in the headers, I find that the content type is:
Content-Type application/x-www-form-urlencoded

Is that what it should be reporting?

My uploads form is loaded from an ajax call (getUploadInfo())...

method="post" id="upload_form" enctype="multipart/form-data">





function getUploadInfo() {
$.ajax({
type: 'GET',
url: "scripts/ajax_ramosus_editor.asp?id=36&q="  + new 
Date().getTime(),

dataType: "html",
success: function(html){
$("#ulf").html(html).show();
var options = {dataType: 'html',before: 
showUploadRequest, after: showUploadResponse};
$('#upload_form').submit(function() 
{$(this).ajaxSubmit(options);return false;});

}
});
};

Is there anything here that I'm overlooking?

Thanks,

Bruce


[jQuery] Re: A simple loop - but I can't do it

2008-03-07 Thread Bruce MacKay


Thanks Jason - appreciated.

At 03:33 p.m. 8/03/2008, you wrote:


I think you're looking for something more like this for that last bit:

$('#sshoweditor fieldset').each(function(i){
   $(this).attr('id','fs' + i);
});

- jason




On Mar 7, 8:51 pm, Bruce MacKay <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
> I have a form (id="sshoweditor") containing - let's say 6 -
> fieldsets, each containing an input element.
>
> The fieldsets have a unique ID - fs0, fs1, ... fs5.
>
> I have a function that can delete any specific fieldset.
>
> My looping problem comes now - when the fieldset is removed, I want
> to renumber the remaining fieldsets.
>
> 
$("#fs"+ej).highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'}).animate({opacity:

> 1.0}, 1000).fadeOut(500).remove();
> var n = parseInt($("#howmany").attr("value"))-1;
> $("#howmany").attr("value",n);
> var z = 0;
> $("#sshoweditor fieldset").each(function(t){
>( { "id" : "fs" + z} );
> z=z+1;
>});
>
> My code doesn't throw an error - but it doesn't produce a result
> either.  Can someone guide me here.
>
> Thanks
> Bruce




[jQuery] A simple loop - but I can't do it

2008-03-07 Thread Bruce MacKay

Hi folks,

I have a form (id="sshoweditor") containing - let's say 6 - 
fieldsets, each containing an input element.


The fieldsets have a unique ID - fs0, fs1, ... fs5.

I have a function that can delete any specific fieldset.

My looping problem comes now - when the fieldset is removed, I want 
to renumber the remaining fieldsets.


$("#fs"+ej).highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'}).animate({opacity: 
1.0}, 1000).fadeOut(500).remove();

var n = parseInt($("#howmany").attr("value"))-1;
$("#howmany").attr("value",n);
var z = 0;
$("#sshoweditor fieldset").each(function(t){
  ( { "id" : "fs" + z} );
   z=z+1;
  });

My code doesn't throw an error - but it doesn't produce a result 
either.  Can someone guide me here.


Thanks
Bruce 

[jQuery] Re: Replacing a string - why doesn't this work?

2008-02-13 Thread Bruce MacKay


Thank you Andrea for the solution - I'd never have gotten there.

Cheers, Bruce


At 10:05 p.m. 13/02/2008, you wrote:


On 13 Feb, 09:05, Bruce MacKay <[EMAIL PROTECTED]> wrote:
>  s=clonedRow;
>  var myString = 'showImageList'+iRowID;
>  var myString2 = 'showImageList'+iNewID;
>  var myString3 = s.replace(myString,myString2);
>
> The error message I get is s.replace is not a function.

I think that's because 's' is not a string.
try replacing the last 4 lines with this:

clonedRow.find('a[onclick^="showImageList"]').attr('onclick',
'showImageList(' + iNewID + ')');

OR, if the anchor that you're looking for is the only one in the
cloned fieldset

clonedRow.find('a').attr('onclick', 'showImageList(' + iNewID + ')');




[jQuery] Replacing a string - why doesn't this work?

2008-02-13 Thread Bruce MacKay

Can someone tell me/show me what I'm doing wrong here please?

I'm duplicating a fieldset that contains an input form.  However, 
within this fieldset lies the string:




var clonedRow = $( "#sshow_input fieldset:last" ).clone();
var iRowID =  parseFloat(clonedRow.attr("id").substr(-1,1));
var iCurrentOrder =  $( "#iOrder"+ iRowID , clonedRow).attr("value");
iCurrentOrder = parseFloat(iCurrentOrder);
//$.log(iCurrentOrder);
iNewID = iRowID + 1;
//$.log('iNewID=' + ' ' + iNewID );
s=clonedRow;
var myString = 'showImageList'+iRowID;
var myString2 = 'showImageList'+iNewID;
var myString3 = s.replace(myString,myString2);

The error message I get is s.replace is not a function.

Can someone spot my mistake, or suggest an alternative approach

Thanks

Bruce 

[jQuery] clone and replacing one string for another

2008-02-05 Thread Bruce MacKay


Hello folks,

I am using the .clone() method to duplicate a fieldset containing 
some form elements e.g.


var clonedRow = $( "#sshow_input fieldset:last" ).clone();

Within that cloned fieldset is a string of the form "sListImage(x)" 
where x = 1, 2, or 3 etc


With each duplication I need to increment x by 1.

I had hoped (rather than knowing) that

myString = "sListImage(3)"
myString2 = "sListImage(4)"
var clonedRow2 = clonedRow.replace(myString,myString2);

would do the trick.  But once again, my guesses are falling well 
short.  I'm being told that clonedRow.replace is not a function.


I'd appreciate some help here.

Thanks,

Bruce



[jQuery] Re: getting the ID number of a cloned table row

2008-02-05 Thread Bruce MacKay


Thanks Charles for this full and complete response - I very much appreciate it.

Cheers

Bruce

At 09:27 a.m. 6/02/2008, you wrote:


Bruce MacKay wrote:
: Hello folks,
:
: I'm trying to duplicate a row of an existing table using a function
: adapted from
: http://www.nabble.com/Add-Table-row-to12989886s27240.html#a13300133
:
: My problem is that I cannot identify the identifier of the last row
: (of the original table).

From the html you provided, this gets the last ID.

// The match should return an array with the current id in the 0
// position. The "+" sign in front converts this ID to a number.
var currentID = + $(clonedRow).find('input').attr('id').match( /\d+/
)[0];
var newID = currentID + 1;

The problem is that clone() does not work right in Internet Exploder.
There's a patch due, but no advance yet. So, the solution works on FF,
but not on IE. (http://www.fusioncube.net/?p=196)

In fact, the method above needs filter() to work on IE.

// Solution for IE.
var currentID = + $(clonedRow).filter('input').attr('id').match( /\d+/
)[0];
var newID = currentID + 1;


: function duplicateRow(){
[snip]


Manipulating the html directly probably isn't the most jQuery-ish
way to handle this.

$(clonedRow).find( '#bc' + currentID ).eq(0).attr({
id: 'bc'  + newID,
name: 'correctans' + newID
});

$(clonedRow).find( '#theans' + currentID ).eq(0).attr({
id: 'theans'  + newID,
name: 'answer' + newID
});

$(clonedRow).find( '#fb' + currentID ).eq(0).attr({
id: 'fb'  + newID,
name: 'feedback' + newID
});

// Add to the new row to the original table
$( "#myTable").append( clonedRow );





So, for now, you may need another solution besides clone().


HTH,

Charles K. Clarkson
--
Mobile Homes Specialist
Free Market Advocate
Web Programmer

254 968-8328

http://www.clarksonenergyhomes.com/wordpress/about/




[jQuery] getting the ID number of a cloned table row

2008-02-04 Thread Bruce MacKay

Hello folks,

I'm trying to duplicate a row of an existing table using a function 
adapted from 
http://www.nabble.com/Add-Table-row-to12989886s27240.html#a13300133


My problem is that I cannot identify the identifier of the last row 
(of the original table).


The last row of my table has the form:

type="checkbox">id="theans5" style="width: 250px;">rows="3" name="feedback5" id="fb5" style="width: 250px;">


The function I'm using is as follows.  Two questions:
1. I get an error at the alert - intCurrentRowID is not 
defined.  What is my error here?
2. Is there a more efficient way of writing the 4 lines starting at 
point 2 (I'm trying to re-name the feedback and answer IDs and NAMEs


function duplicateRow(){
// First, lets create the new row using the last one as template...
var clonedRow = $( "#myTable tr:last" ).clone();
// Take the current identifier, some number in the first 
cell of the row

intCurrentRowId = parseInt( $( "#bc:last", clonedRow ).html() );
1.--->  alert(intCurrentRowID);
// Set the new ID
intNewRowId = intCurrentRowId + 1;
// Change the current identifier of the row to the new one
$( "#bc:last", clonedRow ).html( intNewRowId );
// Change the Id / Name or anything you want for the new attribs
2.--->  $( "#fb"+ intCurrentRowId , clonedRow ).attr( { "id" : "fb" + 
intNewRowId} );
$( "#bc"+ intCurrentRowId , clonedRow ).attr( { "id" : "bc" 
+ intNewRowId} );
$( "#feedback"+ intCurrentRowId , clonedRow ).attr( { "name" 
: "feedback" + intNewRowId} );
$( "#answer"+ intCurrentRowId , clonedRow ).attr( { "name" : 
"answer" + intNewRowId} );


// Add to the new row to the original table
$( "#myTable").append( clonedRow );
};


Thanks,

Bruce 

[jQuery] Autogrow() "pulses" in IE7

2008-02-03 Thread Bruce MacKay


Hello folks,

Has anyone had experience with the autogrow plugin 
(http://plugins.jquery.com/project/autogrow)


It works like a dream in FF, but in IE7, the lower 10px of the 
"autogrown" textarea pulses up and down.


I'm using v1.02 of the plugin with v.1.2.3a of JQuery

Any ideas?

Thanks,

Bruce



[jQuery] Re: Shadowbox and ajax-returned content - solved

2008-01-29 Thread Bruce MacKay

... by reading Michael's docs a little more closely.

Into the document.ready block
  Shadowbox.init({
skipSetup:  true, // skip the automatic setup
});


Into the getNextPage function

Shadowbox.setup($('a.sbox'),{overlayOpacity: 0.8});


Apologies for not doing my homework properly.

Cheers,

Bruce



At 05:25 p.m. 30/01/2008, you wrote:

At 04:59 p.m. 30/01/2008, you wrote:

Any idea/suggestion to allow me to achieve what I'm seeking here?

Can you post a demo link?  That would be most helpful.


Sorry, I cannot do that for a couple of days.  Could we try it this way...

The following code retrieves new content into an existing page.

function getNextPage(ej) {
$.get("scripts/ajax_ramosus_client_second.asp?brm="+ej 
+"&q="  + new Date().getTime(), function(responseText){

Shadowbox.init();
$("#wrapper").html(responseText);
var options = {dataType: 'json', beforeSubmit: 
beforeAjax,success: afterAjax};


$('#ewlform,#quizform,#textform,#emailform,#glossform').submit(function() 
{$(this).ajaxSubmit(options); return false; });

getTWidth('#sText','#textform');
$('a.styleswitch').bind("click", 
function(){switchStylestyle(this.getAttribute("rel"));return 
false;});var c = readCookie('RamosusStyle');if (c) switchStylestyle(c);

$("a.link1").bind("click", function() {getFirstPage(this.id)});
$("a.link2").bind("click", function() {getNextPage(this.id)});
$("a.bmark").bind("click", function() {setBookmark(this.id)});
$("a.email").bind("click", function() {getEmailForm()});
$("a.emailh").bind("click", function() {hideEmailForm()});
$("a.fsize").bind("click", function() {styleCycle()});
$("a.logout").bind("click", function() {chkLogout(this.id)});
//$.log('Shadowbox');
});
};

That content contains one or two links of the form "href="an_image.jpg" rel="shadowbox">View this image"


When any of those links are clicked, the expected shadow box 
functionality is not observed.


I realise that the example on Shadow Box's web site has the "init()" 
call in the document.ready block, but that isn't applicable here 
because of the new content that is being bought into the page (I did 
try including the Shadow.init() call in the document.ready block 
when the page is first called, but that didn't make any difference 
to the final outcome)


I hope this makes my context a little clearer,

Thanks,
Bruce


[jQuery] Re: Shadowbox and ajax-returned content?

2008-01-29 Thread Bruce MacKay

At 04:59 p.m. 30/01/2008, you wrote:

Any idea/suggestion to allow me to achieve what I'm seeking here?

Can you post a demo link?  That would be most helpful.


Sorry, I cannot do that for a couple of days.  Could we try it this way...

The following code retrieves new content into an existing page.

function getNextPage(ej) {
$.get("scripts/ajax_ramosus_client_second.asp?brm="+ej +"&q="  + 
new Date().getTime(), function(responseText){

Shadowbox.init();
$("#wrapper").html(responseText);
var options = {dataType: 'json', beforeSubmit: 
beforeAjax,success: afterAjax};
$('#ewlform,#quizform,#textform,#emailform,#glossform').submit(function() 
{$(this).ajaxSubmit(options); return false; });

getTWidth('#sText','#textform');
$('a.styleswitch').bind("click", 
function(){switchStylestyle(this.getAttribute("rel"));return 
false;});var c = readCookie('RamosusStyle');if (c) switchStylestyle(c);

$("a.link1").bind("click", function() {getFirstPage(this.id)});
$("a.link2").bind("click", function() {getNextPage(this.id)});
$("a.bmark").bind("click", function() {setBookmark(this.id)});
$("a.email").bind("click", function() {getEmailForm()});
$("a.emailh").bind("click", function() {hideEmailForm()});
$("a.fsize").bind("click", function() {styleCycle()});
$("a.logout").bind("click", function() {chkLogout(this.id)});
//$.log('Shadowbox');
});
};

That content contains one or two links of the form "href="an_image.jpg" rel="shadowbox">View this image"


When any of those links are clicked, the expected shadow box 
functionality is not observed.


I realise that the example on Shadow Box's web site has the "init()" 
call in the document.ready block, but that isn't applicable here 
because of the new content that is being bought into the page (I did 
try including the Shadow.init() call in the document.ready block when 
the page is first called, but that didn't make any difference to the 
final outcome)


I hope this makes my context a little clearer,

Thanks,
Bruce



[jQuery] Shadowbox and ajax-returned content?

2008-01-29 Thread Bruce MacKay

Hello all/Michael,

I'm wanting to use Shadowbox in an application where the content of 
the page is being changed via AJAX


I have added Shadow.init(); into the callback function that is fired 
when the page's content is repopulated.   From the generated view of 
the source code, the

" "
tags are present, so presumably the Shadow.init() is being fired. 
However, this doesn't seem to be enough as the Shadowbox functions 
are not firing on the new content. I've saved one of these pages as a 
standalone HTML page and the Shadowbox functionality works as 
expected, so apparently I'm not rebinding (if that's the correct 
word) the new content to Shadowbox.


Any idea/suggestion to allow me to achieve what I'm seeking here?

Thanks

Bruce 

[jQuery] Re: styleswitcher problem 2 (aka "$ is not a function")

2008-01-28 Thread Bruce MacKay

Hello Karl,

Thanks for the grasp.

The link: http://temporarius.massey.ac.nz/dumpthis.htm

I'm sure the cause of the fault is obvious, but I cannot find 
it.  The fault goes when I call an earlier version of jquery into the 
file - I then triple-checked that the more recent version was 
actually on the disk and was actually being found by the page - and it was.


Let's hope we can make hay this afternoon.

Cheers,

Bruce


At 02:29 a.m. 29/01/2008, you wrote:

Hi Bruce,

A link to a page that we can look at would be very helpful. I wonder 
if your $('a.link1').bind('click',function is inside a 
$(document).ready() ? If not, it might be getting called before the 
jquery.js file loads. Just grasping at straws here.



--Karl
_
Karl Swedberg
<http://www.englishrules.com>www.englishrules.com
www.learningjquery.com



On Jan 28, 2008, at 6:12 AM, Bruce MacKay wrote:


Hi folks,

What I neglected to point out in my first post is that I know 
jquery is being loaded as other function calls (e.g. 
Shadowbox.init();) appearing earlier in the document.ready block 
are being fired.  I can also see the file loaded when I view - 
through Firebug - the javascript files loaded into the page


However, further testing has revealed that it is not styleswitcher 
that is at fault here.  If I make

$("a.link1").bind("click", function() {getFirstPage(this.id)});
the first line in the block with the $ element, I generate the same 
error message - "$ is not a function"


Cheers

Bruce



Date: Mon, 28 Jan 2008 22:26:03 +1300
To: <mailto:jquery-en@googlegroups.com>jquery-en@googlegroups.com
From: Bruce MacKay <<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]>
Subject: styleswitcher problem

Hello folks,

I've just belatedly upgraded to the latest version of jQuery and 
am finding old plugins now misbehaving.


I'm having trouble with Kevin Luck's styleswitch.

FIrebug is reporting "$ is not a function" on the first line of 
this code.  I can't understand it - jquery is already loaded.


$('.styleswitch').bind('click',function()
{
switchStylestyle(this.getAttribute('rel'));
return false;
});
var c = readCookie('style');
if (c) switchStylestyle(c);

[Actually, the first line in Kevin's code is
$('.styleswitch').click(function()

but I have a recollection that .bind('click',...) is now the 
preferred format.]


Can anyone help me here please (or point me at another stylesheet 
switching approach).


Thanks


Bruce


[jQuery] styleswitcher problem 2 (aka "$ is not a function")

2008-01-28 Thread Bruce MacKay

Hi folks,

What I neglected to point out in my first post is that I know jquery 
is being loaded as other function calls (e.g. Shadowbox.init();) 
appearing earlier in the document.ready block are being fired.  I can 
also see the file loaded when I view - through Firebug - the 
javascript files loaded into the page


However, further testing has revealed that it is not styleswitcher 
that is at fault here.  If I make

$("a.link1").bind("click", function() {getFirstPage(this.id)});
the first line in the block with the $ element, I generate the same 
error message - "$ is not a function"


Cheers

Bruce



Date: Mon, 28 Jan 2008 22:26:03 +1300
To: jquery-en@googlegroups.com
From: Bruce MacKay <[EMAIL PROTECTED]>
Subject: styleswitcher problem

Hello folks,

I've just belatedly upgraded to the latest version of jQuery and am 
finding old plugins now misbehaving.


I'm having trouble with Kevin Luck's styleswitch.

FIrebug is reporting "$ is not a function" on the first line of this 
code.  I can't understand it - jquery is already loaded.


$('.styleswitch').bind('click',function()
{
switchStylestyle(this.getAttribute('rel'));
return false;
});
var c = readCookie('style');
if (c) switchStylestyle(c);

[Actually, the first line in Kevin's code is
$('.styleswitch').click(function()

but I have a recollection that .bind('click',...) is now the 
preferred format.]


Can anyone help me here please (or point me at another stylesheet 
switching approach).


Thanks


Bruce


[jQuery] styleswitcher problem

2008-01-28 Thread Bruce MacKay

Hello folks,

I've just belatedly upgraded to the latest version of jQuery and am 
finding old plugins now misbehaving.


I'm having trouble with Kevin Luck's styleswitch.

FIrebug is reporting "$ is not a function" on the first line of this 
code.  I can't understand it - jquery is already loaded.


$('.styleswitch').bind('click',function()
{
switchStylestyle(this.getAttribute('rel'));
return false;
});
var c = readCookie('style');
if (c) switchStylestyle(c);

[Actually, the first line in Kevin's code is
$('.styleswitch').click(function()

but I have a recollection that .bind('click',...) is now the preferred format.]

Can anyone help me here please (or point me at another stylesheet 
switching approach).


Thanks


Bruce 

[jQuery] clueTip and retrieved JSON strings

2008-01-23 Thread Bruce MacKay

Hello folks,

I'm having a problem with clueTip overwriting or affecting the title 
attribute of a returned a tag.


I have an application which dynamically returns the names of images 
in a user-selected folder.


The returned strings (via JSON) appear in the form:

rel="ramosus_imgPreview.asp?sImg=folder/name-of-image.jpg" 
title="folder/name-of-image.jpg" class="transfer jt">name-of-image


Until I started fiddling with this code (i.e including clueTip 
capability), when the image name was clicked, an input text box 
elsewhere on the page was populated with that image name.


The function that drives this process is below.

function listFiles(fo,ej) {
$("#flist").html();
$.get("scripts/ajax_ramosus_editor.asp?id=9b&f="+fo +"&q="  + 
new Date().getTime(), function(responseText){
$("#flist").html(responseText).show().highlightFade({color:'yellow',speed:2000,iterator:'sinusoidal'}); 

   ---> $('a.jt').cluetip({showTitle: false, arrows: true, 
dropShadow: false, hoverIntent: true});

$('a.transfer').bind("click",function(){
var g = this.title || false; 
$("#sImageName"+ej).attr("value",g);$("#imagelist"+ej).slideUp(900, 
function() {

$(this).height('');});
return false;
});
});
};

My problem?  After the inclusion of the $('a.jt') line, when I 
click the hyperlink, the input text box is populated with 
"false".  (The clueTip works fine!)


Can someone show me the error of my ways please.

Thanks,

Bruce




[jQuery] Re: Debugging jQuery's ajax call

2007-10-24 Thread Bruce Wang
Have you heard about Firebug? a firefox plugin

On 10/24/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> I'm trying to debug a js function, it seems HTTP proxy monitor does
> not monitor XMLHTTPrequest/response, any tools in OS X that can do the
> job? Thanks.
> A.C.
>
>


-- 
simple is good
http://brucewang.net
http://twitter.com/number5
http://www.linkist.com
skype: number5


[jQuery] Re: Updating the id of an a tag

2007-10-17 Thread Bruce MacKay

Thanks Glen, for both the solution and useful tip.

Cheers,

Bruce


At 02:13 p.m. 17/10/2007, you wrote:

Instead of .id() try attr("id",yourStringHere)

One tip is to make your string in a variable right before it.
That way you can easily alert the string to see if its coming up correctly.

Glen

On 10/17/07, Bruce MacKay 
<<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]> wrote:

Hello folks,

I'm having problems with the following line of code

$("[EMAIL PROTECTED]'del_']").id("del_*" +pb+"_"+iA+"_ck");

in the function below.

What I'm trying to do is replace the id of the a tag from its 
existing id of 'del_'  to 'del_*x_y_ck', where x and y are the 
variables pb and iA.


I know pb and iA are being 'received' by the function - the 
querystring generated by the get statement is correct.


I'm sure this function has worked previously, so perhaps my problem 
is based in a version update of jQuery, but perhaps it was only 
working previously in my dreams.


Any help appreciated.

Cheers

Bruce

function editAppAsset(ej) {
var temp=new Array();
temp=ej.split('_');
var pb = temp[1];
var iA = temp[2];
$("#wrka").show();
$.get("scripts/ajax_ramosus 
_editor.asp?id=16b&pblID="+pb+"&assetID="+iA +"&q="  + new 
Date().getTime(), function(responseText){

$("[EMAIL PROTECTED]'del_']").id("del_*"+pb+"_"+iA+"_ck");
var options = {dataType: 'json', before: showRequest, after: 
afterAppAsset};
$('#editor_form').submit(function() 
{$(this).ajaxSubmit(options);return false;});

});
};



[jQuery] Updating the id of an a tag

2007-10-17 Thread Bruce MacKay

Hello folks,

I'm having problems with the following line of code

$("[EMAIL PROTECTED]'del_']").id("del_*"+pb+"_"+iA+"_ck");

in the function below.

What I'm trying to do is replace the id of the a tag from its 
existing id of 'del_'  to 'del_*x_y_ck', where x and y are the 
variables pb and iA.


I know pb and iA are being 'received' by the function - the 
querystring generated by the get statement is correct.


I'm sure this function has worked previously, so perhaps my problem 
is based in a version update of jQuery, but perhaps it was only 
working previously in my dreams.


Any help appreciated.

Cheers

Bruce

function editAppAsset(ej) {
var temp=new Array();
temp=ej.split('_');
var pb = temp[1];
var iA = temp[2];
$("#wrka").show();
$.get("scripts/ajax_ramosus_editor.asp?id=16b&pblID="+pb+"&assetID="+iA 
+"&q="  + new Date().getTime(), function(responseText){

$("[EMAIL PROTECTED]'del_']").id("del_*"+pb+"_"+iA+"_ck");
var options = {dataType: 'json', before: showRequest, after: 
afterAppAsset};
$('#editor_form').submit(function() 
{$(this).ajaxSubmit(options);return false;});

});
}; 

[jQuery] Re: ANNOUCE: jQuery lightBox plugin

2007-10-04 Thread Bruce MacKay


Oh, was that bit important ;-)

Thanks Leandro/Wizzud, I feel a bout of the "wood 
for the trees" cliche coming on.


Cheers,
Bruce

At 08:01 a.m. 4/10/2007, you wrote:


Yeah Bruhce, how Wizzud have said, you need to include the
jquery.lightbox-0.1.css.

You have just included a style to the aparence of the images in your
gallery.

On Oct 4, 12:28 am, Bruce MacKay <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm having difficulty getting this plugin to 
work - a test page is here:http://www.thomasbaine.com/gallery.asp

>
> I'm sure I've followed the example, but obviously
> I'm missing something.  When I click on a
> thumbnail, the "lightbox" is appended to the end
> of my page, never on top of it.
>
> Any illumination of my error would be appreciated.
>
> Cheers,
> Bruce
>
>
>
> > > > > On Sep 23, 10:46 pm, Leandro Vieira 
Pinho <[EMAIL PROTECTED]>

> > > > > wrote:
>
> > > > > >jQuerylightBoxpluginis a powerful and simple way to show images in
> > > > > > the same page. It´s inspired and 
based in thelightbox2 from Lokesh

> > > > > > Dhakar (http://www.huddletogether.com/projects/lightbox2/)
>
> > > > > > But, it use the simplicity and flexibility ofjQueryto select the
> > > > > > elements we are. You don´t need to 
alter your HTML code, select the

> > > > > > elements how you want.
>
> > > > > > Page:http://leandrovieira.com/projects/jquery/lightbox/(in
> > > > > > portuguese yet, I´ll translate into English asap).
>
> > > > > > Bye, and all comments and suggestions will be apreciated.




[jQuery] Re: ANNOUCE: jQuery lightBox plugin

2007-10-03 Thread Bruce MacKay


Hello,

I'm having difficulty getting this plugin to work - a test page is here:
http://www.thomasbaine.com/gallery.asp

I'm sure I've followed the example, but obviously 
I'm missing something.  When I click on a 
thumbnail, the "lightbox" is appended to the end 
of my page, never on top of it.


Any illumination of my error would be appreciated.

Cheers,
Bruce




>
> > > On Sep 23, 10:46 pm, Leandro Vieira Pinho <[EMAIL PROTECTED]>
> > > wrote:
>
> > > >jQuerylightBoxpluginis a powerful and simple way to show images in
> > > > the same page. It´s inspired and based in thelightbox2 from Lokesh
> > > > Dhakar (http://www.huddletogether.com/projects/lightbox2/)
>
> > > > But, it use the simplicity and flexibility ofjQueryto select the
> > > > elements we are. You don´t need to alter your HTML code, select the
> > > > elements how you want.
>
> > > > Page:http://leandrovieira.com/projects/jquery/lightbox/(in
> > > > portuguese yet, I´ll translate into English asap).
>
> > > > Bye, and all comments and suggestions will be apreciated.




[jQuery] Re: Tag Cloud

2007-09-20 Thread Bruce MacKay


At 02:28 a.m. 20/09/2007, you wrote:

Is there an implementation of Tag Cloud css or logic using jquery?


This might help you:
http://www.nabble.com/-Plugin--DynaCloud-Plugin-tf4254840s15494.html#a12109312 



[jQuery] Re: ajaxForm and validate question

2007-09-11 Thread Bruce MacKay

Hi Aaron,

Thanks for the input.

I was using ajaxForm because I wanted to have two submit buttons 
(preview and submit) and that option allowed me to have that.


I have a kindergarten grade level of understanding of js language, so 
your explanation " ajaxForm() binds an event handler that (among 
other things) calls ajaxSubmit(). ajaxSubmit() is where the form 
submission actually happens." doesn't really make sense to me.  If 
ajaxForm calls ajaxSubmit via an event handler, then why it is 
necessary to explicitly "call" ajaxSubmit?


Cheers,

Bruce


At 12:58 p.m. 11/09/2007, you wrote:
On 9/11/07, Bruce MacKay 
<<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]> wrote:

submitHandler: function(form) {
$("#cform").ajaxForm(options);
}


This should be

submitHandler: function(form) {
$("#cform").ajaxSubmit(options);
}


ajaxForm() binds an event handler that (among other things) calls 
ajaxSubmit(). ajaxSubmit() is where the form submission actually happens.


More details: 
<http://www.malsup.com/jquery/form/#api>http://www.malsup.com/jquery/form/#api


--
Aaron Heimlich
Web Developer
<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]
http://aheimlich.freepgs.com


[jQuery] ajaxForm and validate question

2007-09-11 Thread Bruce MacKay

Hello folks,

I am using the ajaxForm plugin in combo with Jörn's validation plugin.

The relevant code is below - it is called from 
$(document).ready(function() and it works - 
except for one thing.  I need to click on the 
submit button twice in order for the validation/submit to be fired.


What am I missing here?

Thanks

Bruce



$("#cform").validate({
errorContainer: errors,
errorLabelContainer: $('ol', errors),
wrapper: 'li',
submitHandler: function(form) {
$("#cform").ajaxForm(options);
} 

[jQuery] IE6 ajax oddity

2007-08-08 Thread Bruce MacKay


Folks,

I have a small blog application at http://www.thomasbaine.com/thetuis.asp

The application works fine in IE7 and FF on both the production 
server (above) and my local development machine.


IE6 works fine on my local machine, but fails on the production server.

By fail, I mean that ajax calls to the server are not returned.  For 
example, I can post a comment - and it will be stored in the database 
- but the return ajax stream of data to update the page does not 
arrive.  Similarly, click on the "Recent" links to retrieve previous 
items of the blog do not "work" - the server receives the instruction 
and does the processing, but the return ajax stream doesn't seem to arrive.


Any ideas?

Thanks/Bruce



[jQuery] Re: jCarouselLite problem

2007-08-05 Thread Bruce MacKay

Hi Ganeshji,

I tried that but alas, it did not fix the problem.

Cheers/Bruce


At 09:26 a.m. 6/08/2007, you wrote:

bruce,

i haven't used jcarousellite with thickbox, but can you try something...

Instead of using document.ready to initialize the carousel, use a 

[jQuery] Re: jCarouselLite problem

2007-08-05 Thread Bruce MacKay

Hi Ganeshji,

I specified these attributes but the problem still remains.

A test page is at http://www.thomasbaine.com/thetuis.asp (click on 
the "Look at our pictures") link.


Help would be appreciated.

Cheers/Bruce



At 09:43 a.m. 4/08/2007, you wrote:
i think, u might not be specifying the attributes width and height 
for the images within the carousel.

Try, specifying width and height attributes and lemme know if it works.

-GTG

On 8/3/07, Bruce MacKay 
<<mailto:[EMAIL PROTECTED]>[EMAIL PROTECTED]> wrote:


Hi folks/Ganeshji

I'm having trouble getting jCaroselLite to work "first time" round.

When I either link to a page containing a carousel or to a thickbox
containing a carousel, in neither case do the images appear when that
page/thickbox is visited via the link.

However, if I refresh the page, the images/the carousel appears immediately.

I'm trigger the plugin as...

$(document).ready(function() {
   $(".mixedContent .jCarouselLite").jCarouselLite({
 btnNext: ".mixedContent .next",
 btnPrev: ".mixedContent .prev",
 visible: 2,
 scroll: 2
 });
});

I'm sorry, but I just can see what it is that I'm doing wrong.  Suggestions?

Thanks, Bruce



[jQuery] jCarouselLite problem

2007-08-03 Thread Bruce MacKay


Hi folks/Ganeshji

I'm having trouble getting jCaroselLite to work "first time" round.

When I either link to a page containing a carousel or to a thickbox 
containing a carousel, in neither case do the images appear when that 
page/thickbox is visited via the link.


However, if I refresh the page, the images/the carousel appears immediately.

I'm trigger the plugin as...

$(document).ready(function() {
  $(".mixedContent .jCarouselLite").jCarouselLite({
btnNext: ".mixedContent .next",
btnPrev: ".mixedContent .prev",
visible: 2,
scroll: 2
});
});

I'm sorry, but I just can see what it is that I'm doing wrong.  Suggestions?

Thanks, Bruce



  1   2   >