[jQuery] Re: Get url from iframe

2009-10-19 Thread Jonathan Vanherpe (T & T NV)

rupak mandal wrote:
no because after clicking on any search link, it was redirect to new 
web page. But src remains same.


On Mon, Oct 19, 2009 at 9:45 PM, brian > wrote:



I believe you can get it from the "src" attirbute.

On Mon, Oct 19, 2009 at 7:37 AM, Rupak mailto:rupakn...@gmail.com>> wrote:
>
> Hi all,
>
> I have an ifram in a page. iframe contains google.com
 (google search).
> from there if the user search for a "key word", i and click on a
> link.Is there a way to get the "url" of newly open page inside the
> iframe.
>
> Plz help me..
>
>
> thanks
> Rupak



.location ?

--
www.tnt.be    *Jonathan Vanherpe*
jonat...@tnt.be  - www.tnt.be 
 - tel.: +32 (0)9 3860441




[jQuery] Re: Calling a user-defined function

2009-10-19 Thread Giovanni Battista Lenoci


cachobong ha scritto:

How do i use a function like this?

$.clientCoords = function() {
 var dimensions = {width: 0, height: 0};
 if (document.documentElement) {
 dimensions.width = document.documentElement.offsetWidth;
 dimensions.height = document.documentElement.offsetHeight;
 } else if (window.innerWidth && window.innerHeight) {
 dimensions.width = window.innerWidth;
 dimensions.height = window.innerHeight;
 }
 return dimensions;
}

  


$.clientCoords()

:-)

Bye

--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 



[jQuery] Re: Get url from iframe

2009-10-19 Thread rupak mandal
no because after clicking on any search link, it was redirect to new web
page. But src remains same.

On Mon, Oct 19, 2009 at 9:45 PM, brian  wrote:

>
> I believe you can get it from the "src" attirbute.
>
> On Mon, Oct 19, 2009 at 7:37 AM, Rupak  wrote:
> >
> > Hi all,
> >
> > I have an ifram in a page. iframe contains google.com (google search).
> > from there if the user search for a "key word", i and click on a
> > link.Is there a way to get the "url" of newly open page inside the
> > iframe.
> >
> > Plz help me..
> >
> >
> > thanks
> > Rupak
>


[jQuery] Re: safari flashes hidden text from hide()

2009-10-19 Thread Karl Swedberg
It's all about where you put the script and style in relation to each  
other and in relation to other elements. Take a look at my modification:


http://test.learningjquery.com/brisk.html

I added a one-liner before any of the stylesheets are loaded. Seems to  
work in Safari for me.


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 19, 2009, at 1:58 PM, de...@gravityswitch.com wrote:



Thanks for the reply.  I tried implementing the fix but Safari is
still flashing the hidden text.  The updated files are at the same
URLs:

Here is the page:
https://216.25.8.35/

And here is the js code:
https://216.25.8.35/gsuniverse/templates/javascripts/readmore.js

Am I missing something?

derek

On Oct 16, 10:40 pm, Karl Swedberg  wrote:

This has served me well:

http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of- 
uns...


--Karl


Karl Swedbergwww.englishrules.comwww.learningjquery.com

On Oct 16, 2009, at 4:53 PM, derek allard wrote:




Hello.  I'm relatively new to jQuery and wrote a simple script that
hides a block of text and displays a read more link that when  
clicked

shows the hidden text.  Everything works fine except in Safari where
the hidden text is initially displayed for a second or so before  
being

hidden.  I did some research and I did run into a few posts about
similar Safari bugs but no resolution has worked for me yet.



Here is the page:
https://216.25.8.35/



And here is the js code:
https://216.25.8.35/gsuniverse/templates/javascripts/readmore.js


Is there a quick fix I can add in to resolve this?  Any advice  
greatly

appreciated.



Thank you.



derek




