Javascript onDblClick help
Posted: Sun Feb 27, 2005 4:18 pm
What I'm trying to do here is, when you double click on a form select, it inserts '/msg $id' (this is within PHP) into a text form. Here's some snippets from the code. So far, it doesn't work.
The $puserid and $pusername have been defined already.
Thanks for any help you can give me.
Code: Select all
<script language="javascript">
function insert(pusername) {
document.form.message.value = "/msg "
}
</script>Code: Select all
<form name="form" action="game.php?where=chat" method=POST>
<input name="message" type=text size=40 maxlength=100>
<input type=submit name="submit" value="Chat">Code: Select all
print("<select size=17 name="people" style="width:150">");
print("<option value="$puserid" ondblclick="insert('$pusername')">$pusername</option>");
print("</select>");Thanks for any help you can give me.