473,662 Members | 2,593 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="JavaS cript">
// <!-- 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.app Name == "Netscape") &&
(parseInt(navig ator.appVersion .substring(0,1) ) < 3)) { return(' '); }
var j=(new Date()).getSeco nds() % 3;
document.write( '<a href=' + this[2*j+1] + ' target=blank><i mg src=' +
this[2*j+2] + ' border=0 width=520 height=60></a>');
return(' ');
}
// -->
</SCRIPT>

This script goes to <BODY>:

<SCRIPT language="JavaS cript">
// <!-- 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="javas cript" 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 1303
In article <pc************ ********@speake asy.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="javas cript" 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**********@h otmail.com> wrote in message
news:MP******** *************** *@news.individu al.net...
In article <pc************ ********@speake asy.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="javas cript" 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************ ********@speake asy.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="JavaS cript">
// <!-- 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.app Name == "Netscape") &&
(parseInt(navi gator.appVersio n.substring(0,1 )) < 3)) { return(' '); }
var j=(new Date()).getSeco nds() % 3;
document.write ('<a href=' + this[2*j+1] + ' target=blank><i mg src=' +
this[2*j+2] + ' border=0 width=520 height=60></a>');
return(' ');
}
// -->
</SCRIPT>

This script goes to <BODY>:

<SCRIPT language="JavaS cript">
// <!-- 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="javas cript" type="text/javascript"
src="banners.j s"></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="JavaS cript">
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.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.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
2339
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 = array("username"=>$login,"password"=>$login); }
3
2080
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 (mostly to generate a catalogue and news page). Occasionally when loading a page I simply get the error "No database selected" when the PHP script attempts to run the query. Usually I can press reload in my browser (Netscape, IE, and Opera) and the...
2
1606
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 by its self works just fine. Failure occurs on adding the XML include. Here's the wierd: If all the PHP includes are removed/commented out,
4
1629
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 I need to make a change for 3 of those ASP files such that some dynamic HTML is generated in the <HEAD/> section. I want those dynamic HTML to appear only for 3 specific ASP files. Is there a more elegant way other than to 1) Dim...
8
5464
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
13
1660
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 "opposite" header file... What do I have to do to make this example work? Thanks for all the help! // * Error messages: One.h(11): error C2146: syntax error : missing ';' before identifier 't'
1
11276
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" targetNamespace="http://www.mycompany.com/plcm" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:include schemaLocation="Schema2.xsd"/> <xsd:include schemaLocation="Schema3.xsd"/>
9
2185
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 "/home/ottadca1/public_html/includes/leftnav.php?menuid=dave"; But the error is : Warning:
4
5934
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, however and am really struggling with managing sessions in PHP, based on my experiences with managing sessions in ASP. 99.9% of the feedback I have seen when dealing with the errors has referred to having whitespace before the <?php or after the...
3
1943
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 has logged in. I set a loggedin session in the log in page, which I have tested and works fine in other scripts. I am displaying news on the homepage (which is stored in a mysql database), and this works fine when the user accesses the homepage...
0
8432
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
8857
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...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8546
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
7367
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
6186
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
4180
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...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
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.