Thread: Depressable Button Problem!

  1. #1

    Depressable Button Problem!

    Hi there, I'm new to Javascript. Here's my problem: I've made a drepessable button but I want it to display text on the same page each time I press it so I can use the button as many times as I want. If I use document.write it erases the button after the first click. How can I fix this?

    <Script language="JavaScript">
    var malename = new Array(

    var lastname = new Array(

    var r = 0;
    var i = 0;
    function RandomName()
    r = Math.floor(Math.random() * lastname.length);
    i = Math.floor(Math.random() * malename.length);
    document.write(malename[i]+" "+lastname[r])

    <a href="#" onMousedown="document.images['example'].src=img2.src"
    onClick="RandomName()" onMouseup="document.images['example'].src=img1.src">
    <img src="picture.gif" name="example" border=0>

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    use code tage, then find a java board!

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    No, use a javascript board because javascript is very different from java.

  4. #4
    no, use a...dangit, I can't think of anywhere better to go

  5. #5
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    (JavaScript != C++) && (Java != JavaScript)
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. elliptical button
    By geek@02 in forum Windows Programming
    Replies: 0
    Last Post: 11-21-2006, 02:15 AM
  3. Bin packing problem....
    By 81N4RY_DR460N in forum C++ Programming
    Replies: 0
    Last Post: 08-01-2005, 05:20 AM
  4. Pressing a button works sometimes
    By johny145 in forum Windows Programming
    Replies: 14
    Last Post: 05-18-2005, 11:53 AM
  5. Window won't display on button command!?
    By psychopath in forum Windows Programming
    Replies: 6
    Last Post: 06-22-2004, 08:12 PM