| | |
image breaking
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2007
Posts: 129
Reputation:
Solved Threads: 15
Hello.
I'm using JS/DOM to create a map in a <div>, named map, like this:
It works, but the image breaks on a <br/>
(screenshot: http://i28.tinypic.com/6ynu3o.png)
the image is a 32x32 tile of grass.
It shouldn't have those breaks.
I've tried
also, same thing.
Any ideas?
I'm using JS/DOM to create a map in a <div>, named map, like this:
javascript Syntax (Toggle Plain Text)
var tile = document.createElement("IMG"); tile.src = "tiles/" + node.getAttribute("type"); tile.setAttribute("width", "32"); tile.setAttribute("height", "32"); tile.className = "brick"; map.appendChild(tile);
It works, but the image breaks on a <br/>
(screenshot: http://i28.tinypic.com/6ynu3o.png)
the image is a 32x32 tile of grass.
It shouldn't have those breaks.
I've tried
javascript Syntax (Toggle Plain Text)
map.innerHTML = "<img src=\"tiles/grass.gif\" width=\"32\" height=\"32\" class=\"brick\">";
Any ideas?
Why would you create multiple instances of the same image with DOM manipulation instead of just setting the background image on the div with css which will automatically tile the image?
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
Well, that's a detail you did not expound upon. Also showing us an entire page instead of 5 lines of code would help. It's a bit hard to debug an image.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Aug 2007
Posts: 129
Reputation:
Solved Threads: 15
Okay, so I'm parsing the map file, looping through the nodes, and adding an image based on the XML file:
"map" is blanked, then that code executes & adds those images.
I still see no reason for it to break.
javascript Syntax (Toggle Plain Text)
for(var i=0;i<map_node.childNodes.length;i++) { var node = map_node.childNodes[i]; if(typeof node.tagName == "undefined") continue; if(node.tagName == "tile") { var tile = document.createElement("IMG"); tile.src = "tiles/" + node.getAttribute("type"); tile.setAttribute("width", "32"); tile.setAttribute("height", "32"); tile.className = "brick"; map.appendChild(tile); } if(node.tagName == "br") map.appendChild(document.createElement("BR")); } }
"map" is blanked, then that code executes & adds those images.
I still see no reason for it to break.
![]() |
Similar Threads
- breaking down a string with a delimiter (Java)
- blocking direct image access (Site Layout and Usability)
- Monitor makes pinging sound, image problems (Monitors, Displays and Video Cards)
- Breaking News In Sacramento! (Geeks' Lounge)
- How to fix an image outside the <body> tag? (HTML and CSS)
- Content Breaking thru Borders (JavaScript / DHTML / AJAX)
- breaking image into smaller bits (IT Professionals' Lounge)
- A joke ... (Geeks' Lounge)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: database connection possible????
- Next Thread: Function not returning value
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array beta browser captchaformproblem cart checkbox child class close codes column css date debugger decimal dependent design disablefirebug dom download editor element embed engine enter error events explorer ext file firefox focus form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html ie7 ie8 iframe index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post problem programming prototype redirect runtime safari scale scriptlets scroll search security select shopping size software toggle unicode w3c web windowofwords wysiwyg \n






