By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,442 Members | 1,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,442 IT Pros & Developers. It's quick & easy.

Ajax How-to Force size of 'span' child image

P: 5
When i read in an image from xml and write it to post. I create is as a span but it seems im stuck with not knowing how to FORCE THE SIZE of the image.

Even when i do !important on the css the browser still shows the full size image and not 120x80:
/* video */
.cl-video {width:120px;height:80px;float:left;background-Color:#EEEEEE;position:relative; left:12px;}

The code:

case 'img':
e1 = document.createElement(el[j]);
e1.setAttribute('src', items[j][i].firstChild.nodeValue);
// added line below July 3 2006
e1.setAttribute('id', 'vlink'+i);
break;
e1.appendChild(document.createTextNode(items[j][i].firstChild.nodeValue));

we1.appendChild(document.createTextNode(elpretext[j])); // adds text in front of element
we1.appendChild(e1);

we1.setAttribute('class',wrapelementclass[j]);
we1.setAttribute('className',wrapelementclass[j])

outerWrapper.appendChild(we1)

Please help!
Jun 16 '07 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
Try changing the image width and height rather than the span containing the image.
Jun 18 '07 #2

P: 5
Try changing the image width and height rather than the span containing the image.
That is exactly what I'm trying to avoid. Is there a way other than resizing the image?
Jun 18 '07 #3

acoder
Expert Mod 15k+
P: 16,027
That is exactly what I'm trying to avoid. Is there a way other than resizing the image?
Why do you want to avoid that? You can always resize the image to its real size when you need to. Resizing the image would achieve the same result.
Jun 19 '07 #4

P: 5
If I grab different content from all websites around the net and i want to avoid taking time in resizing all to thumbs in specific size saves tons of time

its a time saver x 1000s of clips and pictures.
Jun 22 '07 #5

acoder
Expert Mod 15k+
P: 16,027
When you resize an image, you aren't actually modifying the image. It's just a modification of the display of the image. You can also just change the height or the width and the other will resize automatically by the same ratio.
Jun 22 '07 #6

Post your reply

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