A
allanrodkin
Hi, I'm designing a website in dreamweaver and I'm using JavaScript to
slide text across the page. The text is contained in <div> tags. I
have designed a function which can move two of the div tags across the
screen. I use the timer to manage the movement of the text across the
screen. I would like redesign that function so that it can move any
amount of div blocks across the screen. To do this, I need to pass a
parameter to the function moveParas()
The following set up works fine, calling moveParas which moves two div
code blocks across the screen:
function window_onload()
{
window.setInterval("moveParas()",1);
}
<--moveParas() is located at the bottom of the screen-->
---------------------------------------------------------------------------------------------------------------------------
I have tried to change moveParas() so that it can accept paramaters. I
have tried to pass it variables and hardcoded coded value, but this is
not working. I have of course altered the function itself to accept a
parameter.
function window_onload()
{
var dog = false;
window.setInterval("moveParas(dog)",1);
}
I know the code is causing errors because because the the original div
blocks, which should remain unaffected, stop sliding across the page
Another thing is happening. Dreamweaver will not allow me to create
new JavaScript variables. I know this because in the Firefox
Javascript console, it gives me the error, "no formal definition" for
any new variables I declare beyond those that are contained in the
moveParas() function contained at the bottom of the page). does anyone
have any idea why that is happening?
I'd really appreicate if someone could help me solve this problem.
forgive me if it is a simple Javascript problem because I am a
Javascript amateur.
<--here is moveParas() -->
function moveParas(switch)
{
alert(switch);
var paraTwo = document.getElementById("paraTwoID");
var paraOne = document.getElementById("paraOneID");
if (paraOneLeft >= 20)
{
paraOne.style.left = 20 + 'px';
stop = true;
}
else
{
paraOneLeft++;
paraOne.style.left = paraOneLeft + 'px';
}
if (stop==true){
if (paraTwoLeft >=100)
{
paraTwo.style.left = 100 + 'px';
}
else
{
paraTwoLeft++;
paraTwo.style.left = paraTwoLeft + 'px';
}
}
}
</SCRIPT>
slide text across the page. The text is contained in <div> tags. I
have designed a function which can move two of the div tags across the
screen. I use the timer to manage the movement of the text across the
screen. I would like redesign that function so that it can move any
amount of div blocks across the screen. To do this, I need to pass a
parameter to the function moveParas()
The following set up works fine, calling moveParas which moves two div
code blocks across the screen:
function window_onload()
{
window.setInterval("moveParas()",1);
}
<--moveParas() is located at the bottom of the screen-->
---------------------------------------------------------------------------------------------------------------------------
I have tried to change moveParas() so that it can accept paramaters. I
have tried to pass it variables and hardcoded coded value, but this is
not working. I have of course altered the function itself to accept a
parameter.
function window_onload()
{
var dog = false;
window.setInterval("moveParas(dog)",1);
}
I know the code is causing errors because because the the original div
blocks, which should remain unaffected, stop sliding across the page
Another thing is happening. Dreamweaver will not allow me to create
new JavaScript variables. I know this because in the Firefox
Javascript console, it gives me the error, "no formal definition" for
any new variables I declare beyond those that are contained in the
moveParas() function contained at the bottom of the page). does anyone
have any idea why that is happening?
I'd really appreicate if someone could help me solve this problem.
forgive me if it is a simple Javascript problem because I am a
Javascript amateur.
<--here is moveParas() -->
function moveParas(switch)
{
alert(switch);
var paraTwo = document.getElementById("paraTwoID");
var paraOne = document.getElementById("paraOneID");
if (paraOneLeft >= 20)
{
paraOne.style.left = 20 + 'px';
stop = true;
}
else
{
paraOneLeft++;
paraOne.style.left = paraOneLeft + 'px';
}
if (stop==true){
if (paraTwoLeft >=100)
{
paraTwo.style.left = 100 + 'px';
}
else
{
paraTwoLeft++;
paraTwo.style.left = paraTwoLeft + 'px';
}
}
}
</SCRIPT>