Hybrid View

  1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    38
    Vote Rating
    0
    ssk_hari is on a distinguished road

      0  

    Default Call JS from another JS ....

    Call JS from another JS ....


    In my project, say on click on one button, I need to show a new page (like ahref) ..

    So I have written a below click event of the button in one JS file ...
    this.body.on('click', function(){window.location.href="overhaul_inshop.html"});

    But, I read that as per Sencha norms, one should have only main HTML file and other files should be only JS ...

    Even in my project, I have overhaul_inshop.js file which does all operations. But, how can I give the linking now to that JS ... If it is HTML, I can call like above code ... pls advice . Thanks.

  2. #2
    Touch Premium Member
    Join Date
    Sep 2008
    Location
    Orange County, CA, USA
    Posts
    186
    Vote Rating
    0
    Jack9 is on a distinguished road

      0  

    Lightbulb Call JS

    Call JS


    <!-- Application JS -->
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/Application.js"></script>
    In common.js you put something like...
    Code:
    function include(file) {
        if (document.createElement && document.getElementsByTagName) {
            var head = document.getElementsByTagName('head')[0];
            var script = document.createElement('script');
            script.setAttribute('type', 'text/javascript');
            script.setAttribute('src', file);
            head.appendChild(script);
        }
    }
    
    include('js/ui/login.js');
    include('js/ui/home.js');
    ...

Similar Threads

  1. How do I call?
    By Riaz in forum Sencha Touch 1.x: Q&A
    Replies: 2
    Last Post: 14 Sep 2011, 12:41 AM
  2. How can I call?
    By Riaz in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 24 Mar 2011, 4:43 AM
  3. Could I create "Call" button that will cause Iphone to make a call?
    By lexer in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 12 Nov 2010, 8:11 AM
  4. Ext.get call
    By febus in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 31 Aug 2009, 2:20 PM
  5. Call Ext.extend function from FeedWindow.superclass.constructor.call
    By adelphus in forum Ext 2.x: Help & Discussion
    Replies: 17
    Last Post: 3 Jun 2008, 1:42 AM

Thread Participants: 1