[CLOSED] Moving javascript into a separate .js file

  1. #1

    [CLOSED] Moving javascript into a separate .js file

    Hello,

    I'd like to move some javascript off my page into a standalone Javascript file, which means moving it outside of a <ext:XScript runat="server" > tag. I have a control #{mySlider} that resolves at runtime to: ContentTH_uc999_mySlider and is of type Object. If I look at
    ContentTH_uc999_mySlider.id
    is see that it's value is "ContentTH_uc999_mySlider." However, if I look at
    document.getElementById(ContentTH_uc999_mySlider.id)
    , it is an HTMLInputelement.
    document.getElementById(ContentTH_uc999_mySlider.id) == ContentTH_uc999_mySlider
    is false. Why aren't these equivalent?
    eval(ContentTH_uc999_mySlider.id)
    is of Type Object.
    eval(ContentTH_uc999_mySlider.id)===ContentTH_uc999_mySlider
    evaluates to true. Any suggestions for a way to get to the object other than using eval?

    Thanks,
    Eric
    Last edited by Daniil; Feb 08, 2011 at 2:05 PM. Reason: [CLOSED]
  2. #2
    Hi,

    All Ext.NET are instantiated on the client using their client-side ID (.ClientID).

    You can get an instance of the Component by directly referencing its client-side id, which in your example above is "ContentTH_uc999_mySlider".

    I'm not sure what you're doing with the slider, but if you want to hide, then just call .hide().

    Example

    ContentTH_uc999_mySlider.hide();
    You do not (and should not) use document.getElementById. This will not return an instance of the Component.

    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 1
    Last Post: Jun 04, 2012, 2:34 PM
  2. Replies: 3
    Last Post: Oct 16, 2011, 5:46 PM
  3. [CLOSED] How do I include a javascript file on my page?
    By jwf in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Aug 29, 2011, 6:08 PM
  4. Download and open a file in a separate window
    By unaltro2 in forum 1.x Help
    Replies: 2
    Last Post: Jan 21, 2010, 11:55 AM
  5. Replies: 2
    Last Post: Dec 26, 2008, 11:29 AM

Posting Permissions