473,467 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

.js include creates extra line in html display

Hi All,

In a web page I have created I have included a .js file in the body section
of the page with the below JavaScript code. The code works fine, but
creates an extrra blank line at the bottom of the web page! Does anyone
know why this is happening?

Any help kindly appreciated

Tobierre

Expand|Select|Wrap|Line Numbers
  1. document.write('<img width="1" height="1"
  2. src="http://www.mydomain.com/log_analysis_screen_info.gif?' + 'width=' +
  3. screen.width + '&height=' + screen.height + '&depth=' + screen.colorDepth +
  4. '">\n');
  5.  

Oct 4 '05 #1
5 1830
>> '">\n');

\n is a Javascript escape value for a new line

Oct 4 '05 #2
"Tobierre" <No******@hotmail.com> wrote:
In a web page I have created I have included a .js file in the body section
of the page with the below JavaScript code. The code works fine, but
creates an extrra blank line at the bottom of the web page! Does anyone
know why this is happening?

Any help kindly appreciated

Tobierre

Expand|Select|Wrap|Line Numbers
  1. document.write('<img width="1" height="1"
  2. src="http://www.mydomain.com/log_analysis_screen_info.gif?' + 'width=' +
  3. screen.width + '&height=' + screen.height + '&depth=' + screen.colorDepth +
  4. '">\n');


Remove the "\n" at the end of the code.

--
Spartanicus
Oct 4 '05 #3
Hi Spartanicus,

Yes \n is a newline in the code but it only represents "white space" in html
and is not equal to <br> so should not visibly display a new line in the
browser.

Also I have removed the \n from the code with no change to the display...

Tobierre

----- Original Message -----
From: "Spartanicus" <in*****@invalid.invalid>
Newsgroups: comp.lang.javascript
Sent: Tuesday, October 04, 2005 9:09 AM
Subject: Re: .js include creates extra line in html display

"Tobierre" <No******@hotmail.com> wrote:
In a web page I have created I have included a .js file in the body
section
of the page with the below JavaScript code. The code works fine, but
creates an extrra blank line at the bottom of the web page! Does anyone
know why this is happening?

Any help kindly appreciated

Tobierre

Expand|Select|Wrap|Line Numbers
  1. document.write('<img width="1" height="1"
  2. src="http://www.mydomain.com/log_analysis_screen_info.gif?' + 'width=' +
  3. screen.width + '&height=' + screen.height + '&depth=' + screen.colorDepth
  4. +
  5. '">\n');

Remove the "\n" at the end of the code.

--
Spartanicus


"Spartanicus" <in*****@invalid.invalid> wrote in message
news:q9********************************@news.spart anicus.utvinternet.ie... "Tobierre" <No******@hotmail.com> wrote:
In a web page I have created I have included a .js file in the body
section
of the page with the below JavaScript code. The code works fine, but
creates an extrra blank line at the bottom of the web page! Does anyone
know why this is happening?

Any help kindly appreciated

Tobierre

Expand|Select|Wrap|Line Numbers
  1. document.write('<img width="1" height="1"
  2. src="http://www.mydomain.com/log_analysis_screen_info.gif?' + 'width=' +
  3. screen.width + '&height=' + screen.height + '&depth=' + screen.colorDepth
  4. +
  5. '">\n');


Remove the "\n" at the end of the code.

--
Spartanicus

Oct 4 '05 #4
> The code works fine, but creates an extrra blank line at
the bottom of the web page!
document.write('<img width="1" height="1"
src="http://www.mydomain.com/log_analysis_screen_info.gif?' + 'width=' +
screen.width + '&height=' + screen.height + '&depth=' + screen.colorDepth +
'">\n');


I'm guessing a HTML image would also create that space (because of
line-height). If so, do this:

CSS:
..script img { display: block }

HTML:
<div class="script">
<script type="text/javascript">
// Your code
</script>
</div>

Oct 4 '05 #5
Thanks Twaddle,

Your suggestion makes sense, I missed that one! I altered your css as
follows:

<span style="display: none;">
<script src="filepath"></script>
</span>

Thanks Tobierre

"twaddle" <tw*****@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
The code works fine, but creates an extrra blank line at
the bottom of the web page!


document.write('<img width="1" height="1"
src="http://www.mydomain.com/log_analysis_screen_info.gif?' + 'width=' +
screen.width + '&height=' + screen.height + '&depth=' + screen.colorDepth
+
'">\n');


I'm guessing a HTML image would also create that space (because of
line-height). If so, do this:

CSS:
.script img { display: block }

HTML:
<div class="script">
<script type="text/javascript">
// Your code
</script>
</div>

Oct 4 '05 #6

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

Similar topics

1
by: Susan Cranford | last post by:
I know this is simple but I'm new with it and can't see it. I am calling this sub from an ASP page right after the <html> tag as: <!-- #include file="genproc.inc"--> Then I call the sub below...
4
by: mappo | last post by:
There are about a million posts on how to get rid of the extra space _after_ the form end-tag, but I can't find any that solve my problem: extra space _in_ the form tag. I have a table nestled...
2
by: Ben Turner | last post by:
Hi, I need to create an ASPX page that includes both traditional HTML Forms (which are submitted to a third-party site like a travel booking service) and also make use of the ASP.Net form. I've...
11
by: rfox | last post by:
I've built a site using tables for layout, and it looks ok in everything but in IE where it places extra space around the graphics that contain a rollover script. (Please see...
3
by: sunbeam | last post by:
Short Description of the Project: we developed a e-learning system for our students. each student has a unique username/password to view the modules he/she should view and nothing more. since we...
11
by: cybervigilante | last post by:
I can't seem to change the include path on my local winmachine no matter what I do. It comes up as includ_path .;C:\php5\pear in phpinfo() but there is no such file. I installed the WAMP package...
2
by: dave6502 | last post by:
Struggling newbe here, some of my #includes work, some dont. Is it possible to list the include path ? (in BASH), I have looked at the environmental variables (loads of them) but cannot find a...
3
by: =?Utf-8?B?QnJhbmRvbg==?= | last post by:
Hi, I have an aspx page that has the "include" code in it which includes another page that displays information. I also have an upload page that allows users to upload a simple html document...
10
by: silverbob | last post by:
I am replacing my Javascript-called files with SSI, and I'm getting an unexpected result with my page footer. I can really use some help with this. The footer contains a copyright (left...
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...
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
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...
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: 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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.