• User

    Aprire file da menu

    Ciao dovrei aprire un determinato file con un menu a discesa
    vi posto la porzione di codice:

    <script language="Javascript">
    var mbar;
    // Main Menu
    mbar= mnu.createMenuBar('main',400,20);
    mbar.addItem(null,'Riduttori ad alta pressione','file');
    //mbar.addItem(null,'Edit','edit');
    //mbar.addItem(null,'View','view');
        //File menu
        mbar = mnu.createMenuBar('file',130);
        *mbar.addItem(null,{image:i1,text:' index.html'},null, 'a href="index.html"');*
        mbar.addItem(null,{image:px,text:' Open'},null,'alert("Open files")');
        mbar.addItem(null,{image:i2,text:' Save'});
        mbar.addItem(null,'Save As ...');
        mbar.addItem(null,'Recent Files','recent');
        mbar.addItem(null,'Exit');
    ......</script>
    ```la parte sottolineata è quella incriminata, in pratica dal menu se clicco su una voce si deve aprire una pagina
    spero in un vostro aiuto
    ciao
    gigi

  • User

    allego il codice completo:

    <html>
    <head>
    <title>DynAPI Examples - HTML Menu</title>
    <script language="JavaScript" src="src/dynapi.js"></script>
    <script language="Javascript">
    dynapi.library.setPath('src/');
    dynapi.library.include('dynapi.api');
    dynapi.library.include('TemplateManager');
    dynapi.library.include('HTMLMenu');
    dynapi.library.include('Image');
    </script>
    <script language="Javascript">
    
    // Mozilla will collapse/expand table cells whenever the content of the layer changes. To solve this, specify a width for your table cells
    t = 'This is the Template:<br><br><center><table border="0"><tr><td width="200">{@mnu}</td></tr></table></center>';
    var tp = new Template(null,100,100,250,200,'#EEEEEE');
    
    tp.addChild(new HTMLMenu(),'mnu');
    
    var mbar;
    // Main Menu
    mbar= tp.mnu.createMenuBar('main',40,20);
    mbar.addItem(null,'File','file');
    mbar.addItem(null,'Edit','edit');
    mbar.addItem(null,'View','view');
    mbar.addItem(null,'Tools','tools');
    mbar.addItem(null,'Help','help');
    //File menu
    mbar = tp.mnu.createMenuBar('file',130);
    mbar.addItem(null,'New');
    mbar.addItem(null,'Open',null,'alert("Open files")');
    mbar.addItem(null,'Save');
    mbar.addItem(null,'Save As ...');
    mbar.addItem(null,'Recent Files','recent');
    mbar.addItem(null,'Exit');
    //Recent menu
    mbar = tp.mnu.createMenuBar('recent',120);
    mbar.addItem(null,'Dynapi.js');
    mbar.addItem(null,'Quickref.html');
    mbar.addItem(null,'Changelog.html');
    mbar.addItem(null,'Index.html');
    //edit menu
    mbar = tp.mnu.createMenuBar('edit',120);
    mbar.addItem(null,'Undo');
    mbar.addItem(null,'Cut');
    mbar.addItem(null,'Copy');
    mbar.addItem(null,'Paste');
    //view menu
    mbar = tp.mnu.createMenuBar('view',130);
    mbar.addItem(null,'Go');
    mbar.addItem(null,'Stop');
    mbar.addItem(null,'Toolbars','tbar');
    mbar.addItem(null,'Status Bar');
    // tbar
    mbar = tp.mnu.createMenuBar('tbar',120);
    mbar.addItem(null,'Header');
    mbar.addItem(null,'Footer');
    mbar.addItem(null,'Standard');
    mbar.addItem(null,'Drawing');
    //tools menu
    mbar = tp.mnu.createMenuBar('tools',120);
    mbar.addItem(null,'Options');
    mbar.addItem(null,'Macro');
    mbar.addItem(null,'Convert...');
    mbar.addItem(null,'Run...');
    
    dynapi.document.addChild(tp);
    
    dynapi.onLoad(function(){
    tp.setHTML(t);
    })
    </script>
    </head>
    
    <body>
    <script>
    dynapi.document.insertAllChildren();
    </script>
    </body>
    </html>
    

    grazie ancora ciao