473,473 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Include Javascript multiple

Hi,

Here is my problem :

Here is my first HTML file including a js :
<script language="JavaScript"
src="http://www.toto.com/monjs.js"></script>

In my "monjs.js" :

document.write('<table cellpadding="0" cellspacing="0" border="1"
style="width:250; color: #000000">');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("line1");
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("<s" + "cript language='javascript'
type='text/javascript'
src='http://www.toto.com/monjs2.js'></s" + "cript>");
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("line3");
document.write('</td>');
document.write('</tr>');
document.write('</table>');

In my "monjs2.js" :
document.write('line2');

See the result : I've got no text in my line 2 of my table. "line2" is
written after the table.

Thanx a lot for any idea...

@+
David
Jul 23 '05 #1
4 1272
"brainofj" <da**********@yahoo.fr> wrote in message
news:40**************************@posting.google.c om...
Hi,

Here is my problem :

Here is my first HTML file including a js :
<script language="JavaScript"
src="http://www.toto.com/monjs.js"></script>

In my "monjs.js" :

document.write('<table cellpadding="0" cellspacing="0" border="1"
style="width:250; color: #000000">');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("line1");
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("<s" + "cript language='javascript'
type='text/javascript'
src='http://www.toto.com/monjs2.js'></s" + "cript>");
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("line3");
document.write('</td>');
document.write('</tr>');
document.write('</table>');

In my "monjs2.js" :
document.write('line2');

See the result : I've got no text in my line 2 of my table. "line2" is
written after the table.

Thanx a lot for any idea...

@+
David


Try:

<script type="text/javascript" src="http://www.toto.com/monjs1.js"></script>
<script type="text/javascript" src="http://www.toto.com/monjs2.js"></script>
<script type="text/javascript" src="http://www.toto.com/monjs3.js"></script>

Where "monjs1.js" =

document.write('<table cellpadding="0" cellspacing="0" border="1"
style="width:250; color: #000000">');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("line1");
document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td style="width: 250;">');

Where "monjs2.js" =

document.write('line2');
Where "monjs3.js" =

document.write('</td>');
document.write('</tr>');
document.write('<tr>');
document.write('<td style="width: 250;">');
document.write("line3");
document.write('</td>');
document.write('</tr>');
document.write('</table>');
Jul 23 '05 #2

"brainofj" <da**********@yahoo.fr> wrote in message
news:40**************************@posting.google.c om...

document.write('<table cellpadding="0" cellspacing="0" border="1"
style="width:250; color: #000000">');

*****Hold it right there****
******The semicolon after the 250 makes
******* js think the end of statement has arrived
********* easy mistake to make -
********* maybe put the styles into a css file of its own
*************************************************

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.788 / Virus Database: 533 - Release Date: 11/1/2004
Jul 23 '05 #3
Hal Rosser wrote:
"brainofj" <da**********@yahoo.fr> wrote in message
news:40**************************@posting.google.c om...
document.write('<table cellpadding="0" cellspacing="0" border="1"
style="width:250; color: #000000">');
*****Hold it right there****
******The semicolon after the 250 makes
******* js think the end of statement has arrived


No it doesn't.
********* easy mistake to make -
********* maybe put the styles into a css file of its own
*************************************************


Now, you stop right there. Your answer is about as wrong as wrong can get.

Go ahead, try it. Put it in a sample page. It works as written as long
as its one line. Stop giving garbage answers and confusing people who
are here to try to learn. At a minimum, test your answers. I did.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
Jul 23 '05 #4
Hal Rosser wrote:
"brainofj" <da**********@yahoo.fr> wrote [...]
document.write('<table cellpadding="0" cellspacing="0" border="1"
style="width:250; color: #000000">');

*****Hold it right there****
******The semicolon after the 250 makes
******* js think the end of statement has arrived


That statement is as nonsensical as your posting style is. No working
script engine would parse the ";" within a string literal as a statement
delimiter.

The real reason is that the UA parses elements, not tags; therefore writing
the start tag of an element without the matching end tag is likely to cause
problems. More, consecutive document.write() calls are inefficient,
instead the lines should be concatenated -- preferably using an Array
literal and Array.prototype.join() rather than several "+" operations,
if it does not need to run with non-ECMAScript 3 compliant engines --,
then written with *one* document.write() call:

document.write([
'foo',
'bar'
].join(''));

To make the generated source code more legible, one could write

document.write([
'foo',
'bar'
].join('\n'));
PointedEars
--
I can't find the OK button anywhere on my keyboard!!!
Jul 23 '05 #5

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

Similar topics

3
by: Phil Powell | last post by:
Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I am honestly not sure how to do it in Javascript (I...
6
by: atv | last post by:
Alright, i have some questions concerning include files en global variables.I hope someone is willing to answer these. 1).Why is it that if i define a global variable in a file, say main.c, and...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
6
by: Gideon de Swardt | last post by:
I am trying to do a server side transformation using an xsl:include in my xslt stylesheet. The include stylesheet is stored /Library/abo.Library.xslt and is included in multiple xslts, one example...
1
by: jp | last post by:
Hi, I have written a function that adds up numeric values from a multiple textfields on a page and writes the sum to the total textfield. I would like to move this from the page to an include so...
23
by: Big Bill | last post by:
http://www.promcars.co.uk/pages/bonnie.php I don't believe they should be there, can I take them out without stopping the includes from functioning? I'm the (hapless) optimiser on this one... I...
6
by: jan | last post by:
My apologies for being a javascript beginner and asking such a basic question. This is probably so easy that nobody ever mentions it. Tutorials and places that tell of basic commands never seem to...
7
by: Kristian Virkus | last post by:
Hello! I would like to write a C programm with multiple include files, where one may use another one (to print the value of a variable). When I try to compile the program below, the linker...
4
by: rocketeer | last post by:
I've a set of Javascript classes that maintain state. For example, gm.js might be: var GroupManager { groups: {} }; Over time I add new groups to the list: GroupManager.groups = myGroup; ...
0
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,...
1
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...
0
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...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.