www.webdeveloper.com

Search:

Type: Posts; User: toicontien

Page 1 of 5 1 2 3 4

Search: Search took 0.13 seconds.

  1. Replies
    2
    Views
    828

    Prototype If you want a more declarative way, plus the...

    If you want a more declarative way, plus the support of inheriting class level properties and mixins (ala Ruby), use this:
    ...
  2. Replies
    4
    Views
    743

    jQuery Regular expressions are your friend: ...

    Regular expressions are your friend:



    function makeBold(s) {
    return s.replace(/\('(.*?)'\)/g, "<b>$1</b>");
    }
  3. Poll: I would recommend making one Ajax request for...

    I would recommend making one Ajax request for each table, but staggering them by, say, 300 ms, and doing them in batches of 5.

    This gives you several advantages:

    1) The real processor heavy...
  4. Replies
    6
    Views
    811

    You do not want to use a for-in loop to iterate...

    You do not want to use a for-in loop to iterate over an Array object. A for-in loop serves a very different purpose: It iterates over all the properties in an object. You want to use a regular loop...
  5. Replies
    1
    Views
    156

    This is correct: ABC.prototype.newMethod =...

    This is correct:

    ABC.prototype.newMethod = function(){} //to create a new method

    This is incorrect:

    ABC.prototype = function() { ... }

    What you may be looking for is:
  6. Replies
    3
    Views
    47

    The difference between: var foo = function()...

    The difference between:

    var foo = function() {};

    and

    function foo() {}

    Is that when the browser parses the JavaScript file, it will make functions declared as "function foo() {}"...
  7. Replies
    3
    Views
    46

    You need to bind the "this" variable to a...

    You need to bind the "this" variable to a different context, and assign the function object reference to the onclick.

    Function.prototype.bind is included in the newer versions of the ECMAScript...
  8. I wonder if the cursor isn't updating because of...

    I wonder if the cursor isn't updating because of a screen redraw bug. Try setting the visibility to hidden and back after changing the cursor:

    function chcursor (element)
    {
    element.style.cursor...
  9. Is there a close() method you should be using...

    Is there a close() method you should be using instead?

    panelinstance.close();
    panelinstance = null;
  10. objects_array[i].childNodes[0].childNodes[0].inner...

    objects_array[i].childNodes[0].childNodes[0].innerHTML = '<sup>(' + (i+1) + ')</sup>';
  11. I had the logic a little wrong. The regular...

    I had the logic a little wrong. The regular express tests to make sure those characters are not there. Revised code is below:

    var invalidChars = /[!@#^\&\*\(\)_=\{\}\[\]\\|:;“‘<>,\?]/;

    if...
  12. Regular expressions are your friend in this case:...

    Regular expressions are your friend in this case:

    var invalidChars = /[^!@#^\&\*\(\)_=\{\}\[\]\\|:;“‘<>,\?]/;

    if (str.match(invalidChars)) {
    alert("Bad characters!");
    }
    else {
    ...
  13. myVar is a global variable, so you don't need to...

    myVar is a global variable, so you don't need to include that in the function definition:

    var myVar='342';

    myElement.onpaste = function() {
    alert(myVar);
    };

    Or if you do not want to use...
  14. Replies
    1
    Views
    61

    Object size The only problem I see here relates...

    Object size
    The only problem I see here relates to performance: RAM and the processing time it takes to traverse the object tree. From what I gather, a mobile version is probably out of the...
  15. Since you are creating new DOM nodes by inserting...

    Since you are creating new DOM nodes by inserting a string using the innerHTML property of a DOM node, the document.forms collection is probably not getting updated with the new form.

    You'll have...
  16. jQuery Since you are referencing HTML tag Ids, you could...

    Since you are referencing HTML tag Ids, you could wrap each call to jQuery with:

    if (document.getElementById("my_id")) {
    $("#my_id").waypoint( ... );
    }
  17. Every form object has a reset(); method that...

    Every form object has a reset(); method that natively does exactly what you want.


    document.getElementById("my_form").reset();

    ...

    <form id="my_form> ... </form>
  18. These blog posts might help: ...

    These blog posts might help:

    http://www.quirksmode.org/mobile/viewports.html

    http://www.quirksmode.org/mobile/viewports2.html
  19. Replies
    2
    Views
    504

    Try returning false at the end of each click...

    Try returning false at the end of each click handler. This will cancel the click event and short circuit any default actions taken by the browser after processing a click event on an <a> tag.
  20. a = $(document.body); b = $('body'); a === b;...

    a = $(document.body);
    b = $('body');
    a === b; // false [despite them appearing to be exactly the same]


    "a === b" is false because you are comparing two different object pointers. The return...
  21. You need to take advantage of a function closure...

    You need to take advantage of a function closure to maintain the value of pasando when the DOM events are fired:

    function createMouseover(pasando) {
    return function() {...
  22. Replies
    3
    Views
    575

    Neither way for this particular problem....

    Neither way for this particular problem. Furthermore, I've used many different ways, depending on the situation. The first question is, do you need to maintain state?

    If not, then a simple...
  23. Replies
    4
    Views
    422

    Object oriented JavaScript is useful even for...

    Object oriented JavaScript is useful even for simple things. Writing modular and reusable code is always a good idea --- even if all you are doing is processing a form submit, running some...
  24. Replies
    1
    Views
    369

    If using jQuery: ...

    If using jQuery:


    jQuery.delegate("form[name=product_form]", "submit", function(event) {
    event.preventDefault();
    event.stopPropagation();
    // code to update your shopping cart
    });

    The...
  25. Replies
    2
    Views
    407

    <td class="t3Cell col1"><strong><c:write name="payment" property="paymentdate" format="MM/dd/yyyy" /></strong></td>
Results 1 to 25 of 120
Page 1 of 5 1 2 3 4
HTML5 Development Center



Recent Articles