473,396 Members | 1,891 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,396 software developers and data experts.

Error in IE when inserting value to an empty span

11
When you insert value to an empty span in IE, the browser will not add the needed space between spans.

Example:

[HTML]<script>
function btnclick()
{
document.getElementById("sp2").innerHTML="KING"
}
</script>
<span id="sp1">Elvis</span>
<span id="sp2"></span>
<span id="sp3">Presley</span>
<input type="button" onclick="btnclick()" />
[/HTML]




When you push the button, "KING" is inserted in the secong span, like this

Elvis KINGPresley

with no space between KING and Presley

Anyone knows a way around this?
Oct 30 '07 #1
4 1832
mrhoo
428 256MB
either set a left margin for the span or include a space in the text
Oct 30 '07 #2
Stale
11
Thank you for your reply.

But this should not be necessary.
I think that IE "forgets" to set the span's status to "not empty" when the script fills it with value.

There should be a way to tell IE that the span element is no longer empty...
Oct 31 '07 #3
acoder
16,027 Expert Mod 8TB
I think that IE "forgets" to set the span's status to "not empty" when the script fills it with value.

There should be a way to tell IE that the span element is no longer empty...
I'm afraid IE 'forgets' a lot of things.

What do you mean by "not empty"? It does fill the span with the value. Does the source code show the span bunched up next to the other spans with no spaces in between them?
Oct 31 '07 #4
Stale
11
Yes it does fill the span with value, but the 2nd and 3rd span is displayed with no space between them.

So, the main problem is that IE shows the result differently if YOU write "KING" inside the span or if the SCRIPT writes "KING" inside the span.

In the source code the 3 spans are written in 3 lines. The result IS the same if you write the code on one line, with space between each span.
Nov 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Support | last post by:
Hello: I used the code in the first example from: http://support.microsoft.com/default.aspx?scid=kb;en-us;316712 I get an "error on the page" line 4 char 1 syntax error Code:0 test.aspx The...
4
by: Gary | last post by:
Hi, I get this error " " when my web page run, what does it mean? Hope someone can help!!! Gary
12
by: Doogie | last post by:
How do I make a value the default value for a combo box in ASP 3.0? What I have below does NOT work, yet I've seen it in HTML file examples before (and works if I put it in a HTML file by itself,...
11
Louis8
by: Louis8 | last post by:
I would be very appreciative of anyone who could show me a better way to do what I did. Complete newbee here. I have a comment form sidebar of blog. I wanted to Name & Comment fields required and...
7
by: Stale | last post by:
When you insert value to an empty span in IE, the browser will not add the needed space between spans. Example: function btnclick() { document.getElementById("sp2").innerHTML="KING" }...
1
by: technod | last post by:
Hi, The error I am describing occurs with the script I've pasted below. It's a validator for form fields and prints a message into a span tag located beside the empty input tag. I have hard...
0
by: mbenedict | last post by:
I am rather new at this code and am attempting to modify existing code to use clob datatypes, which I have never used before. The database tables have been set up for clob data. When trying to use...
3
by: nathanwb | last post by:
I have the following code and at times, it seems at randome I get the SERVER 500 error.. any ideas? or may code tweaks? Thanks <? include('../application.php');...
3
by: whitep8 | last post by:
Hi All, Lost my marbles with this one. The error im recieving is Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /Applications/MAMP/htdocs/oceanflow/pages/classes.php on...
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:
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...

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.