473,372 Members | 825 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,372 software developers and data experts.

Error in IE when inserting values to empty spans

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


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()" />

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 1692
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
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
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
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
Thanks for your reply.

But: What property?
Nov 2 '07 #6
<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
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

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...
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...
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...
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...
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)...
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")...
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"...
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...
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...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.