Sorry Richard I should have put in the Button object for you to look
at as well, its not a html element but a prototype class:

                <script>
                var AbstractWidget = Class.create({
                        widgetParam1: null,
                        widgetParam2: null,
                        initialize: function(widgetParam1, widgetParam2) {
                                this.widgetParam1 = widgetParam1;
                                this.widgetParam2 = widgetParam2;
                        },
                });
                var AbstractComponent = Class.create(AbstractWidget, { } );
                var Button = Class.create(AbstractComponent, { } );
                </script>


On Jan 16, 10:27 am, "Richard Quadling" <[EMAIL PROTECTED]>
wrote:
> Could you use ...
>
> var myWidget = document.createElement(widgetName);
>
> and then set the properties as normal?
>
> On 16/01/2008, GarethAtFlignet <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > HI there,
>
> > I'm trying to improve the performance of an application we're working
> > on which makes a fair bit of use of the eval statement. We're tryignt
> > o weed out the use of eval due to the performacne overhead and there
> > is one section of code we haven't as yet been able to improve upon.
> > Any help very much appreciated.
>
> > Here is a sample code snipped. The key points which 'cannot' be
> > changed is that the classname must be sourced from a variable and not
> > static (same for the parameters).
>
> >                 var widgetName = "Button";
> >                 var widgetParam1 = "I am parameter 1";
> >                 var widgetParam2 = new Array("I am ", "parameter 2");
> >                 eval("var myWidget = new "+widgetName+"(widgetParam1,
> > widgetParam2);");
>
> > Many thanks
> > Gareth
>
> --
> -----
> Richard Quadling
> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to