Jump to content

External Script Problem


petersrin
 Share

Recommended Posts

External Script "NavBar.js"

document.write("<div class = "NavBarRight"> \  <a class = "NavBarRightText" href ="Option_1.htm" >Option 1 \ 	 <p></p> \  <a class = "NavBarRightText" href ="Option_1.htm" >Option 1 \ 	 <p></p> \  <a class = "NavBarRightText" href ="Option_1.htm" >Option 1 \ 	 <p></p> \  <a class = "NavBarRightText" href ="Option_1.htm" >Option 1 \	</div>	\	<div class = "NavBarLeft"> \  <a class = "NavBarLeftText" href ="home.htm" >Home \ 	 <p></p> \    <a class = "NavBarLeftText" href ="new_for_2006.htm" >New For 2006 \ 	 <p></p> \    <a class = "NavBarLeftText" href ="plant_list.cfm">Plant List \ 	 <p></p> \  <a class = "NavBarLeftText" href ="ordering_info.htm" >Ordering Info \ 	 <p></p>  \  <a class = "NavBarLeftText" href ="contact_us.htm" >Contact Us \ 	 <p></p> \	</div>")

Main Page HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title>The Brasstown Garden</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link href="index.css" rel="stylesheet" type="text/css"><style type="text/css"><!--body {	background-color: #000000;}--></style></head><body>	<p><img src="The_Brasstown_Garden.jpg" width="1024" height="100"></p>	<p class="Slogan">"Specializing in plants that thrive in Flordia gardens"</p>  <div class="Body">  <div class = "Title">Home</div>  <p>Text goes here</p>	</div>	<script type="text/javascript" src="NavBar.js">	</script></div></html>

CSS stylesheet

.Body {	font-family: Georgia, "Times New Roman", Times, serif;	font-size: 18px;	color: #FFFFFF;	float: left;	width: 744px;	left: 140;	position: absolute;}.NavBarLeft {	font-family: Georgia, "Times New Roman", Times, serif;	font-size: 18px;	font-style: normal;	color: #FFFFFF;	height: 640px;	width: 150px;	background-image: url(NavBar.jpg);	text-align: center;	text-decoration: none;	background-repeat: no-repeat;	background-position: center;	position: absolute;	margin-top: 18px;}.NavBarLeft a:hover {	font-weight: bold;	font-style: normal;	color: #FFFFFF;	text-decoration: none;}.NavBarLeftText {	font-family: Georgia, "Times New Roman", Times, serif;	font-size: 18px;	font-style: normal;	color: #FFFFFF;	height: 640px;	width: 100px;	background-image: none;	text-align: center;	text-decoration: none;}.Body {	height: 659px;	width: 719px;	position: absolute;	left: 165px;}.NavBarRight {	font-family: Georgia, "Times New Roman", Times, serif;	font-size: 18px;	font-style: normal;	color: #FFFFFF;	height: 640px;	width: 150px;	background-image: url(NavBar.jpg);	text-align: center;	text-decoration: none;	background-repeat: no-repeat;	background-position: center;	position: absolute;	margin-top: 18px;	left: 886.5px;}.NavBarRight a:hover {	font-weight: bold;	font-style: normal;	color: #FFFFFF;	text-decoration: none;}.NavBarRightText {	font-family: Georgia, "Times New Roman", Times, serif;	font-size: 18px;	font-style: normal;	color: #FFFFFF;	height: 640px;	width: 100px;	background-image: none;	text-align: center;	text-decoration: none;}.Title {	font-size: 36px;	font-weight: bolder;	font-variant: small-caps;	color: #FFFFFF;	text-align: center;	font-family: Georgia, "Times New Roman", Times, serif;}.NavBarLeft a:visited {	text-decoration: line-through;}.NavBarRight a:visited {	text-decoration: line-through;}.Slogan {	font-size: 24px;	font-weight: bold;	color: #FFFFFF;	text-align: center;}.Banner {	vertical-align: middle;}.News_body {	line-height: 2;}

Probably don't need all of that, but can't hurt. Most is straightforward. The problem, is that altought the "NavBar.js" ought to create my nave bars on the right and left of my page, they just plain don't. The code inside was the exact code that used to make the NavBars before, put into a script so I can change one instance of it and the rest will be altered. It is a cleaner and more efficient coding. Why do the bars not appear? Thanks.

Link to comment
Share on other sites

  • 1 month later...
Guest kNiFE01

This post was helpful. I had a similiar problem but instead of having double quotations, I was not putting the \ after each line. The w3Schools javascript tutorial doesn't say anything about putting \ after each external link line. I spent weeks trying to figure out the problem. thanks again. --kNiFE01

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...