Hmm. My first post attempt didn't seem to work. So I'm trying it
again. It appears to me that my onfocus handler is not reliably able
to use getNodeAttribute to retrieve the contents of other nodes. I
created a small example (see below) of this. In my example, I have two
text fields called text1 and text2, which I believe to be remarkably
original names. I've attached an onfocus handler to text2 and when I
use getNodeAttribute for text1 in this handler, it gets null even when
I've entered data into text1. However if I use the less desirable
instruction "text1Val = TheForm.text1.value;" it does work. I would
appreciate if anybody can explain to me why this is the case. I don't
need a workaround because retrieving the value the "oldfashioned" way
seems to be available to me. But I would like to use MochiKit
functions where possible. So why is it not possible in this case.
Thanks in advance.

Mike

<html xmlns="http://www.w3.org/1999/xhtml"; xmlns:py="http://purl.org/
kid/ns#">
<script src="MochiKit.js" type="text/javascript">
</script>
<script type="text/javascript">
        function displayText1(e)
                {
                //Note if I substitute for the following line the following
                //this script will work properly.
                //textVal = document.TheForm.text1.value;
                text1Val = getNodeAttribute(document.TheForm.text1, 'value');
                alert('Text1 contains ' + text1Val);
                }
connect(self, 'onload', function(e)
                {
                connect(TheForm.text2, 'onfocus', displayText1);
                }
           );
</script>
<body>
        <form name=TheForm>
        <input type=text name=text1 \>
        <input type=text name=text2 \>
        </form>
</body>
</html>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to