Please help me with this, simple idea

Discussion in 'Javascript' started by helpfulmaid@gmail.com, May 8, 2007.

  1. Guest

    Hello, I want a function that when it detects the left mouse button is
    pressed down, will generate and cycle 5 random number/letter
    combinations as fast as it can in a printed space. If I let off the
    mouse button then it should stop, and it can re-start again when
    pressed, etc..... can someone help help? :)
     
    , May 8, 2007
    #1
    1. Advertising

  2. Guest

    Lol, thanks for throwing cold water over my theory... I have heard
    rumors about you! Please don't post to this thread or it will be
    considered harassment and treated as such.
     
    , May 8, 2007
    #2
    1. Advertising

  3. Evertjan. Guest

    wrote on 08 mei 2007 in comp.lang.javascript:
    > Lol, thanks for throwing cold water over my theory... I have heard
    > rumors about you! Please don't post to this thread or it will be
    > considered harassment and treated as such.


    It is not clear what and who you mean.

    [please always quote on usenet]

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., May 8, 2007
    #3
  4. Guest


    > It is not clear what and who you mean.


    What is unclear Evertjan the reply pertaining to Randy Webb?? I don't
    assume you mean the original post is unclear. What is your cause now?
     
    , May 8, 2007
    #4
  5. Evertjan. Guest

    wrote on 08 mei 2007 in comp.lang.javascript:
    >> It is not clear what and who you mean.

    >
    > What is unclear Evertjan the reply pertaining to Randy Webb?? I don't
    > assume you mean the original post is unclear. What is your cause now?


    You did not quote, so how are we to know that your "reply pertained to
    Randy Webb", if you do not, as required by netiquette, quote.

    Please follow usenet netiquette on usenet.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., May 8, 2007
    #5
  6. Guest


    > Please follow usenet netiquette on usenet.



    Please follow basic human etiquette. Sorry for you not having a keen
    grasp of the obvious in the ridiculously short 2 message thread you
    could not make associated connections to. I think you just wanted to
    pitch a knife-fight vs. your honest claim you could not make heads or
    tails of it? Sure. Please do not post here either unless you want to
    help. Unless I am wrong, Ok?

    -Cindy
     
    , May 8, 2007
    #6
  7. ASM Guest

    a écrit :
    >> Please follow usenet netiquette on usenet.

    >
    > Please follow basic human etiquette.


    Human is not a computer, he could be lost in all those post ...
    and netiket is a good practice to follow for his convenience.

    > Please do not post here either unless you want to
    > help. Unless I am wrong, Ok?


    If you want an help, give first what exactly you want to do, and how you
    try to do it.

    For the moment and since 3 or 4 posts you're wrong and only blow wind.

    --
    Stephane Moriaux et son (moins) vieux Mac déjà dépassé
     
    ASM, May 8, 2007
    #7
  8. töff Guest

    You can detect the mouse button state with
    <body onmousedown="go()" onmouseup="stop()">
    .... see http://www.w3schools.com/jsref/jsref_events.asp

    But what does "in a printed space" mean? Is it a textbox object, or some
    HTML text on the webpage?

    wrote:
    > Hello, I want a function that when it detects the left mouse button is
    > pressed down, will generate and cycle 5 random number/letter
    > combinations as fast as it can in a printed space. If I let off the
    > mouse button then it should stop, and it can re-start again when
    > pressed, etc..... can someone help help? :)
    >
     
    töff, May 8, 2007
    #8
  9. shimmyshack Guest

    On May 8, 3:02 pm, wrote:
    > > Please follow usenet netiquette on usenet.

    >
    > Please follow basic human etiquette. Sorry for you not having a keen
    > grasp of the obvious in the ridiculously short 2 message thread you
    > could not make associated connections to. I think you just wanted to
    > pitch a knife-fight vs. your honest claim you could not make heads or
    > tails of it? Sure. Please do not post here either unless you want to
    > help. Unless I am wrong, Ok?
    >
    > -Cindy


    this function from phpmyadmin
    so you shouldnt use it verbatim unless you then GPL you source code.

    /**
    * Generate a new password, which may then be copied to the form
    * with suggestPasswordCopy().
    *
    * @param string the form name
    *
    * @return boolean always true
    */
    function suggestPassword() {
    var pwchars =
    "abcdefhjmnpqrstuvwxyz23456789ABCDEFGHJKLMNPQRSTUVWYXZ.,:";
    var passwordlength = 16; // do we want that to be dynamic? no,
    keep it simple :)
    var passwd = document.getElementById('generated_pw');
    passwd.value = '';

    for ( i = 0; i < passwordlength; i++ ) {
    passwd.value += pwchars.charAt( Math.floor( Math.random() *
    pwchars.length ) )
    }
    return passwd.value;
    }


    you need markup like so
    <input id="button_generate_password" value="Generate"
    onclick="suggestPassword()" type="button">
    <input name="generated_pw" id="generated_pw" type="text">

    now all you need is
    *set the number of digits to 5 as required
    *an onmousedown instead of onclick to call the function
    *a way of using setInterval with a certain number of milliseconds to
    repeat the triggering of the suggestPassword function
    *an onmouseup event, which cancels this.
     
    shimmyshack, May 8, 2007
    #9
  10. On May 8, 7:26 am, wrote:
    > Hello, I want a function that when it detects the left mouse button is
    > pressed down, will generate and cycle 5 random number/letter
    > combinations as fast as it can in a printed space. If I let off the
    > mouse button then it should stop, and it can re-start again when
    > pressed, etc..... can someone help help? :)


    first- add this onmousedown event to element:
    <div onmousedown="if(event.which||event.button===1)randGen(this)"
    >Please Click Me</div>



    then in function randGen :

    function randGen(rD){
    while(rD.childNodes.length)
    rD.removeChild(rD.childNodes[0])
    var x=Math.round(89999*Math.random())+10000
    rD.appendChild(document.createTextNode(x))
    }

    Example:


    <div onmousedown="if(event.which||event.button===1)randGen(this)">
    Press left mouse button
    </div>
    <script>
    function randGen(rD){
    while(rD.childNodes.length)
    rD.removeChild(rD.childNodes[0])
    var x=Math.round(89999*Math.random())+10000
    rD.appendChild(document.createTextNode(x))
    }
    </script>
     
    scripts.contact, May 8, 2007
    #10
  11. On May 8, 9:26 am, wrote:
    > Lol, thanks for throwing cold water over my theory... I have heard
    > rumors about you! Please don't post to this thread or it will be
    > considered harassment and treated as such.


    Your theory seems to be, "Asking strangers to write
    code for free is easier and cheaper than expending
    any effort trying to learn to do it myself. I can look
    at my pr0n collection, wait for the answer to drop
    into my lap, and get a A on the assignment."

    That theory seems to be shared by a lot of people and,
    unfortunately, works in a lot of comp.lang NGs, including
    this one. But not all, thank goodness, some of them
    want to see people make an effort for themselves before
    plopping an answer down.

    ---
    Geoff
     
    Geoffrey Summerhayes, May 8, 2007
    #11
  12. In comp.lang.javascript message <
    oglegroups.com>, Tue, 8 May 2007 07:31:51, scripts.contact
    <> posted:

    > var x=Math.round(89999*Math.random())+10000


    That generates values from 10000 to 99999, but the first and last are
    only half as likely to occur than any of the others.

    Please read and understand the newsgroup FAQ before posting code; that
    should diminish the propagation of bad code.

    It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
    news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
     
    Dr J R Stockton, May 8, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. KK
    Replies:
    2
    Views:
    711
    Big Brian
    Oct 14, 2003
  2. Replies:
    10
    Views:
    1,272
    Big K
    Feb 2, 2005
  3. Replies:
    14
    Views:
    557
    Karl Heinz Buchegger
    Nov 2, 2005
  4. Dr Mephesto

    App idea, Any idea on implementation?

    Dr Mephesto, Feb 4, 2008, in forum: Python
    Replies:
    3
    Views:
    746
    Dennis Lee Bieber
    Feb 5, 2008
  5. Replies:
    0
    Views:
    654
Loading...

Share This Page