[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Charlie





I try to learn as much as I can from this sort of exercise. 

I made a couple of revisions to previously untested version, went back
and made a couple of syntax and code fixes to previously untested
suggestion

I only submit this because it works on a limited sized table with
simple names, not suggesting that it is highly efficient or not, and
always open to learning why something isn;t efficient. Have been told
in past not to use attr() but still not sure why. 

tested this in FF and IE
live version :  http://jsbin.com/ayaji

js:
$(document).ready(function() {
       var colorArray=["red","blue","green","orange","black"];
        var colorCount=0;
        $("# table tr").each(function() {
            var classname= $(this).find("td").eq(1).text();
            if ($("."+classname).length >0) {
            var thisStyle=$("."+classname).eq(0).attr("style")
            $(this).attr("style", thisStyle)
            }else{ 
            if(colorCount>4){
                colorCount=0
            }
           
$(this).addClass(classname).css("color",colorArray[colorCount] )
            colorCount++
            }
        });
     });


Bi Jing wrote:
I like this issue and following is my draft implement, its
working on IE/FF, hope it helps
  
Firstly, I suggest adding a class to COSTUMER column that gonna making
things easier.
  
HTML sample code:
  

        1
        dd
        cc
        ss
        ss
     
     
        2
        22
        33
        dsaf
        fdas
     

        1
        dd
        cc
        ss
        ss
     
  
and following is JS code :
  
var color={};
var offset=0;
  
// Following fragment change cells color. 
$("tr .COSTUMER").each(function(i){
    var value=$.trim($(this).text());
    if(isDuplicated(value)){
        this.style.backgroundColor=generateColor(value);
    }
});
  
// This function is used to check whether content of one rows appears
more than one time.
function isDuplicated(value){
    return     $("tr .COSTUMER").filter(function (){
        return $.trim($(this).html())==value;
    }).length>1;
}
  
//Generate color with provided text value.
function generateColor(text){
    if(!color[text]){
        color[text] = ['#ccc','#999','#88','#336699'][offset++];//
For testing, only 4 elements in color array, you can increase it.
    }
    return color[text];
}
  
If you have more than 100 rows, this fragment maybe slow, but actually
there should have a pagination, isnt it?
  
Best
Becoder.
  
  On Tue, Oct 20, 2009 at 5:33 AM, Charlie 
wrote:
  
my starting thought would be
use the name as a class, assign a color to
class perhaps from an array of colors so you could have 10 colors and
use them in order for first ten unique names, then repeat for next 10
unique names

use a length ( or size) test to see if that class already exists, if it
does, get the css from the first element with that class [grab the
attr("style") ], don't use a new color and go to next name

this is really rough and untested:

var colorArray=["red","blue"    etc  ///setup color array, assuming 10
colors for code below]
var colorCount;
$("#yourTable tr").each(function() {

    var classname= $(this).find("td").eq(1).text();
    if ($("."+classname).length >0) {
    var thisStyle=$("."+classname +).eq(0).attr("style")
    $(this).attr("style", thisStyle)
    }else{  
    colorCount++
    if(colorCount>9){
        colorCount=0
    }
    $(this).addClass("classname").css("color", colorArray[colorCount])
    }
});





    


Gewton Jhames wrote:
Anybody want
to discuss a way to change row colors of
table based on content, for example:
  +-|---+
  |acess|       
COSTUMER   |
  |-|
  | 1   |  
joseph  
       |
  | 2   |   mary
   
   |
  | 3  
|  
john            |
  | 4  
|  
joseph          |
  | 5  
|  
joseph      |
  | 6   |
 
guile   |
  | 7  
|  
mary    |
  | 8  
|  
craig   |
+-+
  
in this table, the name Joseph and Mary are repeated, so, every
"joseph" or "mary" row must have the same color (picked randomly or
not). so as every "craig", "guile" or "john" row.
I don't want to use css class names based on the name of the
"costumers" because I don't know how many costumers are and how many
times they appear or repeat.
  
thanks





  
  
  






[jQuery] Re: JSpec and jQuery fadeOut

2009-10-19 Thread tjholowaychuk

Hey dude, if you want to repost on JSpec's group I can help you out :)
at least that way its historically there for others who need help
(lots of people need help with the DOM stuff)

On Oct 17, 2:15 pm, finneycanhelp  wrote:
> To add to this:
>   I know I can use the callback argument of the fadeOut method.
> However, I would like to avoid adding that callback argument to the
> method I am testing which calls fadeOut. It seems weird to add a
> parameter just so I can test the method.
>
> http://visionmedia.github.com/jspec/and "Spies" might be key. It
> seems that would require a jquery object be passed into the method I
> am testing as opposed to the name of the thing I am binding to. In
> fact, that may be more flexible and better anyway.
>
> Is there a best approach thatJSpec/jQuery users use when testing
> something which happens over time like fadeOut() as opposed to hide()?
>
> Thanks.
>
> On Oct 17, 2:06 pm, finneycanhelp  wrote:
>
>
>
> > In doing BDD / TDD testing usingJSpec, how can one sense/capture that
> > jQuery's fadeOut has been called?
>
> > Thanks.
> > Mike Finney


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Conrad Cheng wrote:

install firebug in your ff and you can see your js errors


I have installed but can't find where to see errors

--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Conrad Cheng
install firebug in your ff and you can see your js errors

On Tue, Oct 20, 2009 at 11:05 AM, ReynierPM  wrote:

>
> Bi Jing wrote:
>
>> Weird, Its working on my IE/FF
>>
>
> I'm working with FF 3.5.3 also
>
> This is my JS code:
>
> 
> $().ready(function() {
> $('.corner').corner();
>
> $('#paypal_form').validate({
>rules: {
>cc_number: {
>  required: true,
>  creditcard2: function() { return $('#cc_number').val(); }
>}
>  }
>});
>
>$('#cc_type').change(function(){
>  $("#paypal_form").validate().element('#cc_number');
>});
> });
>
> function doCopy(){
>$("#billing_first_name1").val($("#shiping_first_name").val())
>$("#billing_last_name1").val($("#shiping_last_name").val())
> }
> 
>
> And the HTML code asociated to elements is this one:
>
> My shipping address is also my billing
> address  />
>
> First Name:
> 
> 
> First Name:
> 
> 
>
>  Do you get any js errors during viewing page.
>>
>
> Where I look for errors?
> --
> Saludos
> ReynierPM
>


[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Charlie





Bi Jing wrote:
I like this issue and following is my draft implement, its
working on IE/FF, hope it helps
  
Firstly, I suggest adding a class to COSTUMER column that gonna making
things easier.
  
HTML sample code:
  

        1
        dd
        cc
        ss
        ss
     
     
        2
        22
        33
        dsaf
        fdas
     

        1
        dd
        cc
        ss
        ss
     
  
and following is JS code :
  
var color={};
var offset=0;
  
// Following fragment change cells color. 
$("tr .COSTUMER").each(function(i){
    var value=$.trim($(this).text());
    if(isDuplicated(value)){
        this.style.backgroundColor=generateColor(value);
    }
});
  
// This function is used to check whether content of one rows appears
more than one time.
function isDuplicated(value){
    return     $("tr .COSTUMER").filter(function (){
        return $.trim($(this).html())==value;
    }).length>1;
}
  
//Generate color with provided text value.
function generateColor(text){
    if(!color[text]){
        color[text] = ['#ccc','#999','#88','#336699'][offset++];//
For testing, only 4 elements in color array, you can increase it.
    }
    return color[text];
}
  
If you have more than 100 rows, this fragment maybe slow, but actually
there should have a pagination, isnt it?
  
Best
Becoder.
  
  On Tue, Oct 20, 2009 at 5:33 AM, Charlie 
wrote:
  
my starting thought would be
use the name as a class, assign a color to
class perhaps from an array of colors so you could have 10 colors and
use them in order for first ten unique names, then repeat for next 10
unique names

use a length ( or size) test to see if that class already exists, if it
does, get the css from the first element with that class [grab the
attr("style") ], don't use a new color and go to next name

this is really rough and untested:

var colorArray=["red","blue"    etc  ///setup color array, assuming 10
colors for code below]
var colorCount;
$("#yourTable tr").each(function() {

    var classname= $(this).find("td").eq(1).text();
    if ($("."+classname).length >0) {
    var thisStyle=$("."+classname +).eq(0).attr("style")
    $(this).attr("style", thisStyle)
    }else{  
    colorCount++
    if(colorCount>9){
        colorCount=0
    }
    $(this).addClass("classname").css("color", colorArray[colorCount])
    }
});





    


Gewton Jhames wrote:
Anybody want
to discuss a way to change row colors of
table based on content, for example:
  +-|---+
  |acess|       
COSTUMER   |
  |-|
  | 1   |  
joseph  
       |
  | 2   |   mary
   
   |
  | 3  
|  
john            |
  | 4  
|  
joseph          |
  | 5  
|  
joseph      |
  | 6   |
 
guile   |
  | 7  
|  
mary    |
  | 8  
|  
craig   |
+-+
  
in this table, the name Joseph and Mary are repeated, so, every
"joseph" or "mary" row must have the same color (picked randomly or
not). so as every "craig", "guile" or "john" row.
I don't want to use css class names based on the name of the
"costumers" because I don't know how many costumers are and how many
times they appear or repeat.
  
thanks





  
  
  






[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Bi Jing wrote:

Weird, Its working on my IE/FF


I'm working with FF 3.5.3 also

This is my JS code:


$().ready(function() {
$('.corner').corner();

$('#paypal_form').validate({
rules: {
cc_number: {
  required: true,
  creditcard2: function() { return $('#cc_number').val(); }
}
  }
});

$('#cc_type').change(function(){
  $("#paypal_form").validate().element('#cc_number');
});
});

function doCopy(){
$("#billing_first_name1").val($("#shiping_first_name").val())
$("#billing_last_name1").val($("#shiping_last_name").val())
}


And the HTML code asociated to elements is this one:

My shipping address is also my billing 
address />


First Name:


First Name:




Do you get any js errors during viewing page.


Where I look for errors?
--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Bi Jing
Weird, Its working on my IE/FF

 
Same 

First Name: 
Middle Name: 

 

 
function doCopy(){
 $("#first_name1").val($("#first_name").val())
}
 

Do you get any js errors during viewing page.

On Tue, Oct 20, 2009 at 10:54 AM, ReynierPM  wrote:

>
> Bi Jing wrote:
>
>> Sorr, I made mistake, there are two wrong coding
>>
>> No.1, onclick="doCopy()"
>> No.2,
>> $("#user2_name").val($("#user1_name").val())
>>
>>
>>
>>
>> On Tue, Oct 20, 2009 at 10:28 AM, ReynierPM  wrote:
>>
>>
>>
> Nothing still not working
>
> --
> Saludos
> ReynierPM
>


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Bi Jing wrote:

Sorr, I made mistake, there are two wrong coding

No.1, onclick="doCopy()"
No.2,
$("#user2_name").val($("#user1_name").val())




On Tue, Oct 20, 2009 at 10:28 AM, ReynierPM  wrote:




Nothing still not working

--
Saludos
ReynierPM


[jQuery] Re: Weird z-index problem JQuery dialog + Text field

2009-10-19 Thread Bi Jing
Could please provide some code fragments?
Maybe you should set z-index of the whole Dialog element.
And please press F12 in IE8, and inspect dialog element, what is the height
of it and whether the dialog already overlapped the links.

Becoder.

On Tue, Oct 20, 2009 at 4:01 AM, Mesquite  wrote:

>
> Hi,
>
> I have a weird problem with JQuery and IE8.
>
> When I open my JQuery Dialog, I have some input text fields in this
> dialog.
> They all look fine.
> Under the JQuery Dialog, the main screen contains some links.
> When I hover over the text fields in the dialog, the hovering(and
> clicking) of the links of the main page is activated.
> This is only the case, when the input fields are hovered.
>
> I already tried to set the z-index of the text field to a high level,
> but no success.
>
> Can somebody help me please?
>
> thx,
> Koen


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Bi Jing
Sorr, I made mistake, there are two wrong coding

No.1, onclick="doCopy()"
No.2,
$("#user2_name").val($("#user1_name").val())

> $("#user2_pass").val($("#user1_pass").val())



On Tue, Oct 20, 2009 at 10:28 AM, ReynierPM  wrote:

>
> Bi Jing wrote:
>
>> HTML code:
>>
>> Copy
>>
>> 
>> 
>> 
>> 
>>
>> 
>> 
>> 
>> 
>>
>>
>> JS code:
>>
>> function doCopy(){
>> $("user2_name").val($("user1_name").val())
>> $("user2_pass").val($("user1_pass").val())
>> }
>>
>>
> Isn't working.
>
> HTML Code:
> Same  id="same" onclick="doCopy" />
>
> First Name:  name="first_name" id="first_name" value="" size="" />
> Middle Name:  id="first_name1" value="" size="" />
>
> JS Code:
> function doCopy(){
>  $("first_name1").val($("first_name").val())
> }
> Where is the error?
> --
> Saludos
> ReynierPM
>


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Charlie Griefer wrote:

Your selectors are incorrect.  $('first_name1') looks for a 
element in the DOM (there is none).  You're referencing by ID, so you want
to preface the ID with a # sign (similar to CSS).

$('#first_name1').val($('#first_name').val())


Fixed and still without working

--
Saludos
ReynierPM


[jQuery] Calling a user-defined function

2009-10-19 Thread cachobong

How do i use a function like this?

$.clientCoords = function() {
 var dimensions = {width: 0, height: 0};
 if (document.documentElement) {
 dimensions.width = document.documentElement.offsetWidth;
 dimensions.height = document.documentElement.offsetHeight;
 } else if (window.innerWidth && window.innerHeight) {
 dimensions.width = window.innerWidth;
 dimensions.height = window.innerHeight;
 }
 return dimensions;
}


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Charlie Griefer
On Mon, Oct 19, 2009 at 7:28 PM, ReynierPM  wrote:

>
> Isn't working.
>
> HTML Code:
> Same  id="same" onclick="doCopy" />
>
> First Name:  name="first_name" id="first_name" value="" size="" />
> Middle Name:  id="first_name1" value="" size="" />
>
> JS Code:
> function doCopy(){
>  $("first_name1").val($("first_name").val())
> }
> Where is the error?
>


Your selectors are incorrect.  $('first_name1') looks for a 
element in the DOM (there is none).  You're referencing by ID, so you want
to preface the ID with a # sign (similar to CSS).

$('#first_name1').val($('#first_name').val())

-- 
Charlie Griefer
http://charlie.griefer.com/

I have failed as much as I have succeeded. But I love my life. I love my
wife. And I wish you my kind of success.


[jQuery] Re: Problem with animate after submit in opera

2009-10-19 Thread Karl Swedberg
Is the link's href set to another page? If so, I'm surprised it works  
in any browser. You would need to return false after your animate  
methods:


$(document).ready(function(){
   $(".action").click(function(){
   $("#panel")
   .animate({top:"0px"}, 500)
.animate({top:"0"}, 4000)
.animate({top:"-75px"}, 500);
return false; // <-- prevent the link from being followed.
   });
 $("#panel").click(function(){
   $("#panel").hide();
   });
   });


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 19, 2009, at 8:55 AM, Vali wrote:



Hello,

Recently I encountered a problem in Opera: The browser does not run
any javascript after a page is submitted.
For example if you use animate on an anchor when you click on that
anchor the animate is never run unless the href is set to "#".

This is the code:

http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.js">


$(document).ready(function(){
   $(".action").click(function(){
   $("#panel")
   .animate({top:"0px"}, 500)
.animate({top:"0"}, 4000)
.animate({top:"-75px"}, 500);
   });
 $("#panel").click(function(){
   $("#panel").hide();
   });
   });





body {
margin: 0;
padding: 0;
font: 75%/120% Arial, Helvetica, sans-serif;
background: #323232;
}
#panel {
background: #eaeaea;
height: 75px;
width: 100%;
position: absolute;
top:-75px;
}
.action
{
padding: 2px;
color: white;
margin: 0 auto ;
background: #77;
padding:  5px;
border:2px solid #323232;
}







Your profile customization has been saved.




Save
bla bla








[jQuery] Re: Can't insert JavaScript using html function

2009-10-19 Thread Kiswono Prayogo
document.write would replace anything on the document.. it's not a good
practice to use that ^^ IMHO..
On Tue, Oct 20, 2009 at 9:29 AM, Bi Jing  wrote:

> No, Its should work. Maybe you get some JS error, please check.
>
> Becoder.
>
>
> On Tue, Oct 20, 2009 at 7:43 AM, Kiswono Prayogo wrote:
>
>> why don't you use this instead:$("#test").html("Hi there
>> "+username+".");
>>
>>
>> On Mon, Oct 19, 2009 at 10:06 PM, Ron 
>> wrote:
>>
>>>
>>> Hi all.  I stumbled upon something which may be by design in jQuery
>>> for security reasons, it may be the browsers doing it, but...  I found
>>> that any JavaScript I try to put into the html of an object is
>>> ignored.  For example, say username is a variable that was already
>>> defined with the user's name:
>>>
>>> $("#test").html("Hi there document.write(username);.");
>>>
>>> All the script is just stripped out, in both IE and Firefox.
>>>
>>> Any ideas what is going on?
>>>
>>
>>
>


[jQuery] Re: Can't insert JavaScript using html function

2009-10-19 Thread Bi Jing
No, Its should work. Maybe you get some JS error, please check.

Becoder.

On Tue, Oct 20, 2009 at 7:43 AM, Kiswono Prayogo  wrote:

> why don't you use this instead:$("#test").html("Hi there
> "+username+".");
>
>
> On Mon, Oct 19, 2009 at 10:06 PM, Ron wrote:
>
>>
>> Hi all.  I stumbled upon something which may be by design in jQuery
>> for security reasons, it may be the browsers doing it, but...  I found
>> that any JavaScript I try to put into the html of an object is
>> ignored.  For example, say username is a variable that was already
>> defined with the user's name:
>>
>> $("#test").html("Hi there document.write(username);.");
>>
>> All the script is just stripped out, in both IE and Firefox.
>>
>> Any ideas what is going on?
>>
>
>


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread ReynierPM


Bi Jing wrote:

HTML code:

Copy












JS code:

function doCopy(){
$("user2_name").val($("user1_name").val())
$("user2_pass").val($("user1_pass").val())
}



Isn't working.

HTML Code:
Same id="same" onclick="doCopy" />


First Name: name="first_name" id="first_name" value="" size="" />
Middle Name: name="first_name1" id="first_name1" value="" size="" />


JS Code:
function doCopy(){
 $("first_name1").val($("first_name").val())
}
Where is the error?
--
Saludos
ReynierPM


[jQuery] Re: Copy content from one field to another

2009-10-19 Thread Bi Jing
HTML code:

Copy












JS code:

function doCopy(){
$("user2_name").val($("user1_name").val())
$("user2_pass").val($("user1_pass").val())
}

HTH.
Becoder.
On Tue, Oct 20, 2009 at 10:02 AM, ReynierPM  wrote:

>
> Hi every:
> I need when a user pick a checkbox the content in one field is copied to
>  another field in the same form. For example suppose this:
>
> __ checkbox
>
> --- User 1 
> Name: __
> Pass: __
>
> --- User 2 
> Name: __
> Pass: __
>
> I want when user marks or picks the checkbox the content from User1_Name
>  is copied to User2_Name and so on. Can any help me do this?
> Cheers and thanks in advance
> --
> ReynierPM
>


[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Bi Jing
I like this issue and following is my draft implement, its working on IE/FF,
hope it helps

Firstly, I suggest adding a class to COSTUMER column that gonna making
things easier.

HTML sample code:


1
dd
cc
ss
ss
 
 
2
22
33
dsaf
fdas
 

1
dd
cc
ss
ss
 

and following is JS code :

var color={};
var offset=0;

// Following fragment change cells color.
$("tr .COSTUMER").each(function(i){
var value=$.trim($(this).text());
if(isDuplicated(value)){
this.style.backgroundColor=generateColor(value);
}
});

// This function is used to check whether content of one rows appears more
than one time.
function isDuplicated(value){
return $("tr .COSTUMER").filter(function (){
return $.trim($(this).html())==value;
}).length>1;
}

//Generate color with provided text value.
function generateColor(text){
if(!color[text]){
color[text] = ['#ccc','#999','#88','#336699'][offset++];// For
testing, only 4 elements in color array, you can increase it.
}
return color[text];
}

If you have more than 100 rows, this fragment maybe slow, but actually there
should have a pagination, isnt it?

Best
Becoder.

On Tue, Oct 20, 2009 at 5:33 AM, Charlie  wrote:

>  my starting thought would be use the name as a class, assign a color to
> class perhaps from an array of colors so you could have 10 colors and use
> them in order for first ten unique names, then repeat for next 10 unique
> names
>
> use a length ( or size) test to see if that class already exists, if it
> does, get the css from the first element with that class [grab the
> attr("style") ], don't use a new color and go to next name
>
> this is really rough and untested:
>
> var colorArray=["red","blue"etc  ///setup color array, assuming 10
> colors for code below]
> var colorCount;
> $("#yourTable tr").each(function() {
>
> var classname= $(this).find("td").eq(1).text();
> if ($("."+classname).length >0) {
> var thisStyle=$("."+classname +).eq(0).attr("style")
> $(this).attr("style", thisStyle)
> }else{
> colorCount++
> if(colorCount>9){
> colorCount=0
> }
> $(this).addClass("classname").css("color", colorArray[colorCount])
> }
> });
>
>
>
>
>
>
>
> Gewton Jhames wrote:
>
> Anybody want to discuss a way to change row colors of table based on
> content, for example:
> +-|---+
> |acess|COSTUMER   |
> |-|
> | 1   |   joseph  |
> | 2   |   mary|
> | 3   |   john|
> | 4   |   joseph  |
> | 5   |   joseph  |
> | 6   |   guile   |
> | 7   |   mary|
> | 8   |   craig   |
> +-+
>
> in this table, the name Joseph and Mary are repeated, so, every "joseph" or
> "mary" row must have the same color (picked randomly or not). so as every
> "craig", "guile" or "john" row.
> I don't want to use css class names based on the name of the "costumers"
> because I don't know how many costumers are and how many times they appear
> or repeat.
>
> thanks
>
>
>


[jQuery] Copy content from one field to another

2009-10-19 Thread ReynierPM


Hi every:
I need when a user pick a checkbox the content in one field is copied to 
 another field in the same form. For example suppose this:


__ checkbox

--- User 1 
Name: __
Pass: __

--- User 2 
Name: __
Pass: __

I want when user marks or picks the checkbox the content from User1_Name 
 is copied to User2_Name and so on. Can any help me do this?

Cheers and thanks in advance
--
ReynierPM


[jQuery] Re: Can't insert JavaScript using html function

2009-10-19 Thread Kiswono Prayogo
why don't you use this instead:$("#test").html("Hi there
"+username+".");

On Mon, Oct 19, 2009 at 10:06 PM, Ron wrote:

>
> Hi all.  I stumbled upon something which may be by design in jQuery
> for security reasons, it may be the browsers doing it, but...  I found
> that any JavaScript I try to put into the html of an object is
> ignored.  For example, say username is a variable that was already
> defined with the user's name:
>
> $("#test").html("Hi there document.write(username);.");
>
> All the script is just stripped out, in both IE and Firefox.
>
> Any ideas what is going on?
>


[jQuery] Re: Json works in firefox but not in ie

2009-10-19 Thread Shawn


Common problem.  It was blogged about in Feb last year 
(http://grover.open2space.com/node/207).  Still, I'm glad you found the 
solution.


Shawn

Patrik wrote:

Problem solved it was an extra , after the last {optionValue: '".
$b ."', optionDisplay: '". $b ."'} in the php file. firefox must have
ignored it while ie expected more.

On 19 Okt, 16:49, Greg Riley  wrote:

You are setting options inside a function and then trying to reference
it outside of that function.

Try putting var options = ''; before that first line.

On Oct 19, 10:22 am, Patrik  wrote:


Hi,
I have this code and it works well in firefox but in IE it dosn't.
How do I make it work in IE?
If I put alert(options) inside the loop I get all the values I want so
this far it's working but outside the loop if i call alert(options)
nothing happens. why?
$("select#kod").change(function(){
   $.getJSON("artnr-ajax.php",{value: $(this).val(), where: 'kod'},
function(j){
  var options = '';
  for (var i = 0; i < j.length; i++) {
 options += '' + j
[i].optionDisplay + '';
  }
  $("select#beteckning").html(options);
})


[jQuery] Re: easing 1.3 plugin how to implement pls?

2009-10-19 Thread jessie

Bump * anyone please?

On Oct 19, 9:23 am, jessie  wrote:
> Hi
>
> I have fancybox lightbox installed and i wanted a different transition
> effect.  So i've installed the easing 1.3 plugin
>
> I have read and re-read the instructions but i don't really understand
> where i need to make the change for it to take effect.
>
> Its all loading fine so there are no problems there.
>
> Here is the instructions.http://gsgd.co.uk/sandbox/jquery/easing/
>
> Usage
> Default
> Choose a default easing method to overwrite the standard 'swing'
> animation. The easing default is 'easeOutQuad', specify your own using
> the following:
> jQuery.easing.def = "string";
> Where string is one of the equation names. The old swing function is
> renamed to jswing.
>
> U yes, and where do I make this change? And not sure I know what a
> string is but I thought it would be any other easing function such as
> ‘easeInSine’ etc. no? but where exactly do I put it?  am i suppose to
> edit the plugin or have another js file with those commands?
>
> Thanks
> Jess


[jQuery] JQuery, JFeed, Blogger

2009-10-19 Thread rob

Hello,

I've been working on this for a while and I can't seem to figure this
out.  I'm trying to use the jFeed plugin to access an RSS feed from
Blogger.  I'm not trying to use any authentication, I just want to use
public read-only access.

I tried some real simple examples at first (using jFeed Demo from
jQuery.com).  When using the local XML file, everything works fine.
When I try to use a blogger address it doesn't work.

I've tried using:

http://blogName.blogspot.com/atom.xml
http://blogName.blogspot.com/feeds/posts/default
http://www.blogger.com/feeds/blogID/posts/default

None of these seem to work.  Since a local XML file worked in the
demo, I decided to use my own local XML file.  This worked fine,
however, when I copied it over to another web server, I was seeing the
same behavior.

In all cases where there's an error, I see an Error 405 message.  In
the function, it is requesting the file by 'GET' instead of 'POST',
but when I look in firebug, it says 'OPTION.'

Any help would be appreciated.


[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Charlie





my starting thought would be use the name as a class, assign a color to
class perhaps from an array of colors so you could have 10 colors and
use them in order for first ten unique names, then repeat for next 10
unique names

use a length ( or size) test to see if that class already exists, if it
does, get the css from the first element with that class [grab the
attr("style") ], don't use a new color and go to next name

this is really rough and untested:

var colorArray=["red","blue"    etc  ///setup color array, assuming 10
colors for code below]
var colorCount;
$("#yourTable tr").each(function() {

    var classname= $(this).find("td").eq(1).text();
    if ($("."+classname).length >0) {
    var thisStyle=$("."+classname +).eq(0).attr("style")
    $(this).attr("style", thisStyle)
    }else{  
    colorCount++
    if(colorCount>9){
        colorCount=0
    }
    $(this).addClass("classname").css("color", colorArray[colorCount])
    }
});



    


Gewton Jhames wrote:
Anybody want to discuss a way to change row colors of
table based on content, for example:
  +-|---+
  |acess|       
COSTUMER   |
  |-|
  | 1   |   joseph  
       |
  | 2   |   mary    
   |
  | 3   |  
john            |
  | 4   |  
joseph          |
  | 5   |  
joseph      |
  | 6   |  
guile   |
  | 7   |  
mary    |
  | 8   |  
craig   |
+-+
  
in this table, the name Joseph and Mary are repeated, so, every
"joseph" or "mary" row must have the same color (picked randomly or
not). so as every "craig", "guile" or "john" row.
I don't want to use css class names based on the name of the
"costumers" because I don't know how many costumers are and how many
times they appear or repeat.
  
thanks






[jQuery] Re: Superfish plugin: some limitations that could be addressed

2009-10-19 Thread Charlie





I don't know a lot about screen reader issues, however there is no
reason not to be able to build a mega menu inside UL/LI structure and
this has been done in superfish.

You can put divs inside an li, with columns , images, H tags,  whatever
you want and is all valid. Do whatever css you want inside those
containers.



Florent V. wrote:

  Hello,

This is a message for Joel Birch, author of the Superfish plugin, to
developers who may assist him (if any). It may be interesting to
people working on similar plugins, dropdown navigation, etc.

Superfish is a great plugin (thank you Joel for sharing it). It takes
care of a lot of details, like some hard-to-squash IE7 bug, nice
accessibility and usability enhancements, etc. While working on a
project recently i encountered two issues with this plugin.

Those issues are: 1. Superfish expects submenus to be UL elements and
2. the method of hiding submenus may not be accessible to some users
(specifically users of text-to-speech technology).

#1 SUPERFISH EXPECTS SUBMENUS TO BE UL ELEMENTS

In the non-minified source of Superfish 1.4.8, this is on lines
104-105 and 112-113:

	var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not
(not).removeClass(o.hoverClass)
		.find('>ul').hide().css('visibility','hidden');

	$ul = this.addClass(o.hoverClass)
		.find('>ul:hidden').css('visibility','visible');

I had trouble understanding all (if not most) of the Superfish code.
But it looks like Superfish is looking of UL elements that are direct
children of a given element [find('>ul') and find('>ul:hidden')]. If
you happen to use a different element, say a DIV, the plugin works to
some extent but the hiding/revealing of submenus is not managed by
Superfish anymore, and the animation effects are not applied. Because
Superfish won't find the UL it expects and thus won't be able to apply
styles to it.

I think it might be interesting, say in a future Superfish 1.5, to
allow DIV elements as well, or maybe an arbitrary selector. The '>ul'
selector could be a default parameter, and could be overridden with
'>div', '.someclass', etc. I'm not sure if the requirement for the
child selector is absolute, or is just a safety thing to avoid
selecting nested elements in three+-level menus.

Why would one want to use something other (whatever it is) than a UL?
Well, it might be very useful to build mega-dropdowns (see
http://www.useit.com/alertbox/mega-dropdown-menus.html), which is what
i had to do (though my own "mega" dropdown was quite simple: a DIV
with one paragraph and a short list of links). It might be useful too
when you need an additional DIV around a UL because you need more
markup to do some CSS embelishment (borders, shadows as images,
decorated boxes, etc.).

#2 HIDING SUBMENUS WITH DISPLAY AND VISIBILITY

It's a well-known fact that a consequence of using display:none or (to
some extent) visibility:hidden to hide an element is that this element
won't be rendered by most screen readers (JAWS, Window-Eyes, etc.).
Looking at the Superfish default CSS code, it looks like this was
considered:

	.sf-menu ul {
		position: absolute;
		top: -999em;
	}
	.sf-menu li:hover ul,
	.sf-menu li.sfHover ul {
		left: 0;
	}

(This is a simplified code extract.)

The submenus are hidden by displaying them far on the left of the
viewport (note that with most browsers, trying to do the same on the
RIGHT of the viewport will create an horizontal scrollbar on the
viewport, that enables the user to scroll all the way to where the
submenus are positioned). Then when the parent LI is hovered, or gets
the default sfHover class, this left offset is removed.

This is a nice technique, but the JS code completely breaks it. Once
the JS code is executed, the submenus will get this inline styles:

	

And when the parent LI is hovered or tabbed to, you get:

	

I'm quite doubtful of the actual results of using a Superfish menu in
a screen reader. Remember: screen readers act between the user and the
application, meaning that a screen reader user is still using a normal
web browser (mostly Internet Explorer, some use Firefox), and most
screen reader users don't disable _javascript_ (either because they
don't know how, or because the websites they use require _javascript_ in
some ways).

Now, please note that i don't know what the best option is.
Reproducing the accessible CSS hiding trick in the JS would work. But:

1. The display:none might be necessary for some jQuery methods to work
(i suspect animated fade-in effects to require an hidden element to
work). Is this the case? Are there workarounds?
2. The current behavior MIGHT be ok in some or even most use cases. I
suspect that linear navigation with a screen reader would work well,
while other use cases (using the kind of page navigation shortcuts
screen readers provide) might fail to reveal the relevant hidden
submenus. I guess i should test this once i have some time to re-learn
the basics of JAWS testing. (I'm not really fluent with assistiv

[jQuery] Re: Change row colors of table based on content

2009-10-19 Thread Jeffrey Kretz
Put together a hashtable of colors based on the customer name.

 

Something like this (untested):

 

var hash = {};

$('#tableid tr').each(function(i){

   var tr = $(this);

   var customer = $.trim(tr.children('td:eq(1)').html());

   var color = hash[customer];

   if (!color)

   {

  hash[customer] = color = getNextColor(customer);

   }

   tr.css({color:color});

});

 

function getNextColor(customer)

{

   // Do something.

   return color;

}

 

 

From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Gewton Jhames
Sent: Monday, October 19, 2009 1:21 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Change row colors of table based on content

 

Anybody want to discuss a way to change row colors of table based on
content, for example:
+-|---+
|acess|COSTUMER   |
|-|
| 1   |   joseph  |
| 2   |   mary|
| 3   |   john|
| 4   |   joseph  |
| 5   |   joseph  |
| 6   |   guile   |
| 7   |   mary|
| 8   |   craig   |
+-+

in this table, the name Joseph and Mary are repeated, so, every "joseph" or
"mary" row must have the same color (picked randomly or not). so as every
"craig", "guile" or "john" row.
I don't want to use css class names based on the name of the "costumers"
because I don't know how many costumers are and how many times they appear
or repeat.

thanks



[jQuery] Re: Create a custom rule

2009-10-19 Thread Giovanni Battista Lenoci


Jörn Zaefferer ha scritto:
The first argument, "value", refers to the actual value-attribute. 
You'll probably want to use the third argument, eg. "param":


$.validator.addMethod('hasClass', function(value, element, param) { reurn 
$(element).hasClass(param); }, jQuery.format('Please check the button'));
Also a bit simpler with a single return.

Jörn
Thank you very much Jörn, I've read only the first example on this page 
http://docs.jquery.com/Plugins/Validation/Validator/addMethod#namemethodmessage.


Bye :-)



--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 



[jQuery] Superfish plugin: some limitations that could be addressed

2009-10-19 Thread Florent V.

Hello,

This is a message for Joel Birch, author of the Superfish plugin, to
developers who may assist him (if any). It may be interesting to
people working on similar plugins, dropdown navigation, etc.

Superfish is a great plugin (thank you Joel for sharing it). It takes
care of a lot of details, like some hard-to-squash IE7 bug, nice
accessibility and usability enhancements, etc. While working on a
project recently i encountered two issues with this plugin.

Those issues are: 1. Superfish expects submenus to be UL elements and
2. the method of hiding submenus may not be accessible to some users
(specifically users of text-to-speech technology).

#1 SUPERFISH EXPECTS SUBMENUS TO BE UL ELEMENTS

In the non-minified source of Superfish 1.4.8, this is on lines
104-105 and 112-113:

var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not
(not).removeClass(o.hoverClass)
.find('>ul').hide().css('visibility','hidden');

$ul = this.addClass(o.hoverClass)
.find('>ul:hidden').css('visibility','visible');

I had trouble understanding all (if not most) of the Superfish code.
But it looks like Superfish is looking of UL elements that are direct
children of a given element [find('>ul') and find('>ul:hidden')]. If
you happen to use a different element, say a DIV, the plugin works to
some extent but the hiding/revealing of submenus is not managed by
Superfish anymore, and the animation effects are not applied. Because
Superfish won't find the UL it expects and thus won't be able to apply
styles to it.

I think it might be interesting, say in a future Superfish 1.5, to
allow DIV elements as well, or maybe an arbitrary selector. The '>ul'
selector could be a default parameter, and could be overridden with
'>div', '.someclass', etc. I'm not sure if the requirement for the
child selector is absolute, or is just a safety thing to avoid
selecting nested elements in three+-level menus.

Why would one want to use something other (whatever it is) than a UL?
Well, it might be very useful to build mega-dropdowns (see
http://www.useit.com/alertbox/mega-dropdown-menus.html), which is what
i had to do (though my own "mega" dropdown was quite simple: a DIV
with one paragraph and a short list of links). It might be useful too
when you need an additional DIV around a UL because you need more
markup to do some CSS embelishment (borders, shadows as images,
decorated boxes, etc.).

#2 HIDING SUBMENUS WITH DISPLAY AND VISIBILITY

It's a well-known fact that a consequence of using display:none or (to
some extent) visibility:hidden to hide an element is that this element
won't be rendered by most screen readers (JAWS, Window-Eyes, etc.).
Looking at the Superfish default CSS code, it looks like this was
considered:

.sf-menu ul {
position: absolute;
top: -999em;
}
.sf-menu li:hover ul,
.sf-menu li.sfHover ul {
left: 0;
}

(This is a simplified code extract.)

The submenus are hidden by displaying them far on the left of the
viewport (note that with most browsers, trying to do the same on the
RIGHT of the viewport will create an horizontal scrollbar on the
viewport, that enables the user to scroll all the way to where the
submenus are positioned). Then when the parent LI is hovered, or gets
the default sfHover class, this left offset is removed.

This is a nice technique, but the JS code completely breaks it. Once
the JS code is executed, the submenus will get this inline styles:



And when the parent LI is hovered or tabbed to, you get:



I'm quite doubtful of the actual results of using a Superfish menu in
a screen reader. Remember: screen readers act between the user and the
application, meaning that a screen reader user is still using a normal
web browser (mostly Internet Explorer, some use Firefox), and most
screen reader users don't disable JavaScript (either because they
don't know how, or because the websites they use require JavaScript in
some ways).

Now, please note that i don't know what the best option is.
Reproducing the accessible CSS hiding trick in the JS would work. But:

1. The display:none might be necessary for some jQuery methods to work
(i suspect animated fade-in effects to require an hidden element to
work). Is this the case? Are there workarounds?
2. The current behavior MIGHT be ok in some or even most use cases. I
suspect that linear navigation with a screen reader would work well,
while other use cases (using the kind of page navigation shortcuts
screen readers provide) might fail to reveal the relevant hidden
submenus. I guess i should test this once i have some time to re-learn
the basics of JAWS testing. (I'm not really fluent with assistive
technology.)

Finally, i would like to add that if the current JS behavior IS a
problem for screen reader users, then the default CSS code might be
counter-productive because it suggests to plugin users (especially
ad

[jQuery] Change row colors of table based on content

2009-10-19 Thread Gewton Jhames
Anybody want to discuss a way to change row colors of table based on
content, for example:
+-|---+
|acess|COSTUMER   |
|-|
| 1   |   joseph  |
| 2   |   mary|
| 3   |   john|
| 4   |   joseph  |
| 5   |   joseph  |
| 6   |   guile   |
| 7   |   mary|
| 8   |   craig   |
+-+

in this table, the name Joseph and Mary are repeated, so, every "joseph" or
"mary" row must have the same color (picked randomly or not). so as every
"craig", "guile" or "john" row.
I don't want to use css class names based on the name of the "costumers"
because I don't know how many costumers are and how many times they appear
or repeat.

thanks


[jQuery] Re: safari flashes hidden text from hide()

2009-10-19 Thread de...@gravityswitch.com

Thanks for the reply.  I tried implementing the fix but Safari is
still flashing the hidden text.  The updated files are at the same
URLs:

Here is the page:
https://216.25.8.35/

And here is the js code:
https://216.25.8.35/gsuniverse/templates/javascripts/readmore.js

Am I missing something?

derek

On Oct 16, 10:40 pm, Karl Swedberg  wrote:
> This has served me well:
>
> http://www.learningjquery.com/2008/10/1-way-to-avoid-the-flash-of-uns...
>
> --Karl
>
> 
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Oct 16, 2009, at 4:53 PM, derek allard wrote:
>
>
>
> > Hello.  I'm relatively new to jQuery and wrote a simple script that
> > hides a block of text and displays a read more link that when clicked
> > shows the hidden text.  Everything works fine except in Safari where
> > the hidden text is initially displayed for a second or so before being
> > hidden.  I did some research and I did run into a few posts about
> > similar Safari bugs but no resolution has worked for me yet.
>
> > Here is the page:
> >https://216.25.8.35/
>
> > And here is the js code:
> >https://216.25.8.35/gsuniverse/templates/javascripts/readmore.js
>
> > Is there a quick fix I can add in to resolve this?  Any advice greatly
> > appreciated.
>
> > Thank you.
>
> > derek


[jQuery] Weird z-index problem JQuery dialog + Text field

2009-10-19 Thread Mesquite

Hi,

I have a weird problem with JQuery and IE8.

When I open my JQuery Dialog, I have some input text fields in this
dialog.
They all look fine.
Under the JQuery Dialog, the main screen contains some links.
When I hover over the text fields in the dialog, the hovering(and
clicking) of the links of the main page is activated.
This is only the case, when the input fields are hovered.

I already tried to set the z-index of the text field to a high level,
but no success.

Can somebody help me please?

thx,
Koen


[jQuery] Another quick update to CFJS

2009-10-19 Thread Chris Jordan
Hey folks,

I've made another quick update to the DateFormat function in CFJS. You can
read about it on my blog if you like (http://cjordan.us/index.cfm/CFJS).

It's at version 1.1.12, and as always is available from
http://cfjs.riaforge.org.

Cheers!
Chris


[jQuery] Re: what does this selector mean ?

2009-10-19 Thread Karl Swedberg

On Oct 18, 2009, at 2:05 AM, Michael Geary wrote:

$('div',this) is simply a confusing way of writing $ 
(this).find('div'). The only reason it exists at all is for  
"historical reasons": it was added to jQuery before the .find()  
method existed.


Never use $('div',this) in your code. Always use $(this).find('div')  
instead. It is easier to read and faster too.


-Mike


Right on!


--Karl



[jQuery] Re: Create a custom rule

2009-10-19 Thread Jörn Zaefferer
The first argument, "value", refers to the actual value-attribute. You'll
probably want to use the third argument, eg. "param":


$.validator.addMethod('hasClass', function(value, element, param) {
reurn $(element).hasClass(param); }, jQuery.format('Please check the
button'));


Also a bit simpler with a single return.

Jörn

On Mon, Oct 19, 2009 at 9:03 PM, Giovanni Battista Lenoci  wrote:

>  Hi, I'm trying to create a new validation rule to check if a button has a
> class.
>
> I try to explain the scenario.
>
> I have a button that makes an ajax call to check the availability of a
> product.
>
> When the app loads the button as class "to_check", when the button is
> clicked an ajax call is fired, a server script return the availability of
> the product and basing on this answer I change the class of the button from
> "to_check" to "ok" or "ko".
>
> Now I want to validate the button to se if the availability is being
> checked and is ok, then I wrote this:
>
> $.validator.addMethod('hasClass', function(value, element) { 
> if($(element).hasClass(value)) {
>return true;
>  } else {
>return false
>  }
> }, 
> jQuery.format('Please check the button'));
>
>
> Now I want to add this rule to the button with the metadata plugin inside
> the class name with this syntax:
>
>   class="to_check {validate:{*hasClass:'ok'*, messages:{hasClass:'Verifica 
> disponibilità'}}}"
>  id="verifica_disponibilita" value="Verifica disponibilità" />
>
>
> When I submit the form it returns always false, I tried to log "value" and
> I get the button value.
>
> How I can get the "ok" passed via the metadata class? (bold one)
>
> Bye
>
>
>
> -- gianiaz.net - web solutions
> via piedo, 58 - 23020 tresivio (so) - italy
> +39 347 7196482
>
>


[jQuery] Create a custom rule

2009-10-19 Thread Giovanni Battista Lenoci





Hi, I'm trying to create a new validation rule to check if a button has
a class.

I try to explain the scenario.

I have a button that makes an ajax call to check the availability of a
product. 

When the app loads the button as class "to_check", when the button is
clicked an ajax call is fired, a server script return the availability
of the product and basing on this answer I change the class of the
button from "to_check" to "ok" or "ko".

Now I want to validate the button to se if the availability is being
checked and is ok, then I wrote this:

$.validator.addMethod('hasClass', function(value, element) { if($(element).hasClass(value)) { 
   return true;
 } else {
   return false
 }
}, jQuery.format('Please check the button'));

Now I want to add this rule to the button with the metadata plugin
inside the class name with this syntax:




When I submit the form
it returns always false, I tried to log "value" and I get the button
value. 

How I can get the "ok"
passed via the metadata class? (bold one)

Bye 



-- 
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482 





[jQuery] Re: Where to access datepicker?

2009-10-19 Thread Andrew243

Hi Charlie,

The Google link works -- thanks, I did not understand how to contruct
the Google URL from their site.

What URL can I use to link to datepicker?

On Oct 19, 12:37 pm, Charlie  wrote:
> path for jQuery is right in link I showed you
>  src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js";>
> have to pull full UI.js if using Google but is probably better solution than 
> pulling from sites you are using now
> link on same page
> Andrew243 wrote:Hi Charlie, Thanks -- but what is the HTML to use Google for 
> jQuery and also for datepicker. I now use:  src="http://code.jquery.com/jquery-latest.js";> What is the 
> equivalent for Google, and what would it be for datepicker? A On Oct 19, 
> 11:31 am, 
> Charliewrote:http://code.google.com/apis/ajaxlibs/documentation/index.html#jqueryusing
>  Google excellent option since if user already has been to site using same 
> source will have it cached probably not a good idea pulling your scripts from 
> jquery site Andrew243 wrote:I'm using jquery, and have treeview working using 
> src="http:// 
> dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.js"Now I want to 
> use datepicker, where can I access the .js file? I 
> triedhttp://view.jquery.com/trunk/plugins/datepicker/jquery.datepicker.js, 
> but that is not correct. My hosting service does doesn't have gzip 
> compression enabled, so I need to access it via a server that does. I'me very 
> new to jquery, so please provide the full URL I should use for the script 
> src. Thanks


[jQuery] Re: this.remove

2009-10-19 Thread Krommenaas

get it, thx guys!


[jQuery] Re: Call back function for Selectbox not working on IE..

2009-10-19 Thread zebamba

Resolved

On Oct 19, 8:51 am, zebamba  wrote:
> 
> $(document).ready(function()
> {
>    $("#place").change(function()
>     {
>       $.post("types.php",{
>           local:$('#place').val()
>           } ,function(data)
>         {
>          $('#types').html(data);
>                  $('#types').focus();
>             });
>     });});
>
> 
>
> .html(data) It does work fine on Firefox,  on  IE as usual and normal
> not working..
>
> The selectbox get empty and does not show the result from types.php
> that writes the new options
>
> May anybody help me with?


[jQuery] Re: this.remove

2009-10-19 Thread Smith, Allex

I this you want $(this).remove();

-Original Message-
From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
Behalf Of Krommenaas
Sent: Monday, October 19, 2009 10:11 AM
To: jQuery (English)
Subject: [jQuery] this.remove


I was wondering why in a link's click event...
  $('a.').click( function() {

this won't work...
   this.remove()

but this does work...
  $('#'+this.id).remove();

as will this...
$('a[name='+this.name+']').remove();

It's not a problem since I have these work-arounds, I'm just trying to
understand why this.remove() doesn't work. Tia.


[jQuery] Re: this.remove

2009-10-19 Thread Nick Fitzsimons

2009/10/19 Krommenaas :
>
> I was wondering why in a link's click event...
>  $('a.').click( function() {
>
> this won't work...
>   this.remove()
>
> but this does work...
>  $('#'+this.id).remove();
>
> as will this...
>    $('a[name='+this.name+']').remove();
>
> It's not a problem since I have these work-arounds, I'm just trying to
> understand why this.remove() doesn't work. Tia.
>

Because "this" in an event handler is a reference to the DOM node that
is the target of the event, not a jQuery object.

$(this).remove();

should work.

Relevant jQuery docs: 

Regards,

Nick.
-- 
Nick Fitzsimons
http://www.nickfitz.co.uk/


[jQuery] this.remove

2009-10-19 Thread Krommenaas

I was wondering why in a link's click event...
  $('a.').click( function() {

this won't work...
   this.remove()

but this does work...
  $('#'+this.id).remove();

as will this...
$('a[name='+this.name+']').remove();

It's not a problem since I have these work-arounds, I'm just trying to
understand why this.remove() doesn't work. Tia.


[jQuery] Re: Json works in firefox but not in ie

2009-10-19 Thread Patrik

Problem solved it was an extra , after the last {optionValue: '".
$b ."', optionDisplay: '". $b ."'} in the php file. firefox must have
ignored it while ie expected more.

On 19 Okt, 16:49, Greg Riley  wrote:
> You are setting options inside a function and then trying to reference
> it outside of that function.
>
> Try putting var options = ''; before that first line.
>
> On Oct 19, 10:22 am, Patrik  wrote:
>
> > Hi,
> > I have this code and it works well in firefox but in IE it dosn't.
> > How do I make it work in IE?
> > If I put alert(options) inside the loop I get all the values I want so
> > this far it's working but outside the loop if i call alert(options)
> > nothing happens. why?
>
> > $("select#kod").change(function(){
> >    $.getJSON("artnr-ajax.php",{value: $(this).val(), where: 'kod'},
> > function(j){
> >       var options = '';
> >       for (var i = 0; i < j.length; i++) {
> >          options += '' + j
> > [i].optionDisplay + '';
> >       }
> >       $("select#beteckning").html(options);
>
> > })


[jQuery] Re: jquery HTML file reading

2009-10-19 Thread Ajith G
will this refresh the page ?

On Sun, Oct 18, 2009 at 10:33 PM, Evgeny Bobovik  wrote:

>
> See example:
> $.ajax({
>   type: "POST",
>   url: "SERVLET.do",
>   data: "id=1&location=Minsk",
>   success: function(msg){
> //'msg' - is your returned html file
> $(document).html(msg); // this function replace your current page
> to returned page
>   }
>  });
>
>   Gk___
>
>
>
>
> 2009/10/18 ajith...@gmail.com :
> >
> > i have used jquery to maek an ajax call to the servlet .
> > the servlet is returning an HTML file , how can display the contents
> > of the HTML file .
> > please reply fast .
> >
>


[jQuery] Re: Where to access datepicker?

2009-10-19 Thread Charlie





path for jQuery is right in link I showed you
"http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js">

have to pull full UI.js if using Google but is probably better solution
than pulling from sites you are using now

link on same page

Andrew243 wrote:

  Hi Charlie,

Thanks --  but what is the HTML to use Google for jQuery and also for
datepicker.

I now use:
  "http://code.jquery.com/jquery-latest.js">

What is the equivalent for Google, and what would it be for
datepicker?

A

On Oct 19, 11:31 am, Charlie  wrote:
  
  
http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery
using Google excellent option since if user already has been to site using same source will have it cached
probably not a good idea pulling your scripts from jquery site
Andrew243 wrote:I'm using jquery, and have treeview working using src="" class="moz-txt-link-rfc2396E" href="http://dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.js">"http:// dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.js"Now I want to use datepicker, where can I access the .js file? I triedhttp://view.jquery.com/trunk/plugins/datepicker/jquery.datepicker.js, but that is not correct. My hosting service does doesn't have gzip compression enabled, so I need to access it via a server that does. I'me very new to jquery, so please provide the full URL I should use for the script src. Thanks

  
  
  






[jQuery] Re: Json works in firefox but not in ie

2009-10-19 Thread Patrik

Thanks but it didnt help and the reference is inside of the funktion
missed to put  }) }) in my message.

nothing inside the getJSON function will work after the closing } in
the for loop if i put alert("after"); won't show or anything else.

On 19 Okt, 16:49, Greg Riley  wrote:
> You are setting options inside a function and then trying to reference
> it outside of that function.
>
> Try putting var options = ''; before that first line.
>
> On Oct 19, 10:22 am, Patrik  wrote:
>
> > Hi,
> > I have this code and it works well in firefox but in IE it dosn't.
> > How do I make it work in IE?
> > If I put alert(options) inside the loop I get all the values I want so
> > this far it's working but outside the loop if i call alert(options)
> > nothing happens. why?
>
> > $("select#kod").change(function(){
> >    $.getJSON("artnr-ajax.php",{value: $(this).val(), where: 'kod'},
> > function(j){
> >       var options = '';
> >       for (var i = 0; i < j.length; i++) {
> >          options += '' + j
> > [i].optionDisplay + '';
> >       }
> >       $("select#beteckning").html(options);
>
> > })


[jQuery] Re: jQuery UI datepicker

2009-10-19 Thread Karl Swedberg

Hi there,

Would you mind posting this question to the jquery-ui google group if  
you haven't done so already? That group is dedicated to questions such  
as yours that are specifically related to jQuery UI.


http://groups.google.com/group/jquery-ui/

Thanks!

--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 19, 2009, at 6:52 AM, Thai Dang Vu wrote:


Hi everybody,

Is there any way to have the jQuery UI datepicker appearing as an  
image at first and then whenever we click on that image, the  
calendar will appear in a floating div (i.e. everything on the page  
isn't moved)?


Thank you.




[jQuery] Re: Get url from iframe

2009-10-19 Thread brian

I believe you can get it from the "src" attirbute.

On Mon, Oct 19, 2009 at 7:37 AM, Rupak  wrote:
>
> Hi all,
>
> I have an ifram in a page. iframe contains google.com (google search).
> from there if the user search for a "key word", i and click on a
> link.Is there a way to get the "url" of newly open page inside the
> iframe.
>
> Plz help me..
>
>
> thanks
> Rupak


[jQuery] Re: Where to access datepicker?

2009-10-19 Thread Andrew243

Hi Charlie,

Thanks --  but what is the HTML to use Google for jQuery and also for
datepicker.

I now use:
  http://code.jquery.com/jquery-latest.js";>

What is the equivalent for Google, and what would it be for
datepicker?

A

On Oct 19, 11:31 am, Charlie  wrote:
> http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery
> using Google excellent option since if user already has been to site using 
> same source will have it cached
> probably not a good idea pulling your scripts from jquery site
> Andrew243 wrote:I'm using jquery, and have treeview working using 
> src="http:// 
> dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.js"Now I want to 
> use datepicker, where can I access the .js file? I 
> triedhttp://view.jquery.com/trunk/plugins/datepicker/jquery.datepicker.js, 
> but that is not correct. My hosting service does doesn't have gzip 
> compression enabled, so I need to access it via a server that does. I'me very 
> new to jquery, so please provide the full URL I should use for the script 
> src. Thanks


[jQuery] Re: password initial value without masking "****"

2009-10-19 Thread Jörn Zaefferer
Instead of replacing the input, display a label above it. See
http://wiki.jqueryui.com/Watermark

Jörn

On Mon, Oct 19, 2009 at 4:17 PM, Liam Potter wrote:

>
> Here is how I do it. Just markup the form like normal (I use a definition
> list to lay out my forms)
>
>   $("input:password").each(function(){
>   var $currentPass = $(this)
>   $currentPass.css({opacity:0});
> $currentPass.before(' class="removeit" style="position:absolute;z-index:10;" />');
> var $visiblePassword = $(".removeit");
> $visiblePassword.focus(function () {
>   $(this).css({opacity:0});
>   $currentPass.focus().css({opacity:1});
>   });
> $currentPass.blur( function () {
>   if ( $currentPass.attr("value") == "" ){
>   $currentPass.css({opacity:0});
>   $visiblePassword.css({opacity:1}).attr("value","Password");
>   }
>   });
>   });
>
> waseem sabjee wrote:
>
>> ah yes i forgot.
>>
>> you would get access denied when tried to change an input type property
>>
>> the best way is to have two input types and just hide one and show the
>> other
>>
>> but i have a solution for you
>> the html
>>
>>
>>
>>
>>
>> the css
>>
>>
>>/*first we need to hide the password input*/
>>.passinput {
>>display:none;
>>}
>>
>>
>> the js
>>
>>
>>$(function() {
>>// declare your input types
>>var textinput = $(".textinput");
>>var passinput = $(".passinput");
>>// on text input focus - hide text input and show and focus
>> on password input
>>textinput.focus() {
>>textinput.blur();
>>textinput.hide();
>>passinput.show();
>>passinput.focus();
>>});
>>// on password input blud hide password input and show and
>> focus on text input
>>passinput.blur(function() {
>>passinput.blur();
>>passinput.hide();
>>textinput.show();
>>textinput.focus();
>>});
>>});
>>
>>
>> On Mon, Oct 19, 2009 at 2:51 PM, Marco Barbosa 
>> > marco.barbos...@gmail.com>> wrote:
>>
>>
>>Hi waseem!
>>
>>Thanks for your reply.
>>
>>Something's wrong with this line:
>>$("#password").attr({type:'text'});
>>
>>I tried changing to:
>>$("#password").attr('type','text'});
>>
>>but still no go.
>>I have to comment out to get the other JS stuff on the site working.
>>
>>The rest of the code seems Ok. What could it be?
>>
>>I like your solution, pretty simple :)
>>
>>I was wondering if we could put this inside the cleanField function
>>but I guess it's not necessary.
>>
>>~Marco
>>
>>
>>On Oct 19, 2:32 pm, waseem sabjee >> wrote:
>>> // set the initial type to text
>>> $(".mypasswordfield").attr({
>>>   type:'text'
>>>
>>> });
>>>
>>> // on user focus - change type to password
>>> $(".mypasswordfield").focus(function() {
>>>  $(".mypasswordfield").attr({
>>>type:'password'
>>>  });
>>>
>>> });
>>>
>>> // on user blur - change type to back to text
>>> $(".mypasswordfield").blur(function() {
>>>  $(".mypasswordfield").attr({
>>>type:'text'
>>>  });
>>>
>>> });
>>>
>>> since text is an attribute we can change it.
>>> all im doing is changing the type between password and text on
>>click and on
>>> blur
>>> let me know if this worked for you :)
>>>
>>> On Mon, Oct 19, 2009 at 11:21 AM, Marco Barbosa
>>> mailto:marco.barbos...@gmail.com>>wrote:
>>
>>>
>>>
>>>
>>>
>>>
>>> > Hi!
>>>
>>> > I'm trying to achieve something like the Facebook first page (when
>>> > you're not logged in).
>>>
>>> > I'm using this simple function/plugin to clean the fields once you
>>> > click them:
>>> > $.fn.cleanField = function() {
>>> >return this.focus(function() {
>>> >if( this.value == this.defaultValue ) {
>>> >this.value = "";
>>> >}
>>> >}).blur(function() {
>>> >if( !this.value.length ) {
>>> >this.value = this.defaultValue;
>>> >}
>>> >});
>>> > };
>>> > // clean the fields
>>> > $("#login").cleanField();
>>> > $("#password").cleanField();
>>>
>>> > So If I click Login or Password, it will clean and the user
>>can type
>>> > the new value.
>>> > It works good but there's a little usability problem here.
>>>
>>> > I want to display the Password field like: "Your password here"
>>> > i

[jQuery] Call back function for Selectbox not working on IE..

2009-10-19 Thread zebamba


$(document).ready(function()
{
   $("#place").change(function()
{
  $.post("types.php",{
  local:$('#place').val()
  } ,function(data)
{
 $('#types').html(data);
 $('#types').focus();
});
});
});


.html(data) It does work fine on Firefox,  on  IE as usual and normal
not working..

The selectbox get empty and does not show the result from types.php
that writes the new options

May anybody help me with?


[jQuery] Re: Why does slideUp set also set display: block?

2009-10-19 Thread Charlie





something wrong here slideUp is an animation  hide function that
returns inline style "display:none"

are you meaning slideDown? If so what causes problem?

Shhnap wrote:

  Essentially, whenever I run the slideUp() function the css 'display'
property of that element is set to block. However this is not always
what I want; infact it is not what I want alot of the time and I have
taken to handling it via a callback function to clear the display
property but surely there is a nicer way to do this?

Anyway, my question is, why does the slide up function behave in this
manner?

Thanks,
Shhnap

  






[jQuery] Can't insert JavaScript using html function

2009-10-19 Thread Ron

Hi all.  I stumbled upon something which may be by design in jQuery
for security reasons, it may be the browsers doing it, but...  I found
that any JavaScript I try to put into the html of an object is
ignored.  For example, say username is a variable that was already
defined with the user's name:

$("#test").html("Hi there document.write(username);.");

All the script is just stripped out, in both IE and Firefox.

Any ideas what is going on?


[jQuery] .html(data) in Select Box Not working

2009-10-19 Thread zebamba

I have this function:


$(document).ready(function()
{
   $("#place").change(function()
{
  $.post("types.php",{
  local:$('#place').val()
  } ,function(data)
{
 $('#types').html(data);
 $('#types').focus();
});
});
});


I does work fine on firefox.. but as normal on IE does not load the
result form types.php...
.html(data) is not showing up.

May anybody help me with?


[jQuery] Re: Where to access datepicker?

2009-10-19 Thread Charlie





http://code.google.com/apis/ajaxlibs/documentation/index.html#jquery

using Google excellent option since if user already has been to site
using same source will have it cached

probably not a good idea pulling your scripts from jquery site

Andrew243 wrote:

  I'm using jquery, and have treeview working using src="" class="moz-txt-link-rfc2396E" href="http://dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.js">"http://
dev.jquery.com/view/trunk/plugins/treeview/jquery.treeview.js"

Now I want to use datepicker, where can I access the .js file?

I tried http://view.jquery.com/trunk/plugins/datepicker/jquery.datepicker.js,
but that is not correct.  My hosting service does doesn't have gzip
compression enabled, so I need to access it via a server that does.

I'me very new to jquery, so please provide the full URL I should use
for the script src.

Thanks

  






[jQuery] jQuery.get does not return proper JSON

2009-10-19 Thread Maarten

Hi,

I am using jQuery.get to make an AJAX request to the server which
should return a JSON object, but it is interpretated by jQuery as a
string, not an object.

Here is the javascript code I use:

$.get(this.href, function(data) {
  console.log(data);
  console.log(data.votes_for);
  console.log(typeof data);
}, "json");

And this is the PHP code on the server side.

echo header('Content-type: application/x-json');
echo '{"votes_for":7,"votes_against":4}';
die();

I do not use getJSON because I want to make one request which could
return in a JSON object, or just a string, depending on some
conditions.

Can anyone help me out? Thanks in advance!

Regards,
Maarten


[jQuery] Re: jquery validation using thickbox

2009-10-19 Thread Mattycrocks


I've encountered a similar problem with something I'm doing. Current project
is using asp.net 2 webforms which is a pain but that's the boundaries of
this project. 

Context: I have a Gridview which is databound with some html buttons and
then these buttons are wired up in jquery so that when clicked, they use
thickBox to display a div with various inputs and block the rest of the UI.
When that form is submitted I am using the Validation plug-in to validate
the inputs in the thickBox div. However the validation doesn't work. Digging
into this further - it doesnt validate the inputs in the thickBox at all.
Using firebug and visual event - i noticed that when thickBox(also tried
this with blockUI plug-in) displays the form - it clones the dom element (in
this case a div) and appends it outside of the form tags in the page and
into the thickBox divs. Because the div has been cloned and removed  and
placed somewhere outside of the pages form tag - the inputs aren't seen by
the validation plug-in. Hence calling isValid() on the validator object
returns true but the inputs are not validated as they aren't considered part
of the form. 

I'm working/looking for a solution now but if anyone has any suggestions
please fire back. Of course in asp.net 2 - you can only have one form
control.  

Is this similar to your problem?

Matt



Phill Pafford wrote:
> 
> Did you ever find a solution? I'm facing the same problem.
> 
> Thanks,
> --Phill
> 
> 
> 
> bookme wrote:
>> 
>> 
>> Hi,
>> 
>> Sorry to bother you but I am not able to solve this problem so posting
>> in forum
>> 
>> I am using two jquery plugin
>> 1 Thickbox
>> 2 Jquery validation
>> 
>> Without thickbox validation is working fine but validation is not
>> working in thickbox.
>> 
>> There is two files ajaxLogin.htm and second is index.html
>> 
>> ajaxLogin.htm :
>> 
>> 
>> > script>
>>