473,378 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Cannot use includes

Hello:

I've just asked a question about the includes, and I appreciate your help
very much.

However, this still doesn't work for me. What am I doing wrong?

I have a script that should go tho the <HEAD> tag:

<SCRIPT language="JavaScript">
// <!-- Main
function banners()
{
this[1]="http://www.url.com";
this[2]="banners/bann1.gif";
this[3]="http://www.url.com";
this[4]="banners/bann2.gif";
this[5]="http://www.url.com";
this[6]="banners/bann3.gif";

if ((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion.substring(0,1)) < 3)) { return(' '); }
var j=(new Date()).getSeconds() % 3;
document.write('<a href=' + this[2*j+1] + ' target=blank><img src=' +
this[2*j+2] + ' border=0 width=520 height=60></a>');
return(' ');
}
// -->
</SCRIPT>

This script goes to <BODY>:

<SCRIPT language="JavaScript">
// <!-- Main
banners();
// -->
</SCRIPT>

When I insert this script to the page itself - it works great. However, if I
put the HEAD protion of the script into a file banners.js, put this file
into the same directory as the page itself, then add this line to the <HEAD>
tag (or <BODY>, doesn't work anyway):

<script language="javascript" type="text/javascript"
src="banners.js"></script>

- nothing works.

What's wrong?

I would appreciate your advice.

Thank you,

--
Peter Afonin
Jul 23 '05 #1
3 1292
In article <pc********************@speakeasy.net>, Peter says...
Hello:

I've just asked a question about the includes, and I appreciate your help
very much.

However, this still doesn't work for me. What am I doing wrong?

I have a script that should go tho the <HEAD> tag:
When I insert this script to the page itself - it works great. However, if I
put the HEAD protion of the script into a file banners.js, put this file
into the same directory as the page itself, then add this line to the <HEAD>
tag (or <BODY>, doesn't work anyway):

<script language="javascript" type="text/javascript"
src="banners.js"></script>

- nothing works.

What's wrong?


Are you leaving the <script> and </script> tags in your included file?
If you are, don't.

--
Hywel I do not eat quiche
http://kibo.org.uk/
http://kibo.org.uk/mfaq.php
Jul 23 '05 #2
Yes, you're correct. Thank you, Hywel, it works now.

Peter

"Hywel" <hy**********@hotmail.com> wrote in message
news:MP************************@news.individual.ne t...
In article <pc********************@speakeasy.net>, Peter says...
Hello:

I've just asked a question about the includes, and I appreciate your help very much.

However, this still doesn't work for me. What am I doing wrong?

I have a script that should go tho the <HEAD> tag:

When I insert this script to the page itself - it works great. However, if I put the HEAD protion of the script into a file banners.js, put this file
into the same directory as the page itself, then add this line to the <HEAD> tag (or <BODY>, doesn't work anyway):

<script language="javascript" type="text/javascript"
src="banners.js"></script>

- nothing works.

What's wrong?


Are you leaving the <script> and </script> tags in your included file?
If you are, don't.

--
Hywel I do not eat quiche
http://kibo.org.uk/
http://kibo.org.uk/mfaq.php

Jul 23 '05 #3
JRS: In article <pc********************@speakeasy.net>, seen in
news:comp.lang.javascript, Peter <pv*@speakeasy.net> posted at Sat, 8
May 2004 14:44:47 :
I've just asked a question about the includes, and I appreciate your help
very much.

However, this still doesn't work for me. What am I doing wrong?

I have a script that should go tho the <HEAD> tag:

<SCRIPT language="JavaScript">
// <!-- Main
function banners()
{
this[1]="http://www.url.com";
this[2]="banners/bann1.gif";
this[3]="http://www.url.com";
this[4]="banners/bann2.gif";
this[5]="http://www.url.com";
this[6]="banners/bann3.gif";

if ((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion.substring(0,1)) < 3)) { return(' '); }
var j=(new Date()).getSeconds() % 3;
document.write('<a href=' + this[2*j+1] + ' target=blank><img src=' +
this[2*j+2] + ' border=0 width=520 height=60></a>');
return(' ');
}
// -->
</SCRIPT>

This script goes to <BODY>:

<SCRIPT language="JavaScript">
// <!-- Main
banners();
// -->
</SCRIPT>

When I insert this script to the page itself - it works great. However, if I
put the HEAD protion of the script into a file banners.js, put this file
into the same directory as the page itself, then add this line to the <HEAD>
tag (or <BODY>, doesn't work anyway):

<script language="javascript" type="text/javascript"
src="banners.js"></script>

- nothing works.

What's wrong?

I would appreciate your advice.


Obviously you do not understand what is happening. In that case, you
should simplify things until you do understand; it reduces the number of
possibilities.

Your code manifestly envisages differences between browsers; but
you do not say what browser you used for the failing test.
Use the line var Test = 7 as the *sole* contents
of your include file; and alert(Test) as the
*sole* script in a *minimal* HTML page.

If you can't get that to work, even after reading <URL:http://www.merlyn
..demon.co.uk/js-nclds.htm#OV>, then post the entire contents of both
*minimal* files here.
<SCRIPT language="JavaScript">
should be
<script type="text/javascript">

Indent your code so that its structure is clear, and ensure that it
neither is nor appears to be line-wrapped by your news software.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #4

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

Similar topics

2
by: Keiron Waites | last post by:
Hi, I include the following function: <?php function login($members_only) { if (isset($_COOKIE)) { $login = explode("|split|",$_COOKIE); $login =...
3
by: Michael J. Astrauskas | last post by:
I have a site where a user logs in and a session variable I created is used to keep track of the fact that the user is logged in. This various pages query a MySQL database to get information...
2
by: Joe Mowry | last post by:
First off, I'm posting this question for a friend that doesn't have access to the news groups. Problem: Using PHP as the base and has several PHP < includes > for various functions, all this...
4
by: Patrick | last post by:
I have an ASP site with about 50 ASP files, all of which are currently including a common "includes.asp" file near the top of the file, responsible for generating the <HEAD/> section of the HTML ...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
13
by: Mtk | last post by:
Hi! Why does the following, simple, example produce such errors? I know it has to do with the two header files including each other and (moreover) the usage of the classes One and Two in the...
1
by: techie | last post by:
Hi, I am using an xml schema (Schema1.xsd) which refers to two other Schemas as follows. <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:plcm-s="http://www.mycompany.com/plcm"...
9
by: One | last post by:
I have a main.php file that calls a php navigation menu. I want to pass the menu file a parameter to tell it which menu to display. Inside the main.php I have : include...
4
by: three-eight-hotel | last post by:
I'm somewhat of a newbie to PHP coding, but have developed a site using the technology, and have been pleasantly surprised by the capabilities offered. I am more comfortable in the ASP world,...
3
by: Hazza | last post by:
Hi, I am using PHP and mysql to create a website. I am fairly new to PHP, and thus am grateful to anyone who helps! Firstly I am running a homepage, that displays additional content if a user...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.