/    Sign up×
Community /Pin to ProfileBookmark

remote call of floating menu

Hello,

I want to use the following script: [url]http://javascript.internet.com/navigation/indent-menu.html[/url]

But I don’t want it to be loaded simply on my webpage.

What I am wondering is I want to be able to include that code on a remote page.

I.e. I want any page on the internet to use the following code <script src=http://javascript.internet.com/navigation/indent-menu.html></script>

When that is called I want the menu to float in a specific position.

When I try using the above code nothing appears.

Any help would be appreciated.

to post a comment
JavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@JonaJul 02.2003 — [font=arial][color=maroon]I've outlined the steps below:

[list=1]
  • [*]Collect all of the JavaScript code from the head tag in http://javascript.internet.com/navi...ndent-menu.html and put it in a .js file.

  • [*]Upload the .js file to a public folder on your server, and make sure you have hotlinking enabled for this specific file.

  • [*]Insert the following code in the head tag of each page you want to include the menu in:

    [/color][/font][font=courier new]<script type="text/javascript" src="http://yourserver.com/public/independent_menu.js"></script>[/font]

  • [/list]


    [b][J]ona[/b]
    Copy linkTweet thisAlerts:
    @doobsterauthorJul 02.2003 — Hi Jona,

    I have tried the following steps you gave me, but it does not seem to want to work.

    The reason I believe it does not work is because in my src file it basically contains a separate html file because I need to have a head and body in the src page and I think this causes problems when calling it remotely because the page works perfect fine if I load it directly in an html page.
    Copy linkTweet thisAlerts:
    @JonaJul 02.2003 — [i]Originally posted by doobster [/i]

    [B]The reason I believe it does not work is because in my src file it basically contains a separate html file because I need to have a head and body in the src page and I think this causes problems when calling it remotely because the page works perfect fine if I load it directly in an html page. [/B][/QUOTE]


    [font=arial][color=maroon]Say what? ?

    A .js file should contain JavaScript [b]exclusively.[/b] No HTML is allowed, or your result will be a syntax error.

    Try using some commas next time. ?[/color]
    [/font]

    [b][J]ona[/b]
    Copy linkTweet thisAlerts:
    @doobsterauthorJul 02.2003 — Well that is the problem.

    That indent menu script contains both html and javascript.

    The idea is that whole page with the javascript and html page I want to load remotely on any page on the Internet so that indent menu will contain links for people to use.
    Copy linkTweet thisAlerts:
    @JonaJul 02.2003 — [i]Originally posted by Jona [/i]

    [B][font=arial][color=maroon]I've outlined the steps below:

    [list=1]
  • [*]Collect all of the [u]JavaScript[/u] code from the head tag in http://javascript.internet.com/navi...ndent-menu.html and put it in a .js file.[/color][/font]
  • [/list]
    [/B][/QUOTE]


    [font=arial][color=maroon]Notice the underlined part. Take the Javascript code from the head tag in that page. Where other Javascript is embedded in HTML, do not put it in the .js file. Instead, put it in the HTML file that contains the .js file.[/color][/font]

    [b][J]ona[/b]
    Copy linkTweet thisAlerts:
    @doobsterauthorJul 02.2003 — That does not help my situation here. I understand how to load the menu fine.

    But I want to have the script on my page and have my members be able to use <script src=...></script> to be able to call my script and the links are loaded that way on their webpage. I do not want to have them to include the html code.

    I hope that is more clear.
    Copy linkTweet thisAlerts:
    @JonaJul 02.2003 — [i]Originally posted by doobster[/i]

    [b]But I want to have the script on my page and have my members be able to use <script src=...></script> to be able to call my script and the links are loaded that way on their webpage. I do not want to have them to include the html code.[/b][/quote]


    [font=arial][color=maroon]Well, in that case, make two .js files. One with that simply has the menu script in it, and one that has the HTML in it. But, instead of just using HTML only, put in document.write('[html code here]'); and save it as a seperate .js file. Now, when someone wants to include the menu, tell them to put the <script src="http://server.com/public/menu.js"></script> in the <head> tag, and put <script src="http://server.com/public/menu_html.js"></script> where they want the menu to appear.[/color][/font]

    [b][J]ona[/b]
    Copy linkTweet thisAlerts:
    @doobsterauthorJul 02.2003 — Thanks I will try that.

    Wish there was a simplier way...
    Copy linkTweet thisAlerts:
    @JonaJul 02.2003 — [i]Originally posted by doobster [/i]

    [B]Wish there was a simplier way... [/B][/QUOTE]


    [font=arial][color=maroon]Well, I don't know about easier, but there's almost always more than two different ways to do something in JavaScript. That's one of the things I like about it.[/color][/font]

    [b][J]ona[/b]
    Copy linkTweet thisAlerts:
    @doobsterauthorJul 02.2003 — Jona,

    Just wondering if you this is possible.

    I have scraped all of the javascript code and simplified it down to just a table with some links.

    But the page I want to call has php in it.

    So rather than calling a .js file I am calling a .php file. So what I have done is placed all the html code in a php variable and then when I write it I use document.write('<?=$displaycode;?>');

    because i did all of that and it doesnt work. did i do something wrong or am i missing something??

    thanks.
    Copy linkTweet thisAlerts:
    @doobsterauthorJul 02.2003 — Never mind I got it to work.

    Thanks for all of your help Jona much appreciated.
    Copy linkTweet thisAlerts:
    @JonaJul 02.2003 — [font=arial][color=maroon]Yes, you can do document.write('$variable');, just rename the file to have an extension of .php instead of .js, and include it as Javascript with a .php extension instead of .js.[/color][/font]

    [b][J]ona[/b]
    Copy linkTweet thisAlerts:
    @JonaJul 02.2003 — [i]Originally posted by doobster [/i]

    [B]Never mind I got it to work.



    Thanks for all of your help Jona much appreciated. [/B]
    [/QUOTE]


    [font=arial][color=green]Okay. Welcome you are! ?[/color][/font]

    [b][J]ona[/b]
    ×

    Success!

    Help @doobster spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.20,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...