Ok, I'm new to JavaScript and I'm taking a class for it the assignment in it I'm supposed to create edit a pre-made page to display a marquee that automatically scrolls for the user, as well as give an option to start, stop and reset the marquee.
Now I have most of this done already, what I'm having problems with is that when i start the marquee it moves to the right, but i need to have it move from the bottom, upwards. heres my code (I'm not expecting this to be done for me i just need someone to point out what I'm doing wrong.
HTML Code - <html>
-
<head>
-
<!--
-
New Perspectives on JavaScript
-
Tutorial 4
-
Case Problem 2
-
-
The Chamberlain Civic Center
-
Author:
-
Date: 10/21/07
-
-
Filename: ccc.htm
-
Supporting files: back.jpg, ccc.gif, ccc.js, styles.css
-
-->
-
<title>This Month at the Chamberlain Civic Center by Nathan Bremmer</title>
-
<link href="styles.css" rel="stylesheet" type="text/css" />
-
<script type="text/javascript" src="ccc.js"></script>
-
<script type="text/javascript">
-
-
function Marquee() {
-
// not required to know (removed)
-
} //end Marquee()
-
-
function Stop() {
-
//removed
-
}
-
-
function moveIt(id) {
-
var y = yCoord(id);
-
if(y < -100) {
-
placeIt(id, 5, 750);
-
} else if(y >= -100) {
-
shiftIt(id, 5, 0);
-
}
-
} //end moveIt()
-
-
function reload() {
-
document.location = this.location;
-
}
-
</script>
-
</head>
-
-
<body>
-
<form id="marquee_buttons" action="">
-
-
<div id="panel">
-
<p>
-
<img src="ccc.gif" alt="The Chamberlain Civic Center" />
-
</p>
-
<h2>
-
Events This Month
-
</h2>
-
<p>To order tickets: Call the box office at (971) 555-9191<br />
-
Or click <a href="#">here</a> to order online.
-
</p>
-
</div>
-
-
<div id="BOX">
-
-
<div id="Text1" style="position: absolute; left: 0px; top:5px">
-
Coming Soon to the CCC
-
</div>
-
-
<div id="Text2" style="position: absolute; left: 0px; top: 50px">
-
<b>October 2nd, 8 p.m.<br />
-
Falstaff</b><hr />
-
Enjoy the music of Verdi's <i>Falstaff</i>, as presented by the
-
popular Rockie Mountain Opera Company. Seating is limited.<br /><br />
-
Tickets: Box ($55), Main Floor ($45), Balcony ($35)
-
</div>
-
-
<div id="Text3" style="position: absolute; left: 0px; top: 200px">
-
<b>October 7th, 8 p.m.<br />
-
Taiwan Acrobats</b><hr />
-
The Taiwan Acrobats return to the Carson Civic Center for another
-
evening of fun and excitment.<br /><br />
-
Tickets: Box ($40), Main Floor ($35), Balcony ($30)
-
</div>
-
-
<div id="Text4" style="position: absolute; left: 0px; top: 350px">
-
<b>October 14th, 8 & 10 p.m.<br />
-
Roy Taylor</b><hr />
-
Enjoy of the blues sound of the legendary "Slow Train" Taylor.
-
Two performances at 8 and 10 p.m.<br /><br />
-
Tickets: Box ($40), Main Floor ($35), Balcony ($30)
-
</div>
-
-
<div id="Text5" style="position: absolute; left: 0px; top: 500px">
-
<b>October 21st, 8 p.m.<br />
-
Celtic Dancers</b><hr />
-
Enjoy an evening of Celtic music and dance, as presented by the
-
Oban Dance Company of Scotland.<br /><br />
-
Tickets: Box ($30), Main Floor ($25), Balcony ($20)
-
</div>
-
-
<div id="Text6" style="position: absolute; left: 0px; top: 650px">
-
<b>October 28th, 8 p.m.<br />
-
An Evening with Ike</b><hr />
-
David Lee presents <i>An Evening with Ike</i>, his acclaimed one-man
-
show of the life and times of Dwight Eisenhower.<br /><br />
-
Tickets: Box ($35), Main Floor ($30), Balcony ($25)
-
</div>
-
</div>
-
-
<div id="form_buttons">
-
<input type="button" value="Scroll Marquee" onClick="Marquee()"/>
-
<input type="button" value="Stop Marquee" onClick="Stop()"/>
-
<input type="button" value="Reset" onClick="reload()"/>
-
</div>
-
-
</form>
-
</body>
-
-
</html>
-
JavaScript Code: - /*
-
New Perspectives on JavaScript
-
Tutorial 4
-
Case Problem 2
-
-
The Chamberlain Civic Center
-
Name:
-
Date: 10/21/07
-
-
Function List:
-
placeIt(id, x, y)
-
Places the id object at the page coordinates (x,y)
-
-
shiftIt(id, dx, dy)
-
Shifts the id object dx pixels to the left and dy pixels down
-
-
yCoord(id)
-
Returns the y-coordinate of the id object
-
*/
-
// removed code
-
function shiftIt(id, dx, dy) {
-
var object = document.getElementById(id);
-
object.style.left = xCoord(id) + dx + "px";
-
object.style.top = yCoord(id) + dy + "px";
-
} //end shiftIT
-
-
any help will be greatly appreciated,
Praclarush
8 12529
Welcome to TSDN!
You will need to edit the moveIt function. Look at what the shiftIt function does. Use the correct parameters.
PS. how much of this have you done? I might have to remove some of this code if not all of this is the original code.
Welcome to TSDN!
You will need to edit the moveIt function. Look at what the shiftIt function does. Use the correct parameters.
PS. how much of this have you done? I might have to remove some of this code if not all of this is the original code.
the code that I have done is all of the JS file and all of the code in the script tags in the html the rest is the original code that came with the assignment
thinks,
praclarush
the code that I have done is all of the JS file and all of the code in the script tags in the html the rest is the original code that came with the assignment
I've removed the code that is not required to explain the problem.
This is to avoid copying. Read the guidelines on homework and coursework assignments.
Sorry about that must not have read that, anyways thinks for the help that salved that problem, now I’m having issues with stopping the method, I’m using this - function Stop() {
-
-
clearInterval(t1);
-
clearInterval(t2);
-
clearInterval(t3);
-
clearInterval(t4);
-
clearInterval(t5);
-
clearInterval(t6);
-
}
to clear the setInterval method in the marquee function but it keeps saying that t1,t2,…, is not defined is this because its not in this function even though its in the marquee function above it, were their all set to
var t1 = 130;
I think i might be doing it wrong but i havan't a clue, the other websites i use keep using window.clearInterval, but that dosen't seem to work the marquee needs to stop on a onClick command, in a form input
thanks for the help,
Praclarush
I figured it out, thank you for all your help,
sorry for any problems I gave you.
Praclarush
...to clear the setInterval method in the marquee function but it keeps saying that t1,t2,…, is not defined
In case anyone has the same problem, this is because these variables need to be declared globally outside the Marquee() function.
I figured it out, thank you for all your help,
sorry for any problems I gave you.
Praclarush
Glad to see that you managed to solve the problem yourself. No need to apologise for the 'problems'. There's only a problem if you expect someone else to do your homework for you.
@acoder
Has anyone got this to work? I am still getting errors.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Murali |
last post by:
Hi All,
How to control(Start / Stop) a "Windows Service" (written in C#) from a
windows application(.exe). Please send any URL/Solution which will guide me
to solve this issue.
Thanks in...
|
by: vickaiser1 |
last post by:
I am creating a setup project for an application and need to edit the
Metabase.xml file during setup. Does anyone know of a way to stop and
then restart services programatically before and after I...
|
by: SenthilVel |
last post by:
Hi All
i do need to control my windows services using aspx pages.
I used the System.ServiceProcess.ServiceController namespace ....
this is working fine when i run my code in a windows...
|
by: martin |
last post by:
Hi,
I have a website on my local development machine that has a page where a
small number of services (that I have wrote myself) can be either started or
stopped.
The website uses forms...
|
by: Tom |
last post by:
When using system.timers.timer, which should one use to start/stop the
timer? Start/Stop, or Enabled=True/False? If what I read is true, both
really do the same thing, so I don't know if there is...
|
by: C.C. \(aka Me\) |
last post by:
I am wondering if there is a class that can be used to install/remove
services? I know that there is one for starting/stopping/etc. but not sure
about actually install/remove. What I have is a C#...
|
by: schaf |
last post by:
Hi all!
I'm still trying to start/stop a service on a remote computer. (I
promiss that's the last new post because of this problem from my side)
My situation:
I've an application running under...
|
by: Navin Mishra |
last post by:
Hi,
Is there a way to programmatically start/stop IIS App Pool remotely on a
different machine ?
Thanks!
Navin
|
by: Goran Djuranovic |
last post by:
Hi all,
I have a web app running on a local PC that can start and stop windows service on a remote machine, but only when I browse to it locally. If I browse to it from my other PC and try to...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
| | |