Home Page
Articoli
Tips & Tricks
News
Forum
Archivio Forum
Blogs
Sondaggi
Rss
Video
Utenti
Chi Siamo
Contattaci
Username:
Password:
Login
Registrati ora!
Recupera Password
Home Page
Stanze Forum
ASP.NET 2.0 / 3.5 / 4.0
Masterpage e Javascript.
lunedì 25 maggio 2009 - 10.47
Elenco Threads
Stanze Forum
Aggiungi ai Preferiti
Cerca nel forum
iif
Profilo
| Expert
713
messaggi | Data Invio:
lun 25 mag 2009 - 10:47
Ciao, dovrei eseguire del codice javascript all'interno di una masterpage, per chiarezza vi sposto il codice:
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
<head runat="server">
<title>Pagina senza titolo</title>
<link rel="stylesheet" href="Cartella/menu.css" />
</head>
<body>
<script type="JavaScript" src="Cartella/menu.js"></script>
<script type="JavaScript" src="Cartella/menu_items.js"></script>
<script type="JavaScript" src="Cartella/menu_tpl.js"></script>
<form id="form1" runat="server">
<div>
<script type="JavaScript">
new menu (MENU_ITEMS, MENU_TPL);
</script>
<br />
<br />
<br />
<br />
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</form>
</body>
</html>
Quano la mando in esecuzione non visualizza e non da errore, non capisco cosa manca.
Grazie.
Anonimo
Profilo
| Senior Member
392
messaggi | Data Invio:
lun 25 mag 2009 - 12:34
Puoi postare il javascript? Perchè a primo colpo posso domandardi ma le variabili che passi alla funzione sono valorizzate? Sono delle costanti definite da codice?
iif
Profilo
| Expert
713
messaggi | Data Invio:
lun 25 mag 2009 - 12:36
Lo stesso codice in una pagina html funziona.
Anonimo
Profilo
| Senior Member
392
messaggi | Data Invio:
lun 25 mag 2009 - 12:41
Ok dopo un po' di test funzionanti mi viene da dirti che il problema risiede 99,9% nel codice javascript, controlla che il codice abbia tutti i riferimenti giusti padri figlio e che gli eventuali url siano rispettati.
iif
Profilo
| Expert
713
messaggi | Data Invio:
lun 25 mag 2009 - 12:47
Questo è il codice originale:
<html>
<head>
<title>JavaScript Menu - Demo #1</title>
<!-- styles for demo menu #1-->
<link rel="stylesheet" href="menu.css">
</head>
<body>
<!-- comments begin -->
<!-- comments end -->
<!-- menu script itself. you should not modify this file -->
<script language="JavaScript" src="menu.js"></script>
<!-- items structure. menu hierarchy and links are stored there -->
<script language="JavaScript" src="menu_items.js"></script>
<!-- files with geometry and styles structures -->
<script language="JavaScript" src="menu_tpl.js"></script>
<script language="JavaScript">
<!--//
// Make sure the menu initialization is right above the closing </body> tag
// Moving it inside other tags will not affect the position of the menu on
// the page. If you need this feature please consider Tigra Menu GOLD.
// each menu gets two parameters (see demo files)
// 1. items structure
// 2. geometry structure
new menu (MENU_ITEMS, MENU_TPL);
// If you don't see the menu then check JavaScript console of the browser for the error messages
// "Variable is not defined" error indicates that there's syntax error in that variable's definition
// or the file with that variable isn't properly linked to the HTML document
//-->
</script>
</body>
</html>
Mi sfugge la differenza.
Anonimo
Profilo
| Senior Member
392
messaggi | Data Invio:
lun 25 mag 2009 - 12:49
Nessuna perchè difatti il problema sta nei singoli file js, se mi dai dei link dove scaricarli vedo se riesco a trovarti il problema.
iif
Profilo
| Expert
713
messaggi | Data Invio:
lun 25 mag 2009 - 12:54
1040_Cartella.zip
Questo è l'esempio funzionate completo.
Anonimo
Profilo
| Senior Member
392
messaggi | Data Invio:
lun 25 mag 2009 - 15:43
Ho letto il codice a occhio e croce nel file menu.js la riga di codice che secondo me scatena l'errore è :
this.o_root = this;
quindi prova a spostare i tre file js nella stessa cartella della masterpage, dovrebbe funzionare.
iif
Profilo
| Expert
713
messaggi | Data Invio:
mar 26 mag 2009 - 15:08
Ciao, ho provato a spostare il file .js, niente di fatto.
Codice della masterpage:
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
<html xmlns="
http://www.w3.org/1999/xhtml"
>
<script type="JavaScript" src="menu.js"/>
<script type="JavaScript" src="menu_items.js"/>
<script type="JavaScript" src="menu_tpl.js"/>
<head>
<title>Pagina senza titolo</title>
<link rel="stylesheet" href="menu.css" />
</head>
<body>
<script type="JavaScript">new menu(MENU_ITEMS, MENU_TPL);</script>
<div>
<br />
<br />
<br />
<br />
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
</div>
</body>
</html>
Torna su
Stanze Forum
Elenco Threads
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?
Dopo esserti registrato potrai chiedere
aiuto sul nostro
Forum
oppure aiutare gli altri
Consulta le
Stanze
disponibili.
Registrati ora !