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?
<head>
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+" "+lastname[r])
}
</head>
<body>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onMousedown="document.images['example'].src=img2.src"
onClick="RandomName()" onMouseup="document.images['example'].src=img1.src">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"picture.gif" name="example" border=0>
</body>
<head>
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+" "+lastname[r])
}
</head>
<body>
<a href=http://www.webdeveloper.com/forum/archive/index.php/"#" onMousedown="document.images['example'].src=img2.src"
onClick="RandomName()" onMouseup="document.images['example'].src=img1.src">
<img src=http://www.webdeveloper.com/forum/archive/index.php/"picture.gif" name="example" border=0>
</body>