views:

129

answers:

4

I need a simple list (3 lines of text) surrounded by a gray box. I know I need to implement on blur instead of a "close" button.
Here's what I have so far...
I can't sen to get text values to transfer.
Help!

<script> function $(id) { return document.getElementById(id); } </script>
<input name="media" id="media" type="text" />
<input type="button" value="..." 
    onclick="$('keypad').style.display='inline-block';"/>
<div id="keypad" style="display:none; background:#CCC; vertical-align:top;">
<input type="text" value="Canvas" onclick="$('media').value='Canvas';"/><br/>
<input type="button" value="Done" onclick="$('keypad').style.display='none'"/>
</div>
A: 
<script> function $(id) { return document.getElementById(id); } </script>
<input name="media" id="media" type="text" />
<input type="button" value="..." onclick="$('keypad').style.display='inline-block';"/>
<div id="keypad" onmouseout="$('keypad').style.display='none'" style="display:none; background:#CCC; vertical-align:top;border:1px solid grey;">
<input type="text" value="Canvas" onclick="$('media').value = $('mediain').value;" id="mediain" onblur="$('keypad').style.display='none'"/><br/>
</div>
CodeJoust
A: 
border: 1px solid black;
Azeem.Butt
+1  A: 

You're mimicking the Prototype framework but could be getting much more out of it. Firstly, if you'd set your click/blur events up as abstracted events the code would be clearer and more cross-browser compatible.

If you're showing/hiding an element use

$('elementID').show();
$('elementID').hide();

If you're getting a form value use:

$F('elementID');

or setting a form value:

$F('elementID') = 'newValue';

I can't really understand what you're trying to do - your question re: '3 lines of text' doesn't really reflect the code you've posted...

adam
A: 

I'm not quite sure what you mean about getting text values to transfer, but a box with a single gray border should just be

<div style="border: 1px solid #AAAAAA;">
<!-- your list here -->
</div>

I spent too long typing, I'll just refer you to adam's answer for the logic part of your question.

Lord Torgamus