Hi there,
I am totally new to Java script (just began to looking into it) and I would like to do something with the comment box on one of the website I am working on http://antobbo.webspace.virginmedia.com/webediting/documents.htm
Basically rather than that box at the bottom of the page I was thinking to have a link saying something like "comment" and if I click on it the text box appears.
Now, this is my html comment box code:

<div class="comment_box">
<form action="mailto:myemail@domain.com" method="post">
<p>Comments and suggestions:<br><textarea name="comments" rows="3" cols="30"></textarea><br><br>
<input type="submit" value="Send"></p>
</form>
</div> <!-- end of comment_box-->

CSS

.comment_box

{
border-style:solid;
border-width:1px;
float:left;
background-color:#d4d4cb;
width:280px;
padding-left:20px;
padding-top:25px;
padding-bottom:10px;
}

and for the script I am not quite sure how to proceed. I suppose the box will need to be shown using a

document.write()

method but does it mean that I have to copy the content of my

<form></form>

into the script? So something like "if I click on the comment button show the box"?
this is what I came up so far, it is not much sorry

<script type="text/javascript">
<!--
function popup() {
	document.write() /* not quite sure what to put in it*/
}
//-->
</script>

<body>

</body>

<input type="button" value="Comment" onclick="popup()"><br />

ANy help/suggestion greatly appreciated
thanks

this is roughly what I meant (I know the code is wrong because it doesn't work but still might clarify a bit )

<html>
<head>
<style type="text/css">
.comment_box

{
border-style:solid;
border-width:1px;
float:left;
background-color:#d4d4cb;
width:280px;
padding-left:20px;
padding-top:25px;
padding-bottom:10px;
}

</style>
<script type="text/javascript">
<!--
function popup(box) {

	comment= confirm("Do you want to leave a comment?")
	if(comment)
	{
	document.write("comment_box")
	}
	else
	{
	document.write("You cancelled")
	}
}
//-->
</script>
</head>
<body>




<input type="button" value="Comment" onclick="popup('comment_box')"><br />

<div class="comment_box">
<form action="mailto:myemail@domain.com" method="post">
<p>Comments and suggestions:<br><textarea name="comments" rows="3" cols="30"></textarea><br><br>
<input type="submit" value="Send"></p>
</form>

</div> <!-- end of comment_box-->

</body>
</html>

I don't really want the user to get a pop up confirmation window before he/she leaves a comment but the

confirm()

method was the only one I found that coould somehow help me

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.