![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: May 2006
Posts: 16
Rep Power: 0
![]() |
entering image data into js
im working with prototype.js and thickbox trying to insert the image data from http://software.hixie.ch/utilities/cgi/data/data into the js.i wanted to change
$("body").append("<div id='TB_load'><div id='TB_loadContent'><img src='pictures/circle_animation.gif' /></div></div>"); to $("body").append('<div id='TB_load'><div id='TB_loadContent'><img src="image data" /></div></div>'); the only problem is the image data has a bunch of single quote marks in it. anyone has an idea on what i should do here? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
Every time you want to use a single-quote, use a \ before it. In javascript \ is the escape character, it allows you to escape the functionality of the single quote.
\' Example: document.write('<a href="javascript: popup(\'http://google.com\');">Google</a>'); |
|
|
|
|
|
#3 |
|
Newbie
Join Date: May 2006
Posts: 16
Rep Power: 0
![]() |
well ill go ahead and try that, might take a while though...
edit: well that didnt work, i used word's replace feature to do that a little faster but in the end the js is still broken |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Apr 2005
Posts: 1,799
Rep Power: 5
![]() |
I'm sorry, I was wrong. I updated my post with the correct answer.
|
|
|
|
|
|
#5 |
|
Newbie
Join Date: May 2006
Posts: 16
Rep Power: 0
![]() |
ahh, ok. should have tryed that before, ill do it now
edit: well it still doesnt seem to be working, of you goto www.cycodude.com/gallary and view the source then do a search for this string $("body").append('<div id='TB_load'> thats where im trying to put it. Last edited by dpsleep; May 26th, 2006 at 1:14 AM. |
|
|
|
|
|
#6 |
|
Newbie
Join Date: May 2006
Posts: 16
Rep Power: 0
![]() |
ok so i used \. and it works for the most part, only problem is now it breaks the image, shows up all distorted
|
|
|
|
|
|
#7 |
|
Newbie
Join Date: May 2006
Posts: 16
Rep Power: 0
![]() |
ok well i fixed it by just entering <loding></loading> where the image was loading and puting the image code in the css. works great so no worries now. but thanks for trying. great forums you got here.
|
|
|
|
|
|
#8 |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
What on earth is a loading tag? Did you just make that up? I think you just need to put something inside the div element - a non-breaking space ( 
would do. |
|
|
|
|
|
#9 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Even if you use the dreaded "loading" tag, I'd suggest you not mix it with the "loding" version
.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#10 | |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Quote:
image = document.createElement("img");
image.src = "my_image.png";
image.alt = "Picture!!!11";
holder = document.createElement("div");
holder.id = "TB_load";
holder.appendChild(image);
body = document.getElementsByTagName("body")[0];
body.appendChild(holder);Disclaimer: not tested - there's likely to be a bug or two. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|