[jQuery] Re: Newbie validator question/problem

2009-11-16 Thread Henry
On Nov 15, 2:45 am, sprach wrote:

> ... .  In the code
> above, firebug claims that form.submit() is not a function.

The DOM allows named form controls to be accessed as named properties
of the FORM element object. However, the FORM elements have a set of
properties/methods of their own, including the - submit - method. So,
in the event that any form control has the same name as a pre-existing
property of the FORM element the reference to the form control
replaces the value of the pre-existing property of the FORM element.

If one of the form controls you are using (say a submit button) has
the name 'submit' a reference to that button would replace the FORM
element's - submit - method, and so if you attempted to call the
method the browser's error reporting mechanism would tell you that
what you were trying to call was 'not a function'.

Javascript is case sensitive so this sort of issue can be addressed by
applying a simple naming strategy to form controls, such as giving
each an initial capital letter in their name.


Re[jQuery] garding Tablesorter

2009-11-08 Thread Henry Loke

Regarding Tablesorter [http://tablesorter.com/]

My table contain the column called No. ( Number ).

No., Name, Age,

When I sorted by Name, The arrangement of No. sorted.

Is there has a way, to dead fixed on No. column ( Column No. not sorted
example it will showed 1., 2., 3. ...etc)  but able to sort Name and Age
according?

Thanks

-fsloke

-- 
View this message in context: 
http://old.nabble.com/Regarding-Tablesorter-tp26252007s27240p26252007.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.



[jQuery] Dropdown menu top and left border Superfish

2009-06-19 Thread Henry

Hi,

How can I take off the top and left border that shows on my menu?
Thx
Henry


[jQuery] Re: Invalid Argument in IE7/8

2009-03-13 Thread Henry

Nic Hubbard wrote:
> Ok, I removed all instances of the cycle plugin when it is
> not needed.  But, this has not fixed the problem in IE7/8.
>
> Why would it be saying that jQuery.js is the file with the
> problem?

IE browser throw an "invalid argument" error when attempts are made to
apply nonsensical values to CSS style properties, such as an attempt
to set a width or height to a negative value.  If that sort of thing
is the cause of your error then it is happening in the jQuery file
because that is where the property is actually being set, but the real
error will be wherever the nonsensical value is passed as an argument
to the jQuery function/method call.


[jQuery] Re: JQuery effects not working in Internet Explorer 6

2009-02-06 Thread Henry

On Feb 6, 10:30 am, Tintin81 wrote:
> I am new to Javascript and implemented a few nice JQuery
> features on http://new.designbits.de";>my new
> website . All of them work great in Firefox and Safari.
>
> In IE6, however, the site looks like a mess, even with
> Javascript enabled in the options panel.


There are two JScript errors reported as that page loads in IE. The
first is a complaint about a missing ';' (and you will have to track
down yourself), the second is in your functions.js file where you
have:-

$.extend($.validator.messages, {
 required: "",
email: "",
});

- in which an object literal's contents end in a comma. This is a
syntax error by ECMAScript rules, and so should be expected to be a
syntax error in browsers that implement the ECMAScript standard (such
as JScript in IE (more or less)). The ECMA standard allows syntax
extension and JavaScript(tm) (and good JavaScript(tm) imitators) take
advantage of that to be more tolerant of commas at the end of object
literal contents than they need to be (as the extra commas do not
result in ambiguities). JScript doesn't and so sees the comma as a
syntax error, and so that is a very likely cause of differences in
behaviour between IE and other browsers. Particularly if the behaviour
on IE looks like total failure to act on a script.


[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Henry

Eric Garside wrote:
> $('input[name="' + obj.name + '"]').attr('checked', false);


And if the same page contains INPUT elements with the same name either
inside another form or outside of any form? It seems like a good idea
to use - obj.form - to restrict the context of the search, and even if
not necessary with the mark-up actually being used the restricted
search should still be quicker.


[jQuery] Re: Correct way using Jquery

2009-01-08 Thread Henry

jq noob wrote:
> Sorry this might be really simple but there is a reason my
> nickname is jq noob! I was wondering how to convert this JS
> function into proper Jquery code.

"Correct" and "proper" are going to be very much influenced by various
people's opinions. You have not explained what - obj - is expected to
be in your function. It looks like it could be an 
element, but it could also be any JS object that happens to have a -
name - property that corresponds with the name of a set of  elements in a form with the name (or possibly ID)
"editResource". This leads to some guessing, but my guess is that the
question you want the answer to is; given a reference to an  element, how to use JQuery to assign a - false - value
to the - checked - property of all of the like-named "radio" elements
in a form named "editResource" (though if you started with an  element from inside the form then you can get a
reference to the containing form from the element's - form - property
and so could use that as a context and so not need to know the name of
the form).

Disregarding the JQuery aspect of this, there are two important
javascript issues that you would benefit form learning about.

> function uncheckRadio(obj) {
>   var choice = eval("document.editResource." + obj.name);

Historically the - eval - function has been misused, and here you seem
to have an example of its most common (and unnecessary) abuse; the
runtime construction of string representations of dot notation
property accessors and then - eval -ing them in order to resolving the
property accessor. In addition to "dot notation" property accessors,
javascript has "bracket notation" property accessors, and bracket
notation property accessors do a runtime evaluation of an expression
and a type-conversation to a string, and then use that string as the
name of the property to be looked up.  See:-

http://www.jibbering.com/faq/faq_notes/square_brackets.html >

Thus:-

var choice = eval("document.editResource." + obj.name);

- can be replaced with:-

var choice = document.editResource[ obj.name ];

- and achieve the same outcome, but faster (about 7 to 80 times
faster, depending on the browser/js-engine).

(If - obj - does happen to be a reference to an 
element in the ' editResource' form then the above property accessor
could also be re-written as:-

var choice = obj.form[ obj.name ];

- allowing the FORM to be handled anonymously.)

>   for (i = 0; i < choice.length; i++)

There is a general programming axiom that no variable should ever be
given more scope than it absolutely needs. Above you have - i = 0 -,
and that is an assignment to a property of the global object with the
name "i", which to all practical purposes is an assignment to a global
variable. But the - i - variable is a loop counter and loop counters
generally don't need to be in scope outside of the loop that uses
them. However, javascript's smallest scoping unit is the function. It
is never possible for a variable to be less visible than being visible
to the entire body of a function, but that still means that a loop
counter variable that does not need to be visible outside of its loop
should not have a scope that extends beyond the body of the function
in which the loop appears (it should not have more scope, but cannot
have less).

Thus - i - should be declared with the - var - keyword inside the
function. Making it a local variable (local to the function) rather
than its ending up as what is effectively a global variable.

In the function above that change would have no impact on how anything
worked (except the resolution of a local variable should be, very
fractionally, faster than the resolution of a global variable), but
the consequences of allowing variables more scope than they need might
be illustrated by considering what happens if, in the body of the loop
above, another function was called and that function also contained a
loop using an undeclared (so also global) - i - variable as its
counter (and habitually using the same identifiers for loop counters
is completely normal and common).  When the contained function is
called its loop updates the global - i - variable, and when the
function returns and the fist loop iterates it looks at the, now
modified, global - i - and probably does the wrong thing (prematurely
terminates, or loops for eve, or some such).

>   {
>   choice[i].checked = false;
>   }
> }


[jQuery] Re: warning: jquery in firefox 3

2008-11-28 Thread Henry

On Nov 27, 5:58 am, codz wrote:
> hello everyone,
>
> i just want to ask anybody about this warning that
> always show whenever my page load with the jquery.js file.
>
> Warning:
>
> test for equality (==) mistyped as assignment (=)?
> Source File:http://localhost:2008/jquery.js
> Line: 1161, Column: 32
> Source Code:
>while ( elem = second[ i++ ] )

For a very long time it has been a common error in javascript to write
a single equals sign when attempting comparison. It can be a
misconception (where novices are concerned), a typo from even very
experienced javascript authors or, say, a momentary laps of
concentration from someone who switches between many languages
regularly.

So when Firefox sees an assignment operation in a context where
comparison would be more expected (such as the expressions for - if -,
- while - and so on) it puts up this warning to make it easier for the
programmer to find their mistakes.

One way of handling this to impose a bit of code 'style' discipline;
if you mean to use assignment in the expression of an - if -, - while
-, etc. statement you wrap parentheses around it. Thus - while ( elem
= second[ i++ ] ) - becomes - while ( (elem = second[ i++ ]) ) - and
then warnings stop. Thus the (otherwise superfluous) parentheses
perform two functions; they stop the warning and they act as a flag to
indicate that you really meant to be doing assignment instead of
comparison. Meaning that when you see assignment in one of those
contexts without the wrapping parentheses it would be correct to start
of suspecting a programmer error, while without the parentheses every
occurrence of a single equals sign in and - if - expressions looks
suspicious.

> anonymous function does not always return a value

That statement is technically false. All javascript function calls
return a value (always). If they don't return through an explicit
return statement then they return the undefined value (which is still
a value in javascript), if they return through a return statement that
does not have an expression then they also return the undefined value,
else they return through a return statement that has an expression and
the function call returns the value of that expression (which may
still be the undefined value).

Firefox's 'warnings' often make statements that are factually false.

This warning is about promoting a particular 'style' in code
authoring; it is felt that if any path through a function's code ends
in an explicit return statement (and especially one with an
expression)  then all possible paths through that function's code
should end with such a statement. It can be seen as an expression of
the completeness of the author's perception of the logic of the code
in the function; he/she has perceived all the possible paths through
the function (marking the end of each with an explicit return
statement), and so has not failed to observe some of the ways out of
the function.

'Style' (if not externally imposed (by, for example, an employer)) is
often seen as a matter of opinion and personal judgment. Personally I
like this particular style rule, but many others do not. I don't
particularly like the fact that Firefox/JavaScript(tm) elect to tell a
lie in there attempt to promote it. That is probably
counterproductive.

The thing to do with code 'style' rules is to apply critical judgment
to the rationale behind them and see what you think of the reasoning.
If you are convinced you will use them, and if the arguments are not
convincing then the 'rule' probably was not worth that much to start
with.

> Source File:http://localhost:2008/jquery.js
> Line: 1859, Column: 71
> Source Code:
>});
>
> anonymous function does not always return a value
> Source File:http://localhost:2008/jquery.js
> Line: 3524, Column: 20
> Source Code:
> this[0][ method ];
>
> though this warning show, it does not affect my entire
> program.

