<html>
<head>
<script type="text/javascript">
function init() {
mySpan = new Element('span');
$('importantButton').observe('click', updateMyContent);
}
function updateMyContent() {
mySpan.update('Some important text');
$('canvas').appendChild(mySpan);
}
document.observe('dom:loaded', init);
</script>
</head>
<body>
<div id="canvas"></div>
<button id="importantButton">Press me to see some important text</
button>
</body>
</html>
On Jun 13, 9:02 am, AlannY <[EMAIL PROTECTED]> wrote:
> Currently, I have the following code:
>
> <html>
> <head>
> ...
> </head>
> <body>
>
> <div>
> <script type="text/javascript">
> <!--
> document.write('<span>Test</span>');
> //-->
> </script>
> </div>
>
> </body>
> </html>
>
> How to replace the JavaScript in Prototype's style: new Element?
>
> I need something similar:
>
> <div>
> <script type="text/javascript">
> <!--
> var span = new Element('span');
> document.write(span); // <- THAT IS
> </script>
> </div>
>
> I mean, I need to place <new Element> in DOM there script is
> called ;-) How to do it? Exactly threre the script is called, 'cause I
> don't known where it called ;-)
>
> Thank you ;-)
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---