Hi,Timgerrlists
Seems that you haven''t know clearly about the utility method $F.$F
is a convenience alias of Form.Element.getValue
.When you are going to use $F(elementid),you have to assure that the
element is a form element.
So,change your code properly,use a form tag to contain those
elements in the body tags.Just like,
<body>
<form id="form1">
<input type="text" id="userName" value="Joe
Doe"><br/>
<input type="button" value="Test3"
onclick="test3();"><br/>
<div id="uName">
What is your username?
</div>
</form>
</body>
BTW:In your script part,(''uName'').innerHTML should be $
(''uName'').innerHTML.
Also,there is a way to avoid using form tag,that is use $() instead of
$F().
Vin.07/04/06
On 4月6日, 上午3时31分, "timgerrlists" <timgerrli...@gmail.com>
wrote:> So I am learning prototype and I have a basic question changing data
> in a div with innerHTML. Here is what I am trying to do :
> [code]
> <html>
> <head>
> <script src="prototype.js"></script>
> <script language="javascript">
> function test3()
> {
> var outPut = $F(''userName'');
> alert( outPut );
> (''uName'').innerHTML = outPut;
> }
> </script>
> </head>
> <body>
> <input type="text" id="userName"
value="Joe Doe"><br/>
> <input type="button" value="Test3"
onclick="test3();"><br/>
> <div id="uName">
> What is your username?
> </div>
> </body>
> </html>
> [/code]
>
> So I want to change the uName div with the data that comdes from the
> userName data. I am not sure how to do this. All the documentation
> fromhttp://www.sergiopereira.com/articles/prototype.js.htmldeals
> with alerts and no other return of data.
>
> How can I replace the data "What is your username" with what is
> contained within the textbox?
>
> Thanks
> -T
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---