WebSite X5Help Center

 
Martin S.
Martin S.
User

Vložení externí Javascript  en

Auteur : Martin S.
Visité 67, Followers 1, Partagé 0  

Ahoj všem,

Má tu někdo prosím zkušenosti s přidáním externího Javascript do stránky? Script vkládám vždy prostřednictvím HTML objektu a když celý kód Scriptu vložím přímo do HTML objektu tak funguje bez problémů. Ale když na Js chci jen odkázat tím, že v HTML objektu v záložce Expert nastavím spojený soubor a cesta k němu tak se Javascript nespustí. Kde je problém?  

Posté le
1 RéPONSES
 ‪ KolAsim ‪ ‪
 ‪ KolAsim ‪ ‪
Moderator

(It > En) ... if you attached the file "immagine.jpg" to the project, leaving "files" as the default folder, the direct relative path at the same structural level is:
files/immagine.jpg
... so, an SRC attribute for pages in the ROOT directory would be:
src="files/immagine.jpg"
... if you use the JS code on special pages  or sub-pages (like a blog, cart, etc.), you need to use a relative path that traverses directories:
src="../files/immagine.jpg"
...
... or you can use the absolute path:
https://www.your-site-name.en/files/immagine.jpg
src="https://www.your-site-name.en/files/immagine.jpg"
...
... if you post your JS code and the link to the relevant page, we could avoid guesswork...

.

ciao

.

Lire plus
Posté le de  ‪ KolAsim ‪ ‪