PDA

View Full Version : Javascript problem.



Kadrus
November 10th, 2007, 11:42 AM
<style type="text/css">
span
{
font:12px arial;
background:#CCCCCC;
position:absolute;
width:100;
height:500;
top:300;
clip:rect(0 100 100 0);

}
</style>
<script type="text/javascript">
var interval
startPosition=0
topPosition=100
endPosition=100
speed=50

function scrollit()
{
if (startPosition!=200)
{
startPosition=startPosition+1
topPosition=topPosition-1
document.getElementById('display').style.clip="rect(" + (startPosition + 1) + " 100 " + (startPosition + endPosition) + " 0)"
document.getElementById('display').style.top=topPo sition
interval=setTimeout("scrollit()",speed)
}
else
{
startPosition=0
topPosition=100
endPosition=100
interval=setTimeout("scrollit()",speed)
}
}

function stopinterval()
{
clearTimeout(interval)
}
</script>

<body onload="scrollit()" onunload="stopinterval()">
<span id="display" ><br /><br /><br /><br /><br /><br /><br />
A text here <br />
</span>
The problem that I am having here..is that i cannot figure a way how to align the span..
Anyone can help?

Kadrus
November 10th, 2007, 12:53 PM
So..no one has a clue?!

eggdeng
November 10th, 2007, 01:01 PM
Just slip in a left offset value in the first block of code, for example


width:100;
height:500;
left:400;
top:300;

Easy.

supirman
November 10th, 2007, 01:01 PM
What do you mean by align? Are you trying to move the box (span), or the text within the span? Give more info.

smartbei
November 10th, 2007, 01:09 PM
Firstly, please cut out the "bummer"/"no one has a clue" posts. This forum is not that busy, so your post was still in the first couple. Most people who browse this forum don't do so constantly, and just check if there are any new posts every several hours at the least. Therefore, the fact that nobody responded within less than an hour does not mean that no one has a clue.

Could you explain what you are trying to do with this code? There might be a simpler way to do it and/or we might better understand your question.

Kadrus
November 10th, 2007, 01:18 PM
Just slip in a left offset value in the first block of code, for example


width:100;
height:500;
left:400;
top:300;

Easy.
Doh...how could I have missed that!?](*,)...thanks a lot anyway:)

Kadrus
November 10th, 2007, 01:19 PM
What do you mean by align? Are you trying to move the box (span), or the text within the span? Give more info.
It's the box not the text in it..anyway..eggdeng solved it..thanks anyway..

Kadrus
November 10th, 2007, 01:20 PM
Firstly, please cut out the "bummer"/"no one has a clue" posts. This forum is not that busy, so your post was still in the first couple. Most people who browse this forum don't do so constantly, and just check if there are any new posts every several hours at the least. Therefore, the fact that nobody responded within less than an hour does not mean that no one has a clue.

Could you explain what you are trying to do with this code? There might be a simpler way to do it and/or we might better understand your question.
I wanted to move the box..it's alignment...anyway it got solved..thanks for the help and for your time..