473,614 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I append header and footer text through javascript calls

What I would like to do is create header and footer information for my
webpages which are created by calling from a referenced .js page . . . for
example
in Header.js:
<script language="JavaS cript">
function CreateHeader
{
document.writel n("<table>")
document.writel n("<tr>")
document.writel n("<td>")
document.writel n("Stuff")
document.writel n("</td>")
document.writel n("</tr>")
document.writel n("</table>")

}
</script>

in Index.htm:
<body>
<script type="text/javascript">
onLoad="CreateH eader()"
</script>
</body>

Which would give me in this case a Stuff in a one celled table.
Jul 20 '05 #1
1 5873
Patrick Gibbons wrote:
What I would like to do is create header and footer information for my
webpages which are created by calling from a referenced .js page . . . for
example
in Header.js:
<script language="JavaS cript">
function CreateHeader
{
document.writel n("<table>")
document.writel n("<tr>")
document.writel n("<td>")
document.writel n("Stuff")
document.writel n("</td>")
document.writel n("</tr>")
document.writel n("</table>")

}
</script>
Firstly, script tags are not placed in external javascript files and
will cause errors if they are. Hence remove the SCRIPT start and end
tags from within Header.js
in Index.htm:
Include Header.js (I personally would use lower case file names) in the
HEAD section of the page:

<head>
....
<script type="text/javascript" src="Header.js" ></script>
....
</head> <body>
<script type="text/javascript">
onLoad="CreateH eader()"
This will not work as coded - you can't document.write after the onload
event. Call CreateHeader directly:

CreateHeader(); // write header here
</script>
</body>

Similarly, at the end of the document and assuming a function
CreateFooter exists to document writes footer HTML, include

<script type="text/javascript">
CreateFooter(); // write footer here
</script>


Cheers,
Dom

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
8318
by: Peter Wu | last post by:
Hello, I want to create a Header and Footer for every ASPX page I build. I created 2 Web user controls respectively and placed them in an ASPX page. The problem is that I cannot position the Footer to be always at the bottom of the page. The Header and Footer are always together at the top of the page. Was I missing anything? Thanks!
0
357
by: John Crowley | last post by:
I keep running into this over and over again... I want a block server control that renders a header and footer, and child controls in between. But I don't want a templated control, for the following reasons: 1) Render blocks are not allowed inside a templated control. 2) I want the inner controls scoped at the parent aspx (or ascx), not at the template naming container. This type of control would be ideal for website headers and...
1
4803
by: AndrewF | last post by:
Hi all, I am sure something like this has been covered somewhere so I am hoping a quick answer or pointer may suffice, however a couple of days trawling and I can't find anything on it. I'm building a layout and for reasons of PDA and text based browsers I want to have my primary navigation at the bottom of the HTML layout. Thus the main content and supplementar content are positioned higher in the document structure then the links go...
14
3039
by: Markus Olderdissen | last post by:
each web-page contains header and footer. if the web-page contains more then one page i want to print its header and footer to each page. but header is only printed on first page and footer on last page. how to do this? how can i find out how many paper is needed?
11
16554
by: Grischa Brockhaus | last post by:
Hi, I'm trying to produce a div layout containing a header on the top with fixed height, a footer on the bottom using fixed height and a content layer using what's left of the browsers window. So my header div is defined at top:0; height:40px , my footer is defined as bottom:0; height:40px and the content is defined as top:40px;bottom:40px; This works very well with firefox but doesn't work with IE, as IE ignores the bottom statement...
2
1685
by: ~john | last post by:
I'm trying to get my header to have 2 images, one for the top left and one for the top right. Here's a link to my page... http://levelwave.com/dev/div/index.html and will eventually be images but what I'm wanting is for the to be aligned left and to be aligned right. As of now they're both squished to the left and I'm not sure how to change my CSS to do this.
5
14181
by: fjanon | last post by:
Is there a way to remove the default footer/header from the printed page when printing a page from HTML/Javascript in IE 6? I want to use letterhead paper and I have to remove manually the header/footer from the default printer setting. I know that IE has lots of options/features, I spent a good time on MSDN but could not find anything. TIA Fred
7
2288
by: Big Moxy | last post by:
site - http://projects.zanalysts.com/hearingaids1000/default.aspx css - http://projects.zanalysts.com/hearingaids1000/css/styles.css js - http://projects.zanalysts.com/hearingaids1000/JScript/setFooterPositionA.js and setFooterPositionR.js javascript - http://www.alistapart.com/articles/footers (example 5 and 6) I am in desparate need of a solution for a page footer. From googling it seems that using javascript is the best approach so I...
3
5511
by: Noorain | last post by:
I designed a site. i want to header,footer,left & right column fixed but body information only scrolling. this site screen to be 800/600 px. i designed this way but when i used position fixed all information to show as displace. please help me. my coding are as below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>...
0
8197
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8640
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8287
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8443
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7114
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6093
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5548
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2573
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.