www.webdeveloper.com

Search:

Type: Posts; User: mrhoo

Page 1 of 5 1 2 3 4

Search: Search took 0.08 seconds.

  1. Where does str come from in your code, and why...

    Where does str come from in your code, and why are you splitting it on a space instead of 'x' or ' x '?
  2. Replies
    1
    Views
    468

    You are finding 4 digits, as requested by your...

    You are finding 4 digits, as requested by your pattern.

    If you want to restrict the match to strings that only contain 2-4 digits and nothing else, flag the beginning and end of the string-

    ...
  3. // I prefer to let the machine do the work- ...

    // I prefer to let the machine do the work-



    function dowFromDmy(input){
    var M= input.value.match(/(\d+)/g);
    if(M){
    return 'Sun,Mon,Tues,Wednes,Thurs,Fri,Sat'.split(',')[
    ...
  4. Replies
    4
    Views
    1,128

    You have around 30000 characters, if you type an...

    You have around 30000 characters, if you type an average 40wpm you could do it in about 3 hours.

    Knowing what to type, and possibly testing it as you write, takes longer.
  5. Replies
    2
    Views
    1,289

    You'd be better off comparing top.location.href...

    You'd be better off comparing top.location.href and location.href, since some browsers have a separate location object for top and child location objects, even it they have the same href. Two objects...
  6. Replies
    1
    Views
    1,086

    Prototype excuse it- I neglected to see your assigning via...

    excuse it- I neglected to see your assigning via innerHTML, which doesn't work for table cells in older IE's.
  7. Use strings instead of numbers- you can...

    Use strings instead of numbers- you can alert(number.toString(8))

    to return 106341417 in most browsers, but it is an error in strict code,

    and no number except 0 in any base begins with a zero-...
  8. Replies
    1
    Views
    1,660

    Forget the local offset, it has no relevance to...

    Forget the local offset, it has no relevance to other timezones.

    Use UTC time methods- for each timezone, add the offset (positive or negative) to the UTC time, then read the UTC properties, and...
  9. You can replace the operators with themselves...

    You can replace the operators with themselves followed by a newline.


    function calc(strIn){
    strIn= strIn.replace(/[^\.\d*\/+-]+/g, '');
    var tarrN= strIn.replace(/([\D\.]+)/g, '$1\n')+...
  10. Most browsers implement the Array method...

    Most browsers implement the Array method .indexOf(what, i),
    which returns the first index at which its value is found(starting at i, or 0 if not specified).
    If the value is not found in the array,...
  11. I meant to edit the previous post but waited too...

    I meant to edit the previous post but waited too long- this is a simpler version of the same script-

    <!doctype html>
    <html lang="en">
    <head>
    <meta charset= "utf-8">
    <title>nth days</title>
    ...
  12. <!doctype html>
    <html lang="en">
    <head>
    <meta charset= "utf-8">
    <title>nth days</title>

    </head>
    <body>
    <ul>
    <script>
  13. Replies
    2
    Views
    24

    var s='abcd2DPM_0361.DSS|1588224:...

    var s='abcd2DPM_0361.DSS|1588224: abcdinterv120808wc.doc|28672: abcdDPM_0360.DSS|563712: abcd3_0365.DSS|1565184: Abcd_Last-GK.DSS|771072:';

    s.replace(/\|[^:]*\:/g,' '); //replace pipe followed by...
  14. Thread: generator txt

    by mrhoo
    Replies
    2
    Views
    23

    google combinations and permutations.

    google combinations and permutations.
  15. // Pass the empty string function...

    // Pass the empty string

    function highlightControl(ctl, mode){
    document.getElementById(ctl).style.borderColor= mode== 'on'? 'red':'';
    }
  16. Replies
    4
    Views
    60

    I find that burying it in the garden works well.

    I find that burying it in the garden works well.
  17. When you use number.toFixed() with no argument...

    When you use number.toFixed() with no argument you convert number to an integer with no decimal.
    number.toFixed(10) may be what you need.

    If you want to include trailing zeroes for numbers with...
  18. You are subtracting item.x while you are defining...

    You are subtracting item.x while you are defining it- nothing to do with regular expressions.


    var itm={canvas:{width:100},sprite_width:50};
    itm.x = itm.canvas.width / 2 - itm.sprite_width / 2...
  19. Thread: Military Code

    by mrhoo
    Replies
    11
    Views
    1,443

    This is another approach. ...

    This is another approach.


    <!doctype html>
    <html lang="en">
    <head>
    <meta charset= "utf-8">
    <title>Military Jargon</title>
    <style>
    body{font-size:125%;margin:1em;}
  20. Replies
    11
    Views
    917

    slice will return a (shallow) copy of the indexed...

    slice will return a (shallow) copy of the indexed array items, not any custom properties you have added.
  21. Thread: div.onresize

    by mrhoo
    Replies
    1
    Views
    665

    https://developer.mozilla.org/en/DOM/element.onres...

    https://developer.mozilla.org/en/DOM/element.onresize

    According to MDN, only the window has a resize event.
  22. Replies
    11
    Views
    917

    That's called a shallow clone, and makes copies...

    That's called a shallow clone, and makes copies of arrays of primitives- (strings, numbers, booleans, undefined).

    If you are cloning an object with properties that are objects, (including arrays)...
  23. Replies
    11
    Views
    917

    You have an array with two indexed elements and...

    You have an array with two indexed elements and four named properties.
    It is as much code to clone it as to write a new one.


    var NAMEDONS= ["George", "Elisabeth"];
    NAMEDONS["George "]=...
  24. It is easy with 2 expressions- var...

    It is easy with 2 expressions-


    var equalAandB=(str.match(/a/g) || []).length === (str.match(/b/g) || []).length;
  25. Replies
    1
    Views
    363

    open a new window, document.write the innerHTML...

    open a new window, document.write the innerHTML string, call print from the new window.
Results 1 to 25 of 120
Page 1 of 5 1 2 3 4
HTML5 Development Center



Recent Articles