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 12576 acoder 16,027
Recognized Expert Moderator MVP
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
acoder 16,027
Recognized Expert Moderator MVP
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.clearInt erval, 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
acoder 16,027
Recognized Expert Moderator MVP
...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.
acoder 16,027
Recognized Expert Moderator MVP
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 Advance.
Murali
|
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 edit this
file?
Vic
|
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 application .
But when i use the code to start /Stop the service in a aspx page i get an
error like:
|
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 authentication at present, so as far as I am aware I
can't use windows authetication (not sure if this is relevant or not)
At present the virtual directory that is running the application is set to
"Anonymous" Accss and is running under the...
|
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 an advantage to
using one over the other.
Just curious... Thanks in advance.
Tom
| |
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# service (created via
VStudio) that I want to control (fully) from another standalone application.
The user will be allowed to add/remove/start/stop my service via menu's.
Any samples would be great or just a suggestion on where to look in MSDN...
|
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 the user paul (pw:paul123) on the
computer A in the domain ABC. This application should stop / start a
service, which is running on computer B (in workgroup ABCWG (NOT IN
DOMAIN ABC)). On the computer B I have a user administrator (pw:
adminTest)...
|
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 start/stop the service, it gives me "Cannot open Service Control Manager on computer 'xxx.xxx.xxx.xxx'. This operation might require other privileges." error.
Helpfull info:
- I am an admin on all 3 PCs
- web app is using "Windows" authentication...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |