...

View Full Version : problem with elements and childs



shedokan
12-31-2007, 02:17 AM
when I use this script instead all the images be in one row they are in three rows.
here's a part of my script:

var voteDiv = document.createElement('DIV');

voteDiv.className='result_pollGraph';

resultDiv.appendChild(voteDiv);



var leftImage = document.createElement('IMG');

leftImage.src = voteLeftImage;

voteDiv.appendChild(leftImage);





var numberDiv = document.createElement('DIV');

numberDiv.style.backgroundImage = 'url(\'' + voteCenterImage + '\')';

numberDiv.innerHTML = '0%';

numberDiv.id = 'result_voteTxt' + currentOptionId;

voteDiv.appendChild(numberDiv);



var rightImage = document.createElement('IMG');

rightImage.src = voteRightImage;

voteDiv.appendChild(rightImage);
here's a link for who doesn't understand my explanation:
http://neostar.110mb.com/polls/ajax-poller.php

thanks.

Zefris
12-31-2007, 08:29 AM
I think IMG tags are block level elements...

You can try looking into this CSS rule...



.result_pollGraph img { display: span }

shedokan
12-31-2007, 06:14 PM
didn't change anything.

Arty Effem
12-31-2007, 10:25 PM
I think IMG tags are block level elements...

You can try looking into this CSS rule...



.result_pollGraph img { display: span }
No such value listed. Try styling all divs display:inline

Bill Posters
12-31-2007, 11:01 PM
I think IMG tags are block level elements...
Nope, inline.

shedokan
01-01-2008, 12:59 AM
thanks now the only problem left is that all of the percent's have equal width.
here is the script:

function slideVotes(pollId,currentPercent)

{

currentPercent = currentPercent/1 + 1;



for(var prop in pollVotes[pollId]){

if(pollVotes[pollId][prop]>=currentPercent){

var obj = document.getElementById('result_voteTxt' + prop);

obj.innerHTML = currentPercent + '%';

obj.style.width = Math.max(graphMinWidth,Math.round(currentPercent/100*graphMaxWidth)) + 'px';

}

}



if(currentPercent<100)setTimeout('slideVotes("' + pollId + '","' + currentPercent + '")',pollScrollSpeed);

}

and the function is called like this:

slideVotes(pollId,0);

Arty Effem
01-01-2008, 02:26 AM
obj.style.width = Math.max(graphMinWidth,Math.round(currentPercent/100*graphMaxWidth)) + 'px';


If I understand what you're trying to do, maybe this expression would work:

obj.style.width = Math.round(currentPercent/100*(graphMaxWidth-graphMinWidth)) + 'px';

shedokan
01-01-2008, 08:56 AM
nope, still equal width.

shedokan
01-02-2008, 01:47 AM
*Bump*

shedokan
01-02-2008, 10:48 AM
actually that helped but the ffour top ones are equal and the last one is ok.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum