473,770 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'wrap' inconsistency? createElement VS document.write

Hello,

im some image elements using doc.createEleme nt('IMG');
i set the following styles:
- for the images container: white-space:normal;
- for the images themselves: display: inline;

i append the images to the body ... but the imagery dont wrap when the
window gets smaller, unless i append a space (createTextNode ) after each
image

HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
src="" ...> it wraps fine
Is this normal??

Pieter

Jul 20 '05 #1
3 2600


Pieter Van Waeyenberge wrote:

im some image elements using doc.createEleme nt('IMG');
i set the following styles:
- for the images container: white-space:normal;
- for the images themselves: display: inline;

i append the images to the body ... but the imagery dont wrap when the
window gets smaller, unless i append a space (createTextNode ) after each
image

HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
src="" ...> it wraps fine
Is this normal??


Write a small test case demonstrating the problem, post a URL and tell
us which browser(s) exhibit the problem. Then someone can better give an
opinion on why that occurs or shouldn't occur.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
sorry, some more detail:
(i dont have URL handy and the whole script is too complex to post it here)

i only tested on most recent NS & IE, and the code behaves the same ...

SCENARIO 1: images do NOT wrap
--------------------------------------
<script>
onload = function(){
var foo = document.create Element('IMG');
foo.src = 'foo.jpg';

var goo = document.create Element('IMG');
goo.src = 'goo.jpg';

var myBody = document.getEle mentsByName('BO DY');
myBody = myBody.item(0);

myBody.appendCh ild(foo);
myBody.appendCh ild(goo);
}
</script>
<body>
</body>

SCENARIO 2: images wrap
--------------------------------------
<body>
<img src="foo"><img src="goo">
</body>

Remark: i also tried putting the images of SCENARIO 1 in a container with
'white-space:normal;' and the images themselves 'display:inline ;' ... still
no wrapping when flow should go to next line, instead i get scrollbar and
all on one line ... unlike in SCENARIO 2

However, in SCENARIO 1, i obtain wrapping when i explicitly add some
white-space after every image ... sounds logical, but in SCENARIO 2 theres
no whtespace between the images so i find it inconsistent?

I hope this is more clear ....
Pieter.

"Martin Honnen" <ma*******@yaho o.de> wrote in message
news:40******** @olaf.komtel.ne t...


Pieter Van Waeyenberge wrote:

im some image elements using doc.createEleme nt('IMG');
i set the following styles:
- for the images container: white-space:normal;
- for the images themselves: display: inline;

i append the images to the body ... but the imagery dont wrap when the
window gets smaller, unless i append a space (createTextNode ) after each
image

HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
src="" ...> it wraps fine
Is this normal??


Write a small test case demonstrating the problem, post a URL and tell
us which browser(s) exhibit the problem. Then someone can better give an
opinion on why that occurs or shouldn't occur.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #3
ignore this thread .. i didnt set whitespace = normal explicitly in the
containing elemnt

pieter.

"Pieter Van Waeyenberge" <p@foo.com> wrote in message
news:40******** *************@n ews.skynet.be.. .
Hello,

im some image elements using doc.createEleme nt('IMG');
i set the following styles:
- for the images container: white-space:normal;
- for the images themselves: display: inline;

i append the images to the body ... but the imagery dont wrap when the
window gets smaller, unless i append a space (createTextNode ) after each
image

HOWEVER, when i write it with HTML: <img src="" ...><img src="" ...><img
src="" ...> it wraps fine
Is this normal??

Pieter

Jul 20 '05 #4

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

Similar topics

11
2686
by: Ken | last post by:
How do I force the text generated by a document.write command to wrap after a specified number of characters? Thanks for the help.
4
2826
by: Razzbar | last post by:
I need to be able to conditionally load a remote script, using the "<script src=..." syntax. Or some other way. I've seen people writing about using the document.write method, but it's not working like I want it to. What's happening is, if I do a document.write(scriptcall), the script loads, although sometimes very slowly... (?). Any inline code is executed (I used an alert to verify that the script is loading). But all the previous...
2
1213
by: Oscar Monteiro | last post by:
Recently writing some code i cross over a problem using document.write: The code <input name="e2" size="20" type="text"> <select name="e1"> <option>......................................... <option>Option1 </select> <input src="picture.gif" onclick="I()" align="right" type="image" width="60" height="49"></p>
2
1888
by: John | last post by:
Hi, I am getting syntax errors in my JavaScript code, code snippet as follows (between my <script></script> tags: document.write(<a title="Nice to meet you" href="http://www.mydomain.com/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(\'welcome\',\'\',\'../images/topnav/welcome_b_mydo main-com.gif\',\'meet_the_team\',\'\',' + g_meet_the_team + ',\'rave_reviews\',\'\',' + g_rave_reviews +...
2
2935
by: Eric Mitchell | last post by:
Hello all, I am using the document.write() method to create new content on the same page, however... I need to create a new button using this method (button in HTML). Complicating the matter worse, I have a javascript function that needs to be called in the onClick event of the button. Is there any way of doing this? Here is my code, which gives me an error because the function is read as an object, and there is no object... <script...
7
2407
by: Andrea | last post by:
Hi there - I'm hoping someone can help me; I've been struggling with this for a few days! :-) I have a webpage that is comprised of many forms containing questions. As the user answers one of the questions, that form is hidden and the next is displayed. Also, as the user answers each question a "count" variable is updated based on their response. I would like the question to show up on the left side and the answer to show up in the...
8
3751
by: johnsonlau | last post by:
When I use document.write to replace the comment of a frame, I found that the page was always showing as loading in Firefox (2.0.0.2). But it seems that it is OK in IE6. Could someone help me with this problem? Thanks. My file: <html>
8
7110
by: Mateusz Viste | last post by:
Hi, I am trying make some multimedia files playable from my website. So far, I am able to generate dynamically a new page containing the right <embed> section. However, when I load my script, it overwrites the current page. Is there any way I could load a new tab or window, and put the new content into it? Here is the script I am using right now:
7
8968
by: sj071 | last post by:
I'm little more than a novice when it comes to javascript, and this particular problem has been driving me mad for the past few days... The Problem: I have a javascript file that uses document.write to send output to the browser. This javascript file contains some html code and another script tag. The execution order in Internet Explorer (6&7) appears to be different than that of browsers such as FireFox. Example:
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10228
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10002
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7415
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6676
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3575
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.