/    Sign up×
Community /Pin to ProfileBookmark

Problem including a js file with HTML coding – Document.write Issues

In my JS file, I made sure to write the necessary html code for a menu using [I]document.write[/I] statements (I call the JS file inside a div in my webpages).

I know about escape sequences and I put backslashes before every special characters but my menu still does not appear. Maybe only a simple character is missing.

The code do work when I write it directly in my html so there should be no errors in the code itself. Must be in the way I put it in my JS file.

All files are in root directory of my server.

[U][B]File listing[/B][/U]

[LIST]

  • [*]

    test.htm


  • [*]

    menu.js


  • [*]

    tree_dom.js (file for menu appearance and functionality – not the problem here)


  • [*]

    menu0.gif


  • [*]

    menu1.gif


  • [/LIST]

    [U][B]JS file content[/B][/U]

    document.write(‘ <table id=”m1mainSXMenu2″ cellspacing=”0″ cellpadding=”0″ style=”width:171px”>’);
    document.write(‘ <tr>
    document.write(‘<td>’);
    document.write(‘<div id=”I0SXE5SXP” onmouseover=”itemHL(this,’#d5ad86′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,0,5)” class=”SXP0″>’);
    document.write(‘ <img id=”MI0SXE5SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Le profil’);
    document.write(‘</div>’);

    document.write(‘<div id=”I0SXE5SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” class=”SXC0″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Le sculpteur’);
    document.write(‘</div>’);

    document.write(‘<div id=”I0SXE7SXP” onmouseover=”itemHL(this,’#d5ad86′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,0,7)” class=”SXP0″>
    document.write(‘ <img id=”MI0SXE7SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Les produits’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE8SXP” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,1,8)” class=”SXP1″>’);
    document.write(‘ <img id=”MI1SXE8SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Les sculptures corporatives’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE8SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#cbb98d;” class=”SXC1″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les logos / armoiries’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE10SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#cbb98d;” class=”SXC1″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les enseignes’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE11SXP” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,1,11)” class=”SXP1″>’);
    document.write(‘ <img id=”MI1SXE11SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Les sculptures th&eacute;matiques’);
    document.write(‘</div>’);

    document.write(‘<div id=”I2SXE12SXP” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,2,12)” style=”background-color:#cbb98d;” class=”SXP2″>’);
    document.write(‘ <img id=”MI2SXE12SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Le Poker’);
    document.write(‘</div>’);

    document.write(‘<div id=”I2SXE12SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#e4d3b0;” class=”SXC2″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les prot&egrave;ge-cartes’);
    document.write(‘</div>’);

    document.write(‘<div id=”I2SXE14SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#e4d3b0;” class=”SXC2″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les troph&eacute;es’);
    document.write(‘</div>’);

    document.write(‘<div id=”I2SXE15SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#e4d3b0;” class=”SXC2″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les pi&egrave;ces d&eacute;coratives’);
    document.write(‘</div>’);

    document.write(‘<div id=”I2SXE16SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#e4d3b0;” class=”SXC2″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les tables de Poker’);
    document.write(‘</div>’);

    document.write(‘<div id=”I2SXE17SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#e4d3b0;” class=”SXC2″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les boitiers &agrave; jetons (sit’n go)’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE18SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#cbb98d;” class=”SXC1″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les animaux’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE19SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#cbb98d;” class=”SXC1″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les personnages’);
    document.write(‘</div>’);

    document.write(‘<div id=”I0SXE20SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” class=”SXC0″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les utilitaires’);
    document.write(‘</div>’);

    document.write(‘<div id=”I0SXE21SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” class=”SXC0″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les exclusifs’);
    document.write(‘</div>’);

    document.write(‘<div id=”I0SXE22SXP” onmouseover=”itemHL(this,’#d5ad86′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,0,22)” class=”SXP0″>’);
    document.write(‘ <img id=”MI0SXE22SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Les services’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE23SXP” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,1,23)” class=”SXP1″>’);
    document.write(‘ <img id=”MI1SXE23SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Les ateliers’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE23SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#cbb98d;” class=”SXC1″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Le S.T.A.R’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE25SXP” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” onclick=”p06(null,1,25)” class=”SXP1″>’);
    document.write(‘ <img id=”MI1SXE25SXP” src=”./menui0.gif” class=”im” style=”border-style:none;vertical-align:bottom” alt=”” /> Les cours’);
    document.write(‘</div>’);

    document.write(‘<div id=”I1SXE25SXC” onmouseover=”itemHL(this,’#ab9c74′,’White’)” onmouseout=”itemHL(this)” style=”background-color:#cbb98d;” class=”SXC1″>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Le S.T.E.P.’);
    document.write(‘</div>’);

    document.write(‘<div id=”SXR27″ onmouseover=”itemHL(this,’#d5ad86′,’White’)” onmouseout=”itemHL(this)” class=”SXR”>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Les &eacute;v&egrave;nements’);
    document.write(‘</div> ‘)

    document.write(‘<div id=”SXR28″ onmouseover=”itemHL(this,’#d5ad86′,’White’)” onmouseout=”itemHL(this)” class=”SXR”>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Liens int&eacute;ressants’);
    document.write(‘</div>’);

    document.write(‘<div id=”SXR29″ onmouseover=”itemHL(this,’#d5ad86′,’White’)” onmouseout=”itemHL(this)” class=”SXR”>’);
    document.write(‘ <img src=’./empty.gif’ width=’5′ height=’1′ style=’border-style:none;vertical-align:middle’ alt=” /> Pour me joindre’);
    document.write(‘</div>’);

    document.write(‘</td>’);
    document.write(‘ </tr>’);
    document.write(‘ </table>’);

    [U][B]HTML page content (the part where I want to put my menu files)[/B][/U]

    <div class=”arrowsidemenu”>
    <!– Menu Start –>

    <script src=”menu.js”></script>

    <!– End of Menu –>
    </div>

    Thank you in advance for your help.

    Philippe

    to post a comment
    JavaScript

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @FangApr 02.2010 — Line 2 & 12 are incorrect:document.write(' &lt;tr&gt;[COLOR="Red"]');[/COLOR]
    ×

    Success!

    Help @prophil 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.16,
    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,
    )...