i want the div to be displayed where the mouse was clicked... whats wrong?

<head>
<style type="text/css">
#layer1 {
   position:fixed;
display: none;
   width:600px;
   height:auto;

}
</style>
</head>

<body>
<input type="button" value="Button 3"
onclick="setVisible();">

<textarea id="reply" name="reply">testing12345678910ffafaf</textarea>
<div id="layer1"></div>
<script type='text/javascript'>

function setVisible() {

var div = document.getElementById('layer1');
// put the correct content in the div here
div.innerHTML = document.getElementById('reply').value;
div.style.left = window.event.clientX + 'px';
div.style.top = window.event.clientY + 'px';

div.style.display = 'visible';}
</script>

</body>

Firstly, display needs to be set to 'block' not 'visible' in your js.

Also, the javascript didn't work for me until I removed:
div.style.left = window.event.clientX + 'px';
div.style.top = window.event.clientY + 'px';

You should try assigning the client X and Y to their own variables and then refer to the variables in those two lines. Let me know if that works!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.