dcsimg
www.webdeveloper.com

Search:

Type: Posts; User: mrhoo

Page 1 of 20 1 2 3 4

Search: Search took 0.05 seconds.

  1. Replies
    8
    Views
    1,547

    Array's apply method uses the array passed as a...

    Array's apply method uses the array passed as a second parameter as the arguments object of the function being applied to.


    function findMax(){
    var i, max= 0;
    for(i= 0;...
  2. You can write a regular expression that matches a...

    You can write a regular expression that matches a string if it contains only digits, or only digits and alphas.

    var rx=/^((\d+[a-zA-Z\d]*)|([a-zA-Z]+\d+[a-zA-Z\d]*))$/;

    ^matches the start of...
  3. You can instantiate a new object within its...

    You can instantiate a new object within its constructor, making the new keyword optional.




    function User(first, last){
    if(!(this instanceof User)) return new User(first, last);
    ...
  4. Replies
    1
    Views
    574

    Other 'This is a day' is only used once in your...

    'This is a day' is only used once in your example.

    It is unclear how you are measuring density- 2 is 8 and a third percent of 24, but the density should take into account the size of your keyword,...
  5. Replies
    4
    Views
    8,989

    You can use the comma insertion method here, but...

    You can use the comma insertion method here, but it is annoying to insert things while the user is typing.

    Better to use it once- onchange, or just before submitting, whenever you validate the...
  6. 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 '?
  7. Replies
    1
    Views
    1,055

    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-

    ...
  8. // 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(',')[
    ...
  9. Replies
    4
    Views
    1,863

    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.
  10. Replies
    2
    Views
    2,416

    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...
  11. Replies
    1
    Views
    1,483

    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.
  12. 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-...
  13. Replies
    1
    Views
    4,183

    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...
  14. 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')+...
  15. 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,...
  16. 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>
    ...
  17. <!doctype html>
    <html lang="en">
    <head>
    <meta charset= "utf-8">
    <title>nth days</title>

    </head>
    <body>
    <ul>
    <script>
  18. Replies
    2
    Views
    237

    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...
  19. Thread: generator txt

    by mrhoo
    Replies
    2
    Views
    184

    google combinations and permutations.

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

    // Pass the empty string

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

    I find that burying it in the garden works well.

    I find that burying it in the garden works well.
  22. 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...
  23. 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...
  24. Thread: Military Code

    by mrhoo
    Replies
    11
    Views
    4,422

    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;}
  25. Replies
    11
    Views
    1,841

    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.
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4
HTML5 Development Center



Recent Articles