473,396 Members | 2,154 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 values to empty spans

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

Example:

Expand|Select|Wrap|Line Numbers
  1. function btnclick()
  2. {
  3. document.getElementById("sp2").innerHTML="KING"
  4. }
  5. </script>
  6. <span id="sp1">Elvis</span>
  7. <span id="sp2"></span>
  8. <span id="sp3">Presley</span>
  9. <input type="button" onclick="btnclick()" />
  10.  


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
7 1693
rrocket
116 100+
The quickest way is probably to just add a space before King for after Elvis... Like "Elvis " or " King".
Oct 30 '07 #2
drhowarddrfine
7,435 Expert 4TB
<span> is used to apply properties to the contents in between. You have no content so nothing happens. <span> cannot create content.
Oct 31 '07 #3
Stale
11
OK, but 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.
Nov 1 '07 #4
drhowarddrfine
7,435 Expert 4TB
It depends on when it is inserted between the spans. Is the property assigned and then you insert the text, or vice versa? If after the property is assigned, then that's the problem.
Nov 1 '07 #5
Stale
11
Thanks for your reply.

But: What property?
Nov 2 '07 #6
Stale
11
<span> is used to apply properties to the contents in between. You have no content so nothing happens. <span> cannot create content.
What propery?
How can I set this property?
Nov 15 '07 #7
drhowarddrfine
7,435 Expert 4TB
I meant the id which, I assume, is used to set a CSS property to the span.
Nov 15 '07 #8

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

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
4
by: Adrian | last post by:
Hi, I have an ASP page on an intranet IIS server that posts data via a System DSN to an Access DB, normally it works fine however sometimes it returns 0 for success but no data is added to the...
9
by: Andrew Banks | last post by:
I'm running the following code in a C#.NET page and it doesn't enter the values into the DB. I'm certain the problem is to do with the txtBirth field. It allows users to enter a DOB as dd/mm/yyyy...
2
by: Charles Wilt | last post by:
I have a IBM iSeries (aka AS-400) running v5r3 of OS/400 that I access via a linked server from SQL Server 2000. The following select works fine: select * from...
6
by: BaWork | last post by:
I have the following to insert a new record: <% .. Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DSN=qqqqq;" SQLStmt = "INSERT INTO tbl_qqqqqq (main_cat, cat_fee, fee_amount)...
0
by: pere | last post by:
hi everybody, I have a script that inserts .csv data into a table; I want different users to insert their data in the same table. To differenciate them I make them fill a name (called "nom")...
4
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: <script> function btnclick() { document.getElementById("sp2").innerHTML="KING"...
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...
2
Dormilich
by: Dormilich | last post by:
Hi, I'm testing my classes for a web page and I stumble upon an error I don't have a clue what it means: Error: Fatal error: Can't use method return value in write context in "output.php" on...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
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,...
0
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...

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.