No, everything should run just the same, though probably very
fractionally slower as it must take some time to recognise the
subjects of the warnings and make the reports of those warnings.

> i hope that all of you can make me understand about this
> or maybe solve this stuff.

There is nothing to solve, they are just warnings. It is errors that
you should worry about, and if the warnings start to get in the way of
seeing the errors filter the warnings out.


[jQuery] would compressing & merging multiple jquery & plugin's violate any license?

2008-11-10 Thread henry

would compressing & merging multiple jquery & plugin's into 1 JS file
violate any license?


[jQuery] Re: validate - integrating with wordpress

2008-10-31 Thread Henry

OMG! That's perfect! thank you.



On Oct 30, 6:32 pm, Mason <[EMAIL PROTECTED]> wrote:
> Henry, this should help:
>
> http://nettuts.com/tutorials/wordpress/adding-form-validation-to-word...
>
> On Oct 30, 6:54 pm, Henry <[EMAIL PROTECTED]> wrote:
>
> > I'm sorry. Maybe I'm over my head here. But I found a aWordPresssite
> > that had the jquery-validateinstalled and decided to see if I could
> > make it work on my site, but I'm really confused to how to install it.
> > Does it work as a plug-in or do I have to hard code it in the html of
> > the pages.
>
> > Again, sorry for being so green on this.
>
> > Sincerely,
>
> > Henry


