What I'm trying to do is have a bit of code on all of my pages that loads text/html from a common file, which I can update and have all the pages update as well.
Any ideas on what do here?
Any ideas on what do here?
| Code: |
|
<html> <head> <title></title> </head> <body> <script language="JavaScript" type="text/javascript" src="content.js"></script> </body> </html> |
| Code: |
|
document.write('html content here'); |
| Quote: |
| Hey is can that code be done with pictures? How would it be done?
Also lets say i want to make it a list(example, a navigation list). How would i do this using javascript instead of php. Thanks. |
| Code: |
| //=================================================
// Navigation block in every page //================================================= // NOTE : Lines that started with // will not be read by browser , no edit is require //================================================= // Template : // // document.write('<a href="link_to.html">text</a>'); // // Use the template (above) for one link ONLY . If you wanna add more , add in different line // eg: // document.write('<a href="link_to.html">text</a>'); // document.write('<a href="link_to.html">text</a>'); //================================================= // Do not edit the line that is not between the // Start Edit and // End Edit . //================================================= document.write('<span class="genmed" style="line-height:150%">'); // Start Edit document.write('<a href="index.html">Index</a><br />'); document.write('<a href="forum.html">Forum</a><br />'); document.write('<a href="download.html">Download</a><br />'); document.write('<a href="members.html">Members</a><br />'); document.write('<a href="help.html">Help</a><br />'); // End Edit document.write('</span>'); |
| Code: |
|
document.write('<img src="link_to.image"></img>'); document.write('<img src="link_to.image2"></img>'); |
| Code: |
| <script language="JavaScript" type="text/javascript" src="navigation.js"></script> |
| Code: |
| document.write('
<form name="jump"> <select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO"> <option value="http://sdfgh">asdrf</option> <option value="http://sdfgh">sdfgh</option> <option value="http://sedgfh">asdfgh</option> <option value="sdfgh">sfdg</option> <option value="sdgfhj">fdgh</option> </select> </form>'); |
| Code: |
|
<html> <body> <script language="JavaScript" type="text/javascript" src="menu.js"> </script> </body> </html> |
| Code: |
| document.write('
<form name=/"jump/"> |
| Marston wrote: |
| ... You guys do know that your menu won't show up if the user has Javascript disabeled, don't you? |
| Code: |
|
<?php $menuStartString = '<form name="jump"><select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">'."/n"; $option1 = '<option value="http://sdfgh">asdrf<\/option>'."/n"; $option2 = '<option value="http://sdfgh">asdrf<\/option>'."/n"; $option3 = '<option value="http://sdfgh">asdrf<\/option>'."/n"; $option4 = '<option value="http://sdfgh">asdrf<\/option>'."/n"; echo ($menuStartString.$option1.$option2.$option3.$option4); ?> |
| Code: |
|
<?php include($_SERVER['DOCUMENT_ROOT'].'/menu.php'); ?> |
| LukeakaDanish wrote: | ||
|
| KHO wrote: |
| lf you just want to include a file on each page, then just edit that one file, all you have to use is <?php include(URL); ?> and then it will call the document to the page as if you had written it there originally |
| Quote: |
| document.write('
<form name="jump"> <select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO"> <option value="http://sdfgh">asdrf</option> <option value="http://sdfgh">sdfgh</option> <option value="http://sedgfh">asdfgh</option> <option value="sdfgh">sfdg</option> <option value="sdgfhj">fdgh</option> </select> </form>'); |
| Code: |
|
document.write('<form name="jump">'); document.write('<select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">'); document.write('<option value="http://sdfgh">asdrf</option>'); document.write('<option value="http://sdfgh">sdfgh</option>'); document.write('<option value="http://sedgfh">asdfgh</option>'); document.write('<option value="sdfgh">sfdg</option>'); document.write('<option value="sdgfhj">fdgh</option>'); document.write('</select>'); document.write('</form>'); |