Hi All,
Took the littlun's out sledding this weekend-- grrrreat time! My daughter
(7) had something of a hard time with the concept of having to walk up after
each ride down. I can see her point.
I'm missing something in the code below...
It's a script which is supposed to clear the default text in a form field,
the first time the field is focussed on. Subsequent visits to the field have
no effect. The first version does this, but it's in explicit form. I wanted
to write a more general version. I know the arguments are being passed, but
the variables, "theForm" and "theField" apparently aren't being recognized
as I was hoping.
Here's the code. I'll pull your sled up the hill if you have a clue about
what I'm clueless about!
-------
<html>
<script type="Javascript">
// this little script is supposed to clear the content of a field the first
time the field is entered to remove default messages
function clearOnce(theForm, theField) {
var ncr_text = "enter ncr numbers, a, b, c";
// this explicit one does work
if (document.imageupload.ncr_number.value == ncr_text)
{document.imageupload.ncr_number.value="";}
}
function clearOnce2(theForm, theField) {
var field_and_form = new Array()
field_text[1] = "enter ncr numbers, a, b, c";
field_text[2] = "enter a part number";
field_text[3] = "enter an order number";
for (var index = 0;index <= field_text.length; index++){
if (document.theForm.theField.value == field_text[index])
{document.theForm.theField.value="";}
}
}
// -->
</script>
<body>
<form name="imageupload"
action="file:///Macintosh%20HD/Users/joe/work/image%20app/image_app.cfm"
method="post" enctype="multipart/form-data">
<table border="3" style="font-weight:bold" align="center">
<tr align="center">
<td valign="middle"><span style="color:green">ncr number</span><br><br>
<span style="color:maroon; font-size:18">OR</span><br><br><span
style="color:orange">part number and order number</span></td>
<td valign="middle">
<input name="ncr_number" type="text" size="25" style="color:green"
maxlength="100" title="enter ncr numbers" VALUE="enter ncr numbers, a, b,
c" onfocus="javascript:clearOnce('imageupload', 'ncr_number');">
<br><br><span style="color:maroon; font-size:18">OR</span><br><br>
<input name="part_num" type="text" size="15" style="color:orange"
maxlength="25" title="part number" VALUE="enter a part number"
onfocus="javascript:clearOnce2('imageupload', 'part_num');">
<input name="order_num" type="text" size="15" style="color:orange"
maxlength="25" title="order number" VALUE="enter an order number"
onfocus="javascript:clearOnce2('imageupload', 'order_num');">
</td>
</tr>
</table>
<input type="submit" value="upload the image files">
</form>
</body>
</html>
-------
--
Joe Zanter
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:5:141862
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54