Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

document.write

Status
Not open for further replies.

squarkman

Technical User
Mar 10, 2008
34
The text below is an entire html file called menu.html. What is the purpose of document.write... Why not in this case just do it as standard HTML, no javascript object stuff? This seems silly. If something calls this html file, it could simply be
<a target='_top' href=' class='DOCLINK'>Home</a><br>
not
document.write("<a target='_top' href=' class='DOCLINK'>Home</a><br>");

Any thoughts, please?

<!--
document.write("<a target='_top' href=' class='DOCLINK'>Home</a><br>");
document.write("<a target='_top' href='../../news' class='DOCLINK'>What's New</a><br>");
document.write("<a target='_top' href='../../whatwedo/' class='DOCLINK'>What We Do</a><br>");
document.write("<a target='_top' href='../../designgallery/' class='DOCLINK'>Design Gallery</a><br>");
document.write("<a target='_top' href='../../employeeservices/' class='DOCLINK'>Employees</a><br>");
document.write("<a target='_top' href='../../sales/' class='DOCLINK'>Sales</a><br>");
document.write("<a target='_top' href='../../clients/' class='DOCLINK'>Clients</a><br>");
document.write("<a target='_top' href='../../proe/' class='DOCLINK'>Pro/ENGINEER</a><br>");
document.write("<a target='_top' href='../../training/' class='DOCLINK'>Training/Mentoring</a><br>");
document.write("<a target='_top' href='../../contact/' class='DOCLINK'>Contact Us</a><br>");
document.write("<a target='_top' href='../../employment/' class='DOCLINK'>Work For Us</a><br>");
document.write("<a target='_top' href='../../links2/' class='DOCLINK'>Engineering Links</a><br>");
document.write("<a target='_top' href='../../links/' class='DOCLINK'>Links</a><br>");
-->
 
Any thoughts, please?

You're right, there's almost no reason to ever use document.write.

The only reason I could think of that one would use document.write is if they wanted something (like a navigation bar) to appear on every page of their site, but did not have any server side technologies available to them. In this instance you could put the navigation menu in a javascript file and include it on each page.

This is a poor implementation, however. Anybody that visits your site would not be able to see the navigation menu - like here:


Why they use javascript for the nav bar on that site I'll never understand....

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top