[jQuery] validate - integrating with wordpress

2008-10-30 Thread Henry

I'm sorry. Maybe I'm over my head here. But I found a a WordPress site
that had the jquery-validate installed and decided to see if I could
make it work on my site, but I'm really confused to how to install it.
Does it work as a plug-in or do I have to hard code it in the html of
the pages.

Again, sorry for being so green on this.

Sincerely,

Henry


[jQuery] Re: Toggle doesn't perform well in Safari and crashes Chrome

2008-09-13 Thread Matt Henry

toggle() takes two functions as arguments, so your

$("div#menuchild_1").toggle(
SHOW_FUNCTION
 HIDE_FUNCTION
);
On Sep 12, 4:32 pm, robertaugustin <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm having a problem with jquery's toggle function in Safari 3.1.2 and
> Google Chrome, maybe one of you knows the issue and can help...
>
> Here's the code:
>
> ***CODE
> //For each menu button, toggle its child div (containing child menu
> items) while hiding the others if they are open
> $(document).ready(function(){
>         $('div.menuchild').hide();
>         $("a.menuchild_1").click(function(){
>                 $("div#menuchild_1").toggle();
>                 $("div#menuchild_2:visible").hide();
>                 $("div#menuchild_3:visible").hide();
>                 return false;
>         });
>         $("a.menuchild_2").click(function(){
>                 $("div#menuchild_2").toggle();
>                 $("div#menuchild_1:visible").hide();
>                 $("div#menuchild_3:visible").hide();
>                 return false;
>         });
>         $("a.menuchild_3").click(function(){
>                 $("div#menuchild_3").toggle();
>                 $("div#menuchild_1:visible").hide();
>                 $("div#menuchild_2:visible").hide();
>                 return false;
>         });
>
> });
>
> /CODE
>
> All div#menuchild_1,2,3 have a background-image. They also contain
> another div that closes that background at the top (think rounded
> corners).
>
> Now I'm sure this could be done more quickly using variables and not
> hardcoding it :) But it works fine for now - except for Safari and
> Chrome:
>
> - In Safari, the div#menuchild_1,2,3 that pop up are broken
> (background-image doesn't show fully) UNTIL you move the mouse over
> the div. This means that the background image isn't positioned
> correctly (it's set to "no-repeat bottom left"), but somewhere in the
> vertical middle of the div. Also, the contained div doesn't show at
> all before the mouse moves over it.
>
> - Google Chrome seems to work but regularly crashes ("Snap, something
> went wrong...") when you try to click on the parent menu items
> repeatedly and quickly.
>
> Not sure if Webkit is having a problem here or if my code is... emm...
> worthy of improvement. Any help will be appreciated!


[jQuery] Re: How to load remoate jquery code with document.write() that works with IE6/7?

2008-09-11 Thread henry

Thanks, I will try that.

On Sep 11, 4:09 am, Alex Weber <[EMAIL PROTECTED]> wrote:
> check this thread 
> out:http://groups.google.com/group/jquery-en/browse_thread/thread/f427781...
>
> its mainly about loading multiple libraries but the concept of
> appending elements to the DOM vs using document.write() might work for
> you :)
>
> On Sep 10, 4:39 pm, henry <[EMAIL PROTECTED]> wrote:
>
> > I have a problem with IE (6 & 7) when I have something like this:
>
> > http://domain.com/</a>
> > generateCode.php">
>
> > and the server returns HTML and JS in place using document.write(),
> > such as:
>
> > 
> >     document.write('
> >         <div id="x">TESTING</div>
> >         <script type="text/javascript" src="<a  rel="nofollow" href="http://domain2.com/">http://domain2.com/</a>
> > jquery.js">
> >         
> >         $().ready({
> >             $('#x').css("color:red");
> >         });
> >     );
> > 
>
> > IE6 & IE7 would give me script error, Error: Object expected.  But FF
> > is fine.
>
> > I found 2 solutions,
>
> > a.) use defer="true"
> > http://domain.com/</a>
> > generateCode.php" defer="true">
>
> > b.) server returns JS that use window.onload instead of $().ready()
>
> > Are there any other solutions?
>
> > Thank you


[jQuery] How to load remoate jquery code with document.write() that works with IE6/7?

2008-09-10 Thread henry

I have a problem with IE (6 & 7) when I have something like this:

http://domain.com/
generateCode.php">


and the server returns HTML and JS in place using document.write(),
such as:


document.write('
TESTING