473,588 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Display automatic scrolling marquee; give options to start, stop and reset marquee

praclarush
27 New Member
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
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <!-- 
  4.    New Perspectives on JavaScript
  5.    Tutorial 4
  6.    Case Problem 2
  7.  
  8.    The Chamberlain Civic Center
  9.    Author: 
  10.    Date:   10/21/07
  11.  
  12.    Filename:         ccc.htm
  13.    Supporting files: back.jpg, ccc.gif, ccc.js, styles.css
  14. -->
  15. <title>This Month at the Chamberlain Civic Center by Nathan Bremmer</title>
  16. <link href="styles.css" rel="stylesheet" type="text/css" />
  17. <script type="text/javascript" src="ccc.js"></script>
  18. <script type="text/javascript">
  19.  
  20. function Marquee() {
  21. // not required to know (removed)
  22. } //end Marquee()
  23.  
  24. function Stop() {
  25. //removed
  26. }
  27.  
  28.   function moveIt(id) {
  29.     var y = yCoord(id);
  30.     if(y < -100) { 
  31.       placeIt(id, 5, 750);
  32.     } else if(y >= -100) {
  33.       shiftIt(id, 5, 0);
  34.     }
  35.   } //end moveIt()
  36.  
  37. function reload() {
  38.     document.location = this.location;
  39. }
  40. </script>
  41. </head>
  42.  
  43. <body>
  44. <form id="marquee_buttons" action="">
  45.  
  46. <div id="panel">
  47.    <p>
  48.       <img src="ccc.gif" alt="The Chamberlain Civic Center" />
  49.    </p>
  50.    <h2>
  51.       Events This Month
  52.    </h2>
  53.    <p>To order tickets: Call the box office at (971) 555-9191<br />
  54.    Or click <a href="#">here</a> to order online.
  55.    </p>
  56. </div>
  57.  
  58. <div id="BOX">
  59.  
  60.    <div id="Text1" style="position: absolute; left: 0px; top:5px">
  61.      Coming Soon to the CCC
  62.    </div>
  63.  
  64.    <div id="Text2" style="position: absolute; left: 0px; top: 50px">
  65.      <b>October 2nd, 8 p.m.<br />
  66.      Falstaff</b><hr />
  67.      Enjoy the music of Verdi's <i>Falstaff</i>, as presented by the 
  68.      popular Rockie Mountain Opera Company. Seating is limited.<br /><br />
  69.      Tickets:  Box ($55), Main Floor ($45), Balcony ($35)
  70.    </div>
  71.  
  72.    <div id="Text3" style="position: absolute; left: 0px; top: 200px">
  73.      <b>October 7th, 8 p.m.<br />
  74.      Taiwan Acrobats</b><hr />
  75.      The Taiwan Acrobats return to the Carson Civic Center for another 
  76.      evening of fun and excitment.<br /><br />
  77.      Tickets:  Box ($40), Main Floor ($35), Balcony ($30)
  78.    </div>
  79.  
  80.    <div id="Text4" style="position: absolute; left: 0px; top: 350px">
  81.      <b>October 14th, 8 &amp; 10 p.m.<br />
  82.      Roy Taylor</b><hr />
  83.      Enjoy of the blues sound of the legendary "Slow Train" Taylor. 
  84.      Two performances at 8 and 10 p.m.<br /><br />
  85.      Tickets:  Box ($40), Main Floor ($35), Balcony ($30)
  86.    </div>
  87.  
  88.    <div id="Text5" style="position: absolute; left: 0px; top: 500px">
  89.      <b>October 21st, 8 p.m.<br />
  90.      Celtic Dancers</b><hr />
  91.      Enjoy an evening of Celtic music and dance, as presented by the
  92.      Oban Dance Company of Scotland.<br /><br />
  93.      Tickets:  Box ($30), Main Floor ($25), Balcony ($20)
  94.    </div>
  95.  
  96.    <div id="Text6" style="position: absolute; left: 0px; top: 650px">
  97.      <b>October 28th, 8 p.m.<br />
  98.      An Evening with Ike</b><hr />
  99.      David Lee presents <i>An Evening with Ike</i>, his acclaimed one-man
  100.      show of the life and times of Dwight Eisenhower.<br /><br />
  101.      Tickets:  Box ($35), Main Floor ($30), Balcony ($25)
  102.    </div>
  103. </div>
  104.  
  105. <div id="form_buttons">
  106.       <input type="button" value="Scroll Marquee" onClick="Marquee()"/>
  107.       <input type="button" value="Stop  Marquee"  onClick="Stop()"/>
  108.       <input type="button" value="Reset" onClick="reload()"/>
  109. </div>
  110.  
  111. </form>
  112. </body>
  113.  
  114. </html>
  115.  
JavaScript Code:
Expand|Select|Wrap|Line Numbers
  1. /* 
  2.    New Perspectives on JavaScript
  3.    Tutorial 4
  4.    Case Problem 2
  5.  
  6.    The Chamberlain Civic Center
  7.    Name:
  8.    Date: 10/21/07
  9.  
  10.    Function List:
  11.    placeIt(id, x, y)
  12.       Places the id object at the page coordinates (x,y)
  13.  
  14.    shiftIt(id, dx, dy)
  15.       Shifts the id object dx pixels to the left and dy pixels down
  16.  
  17.    yCoord(id)
  18.       Returns the y-coordinate of the id object
  19. */
  20. // removed code
  21. function shiftIt(id, dx, dy) {
  22.   var object = document.getElementById(id);
  23.   object.style.left = xCoord(id) + dx + "px";
  24.   object.style.top = yCoord(id) + dy + "px";
  25. } //end shiftIT
  26.  
  27.  
any help will be greatly appreciated,

Praclarush
Oct 21 '07 #1
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.
Oct 22 '07 #2
praclarush
27 New Member
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
Oct 22 '07 #3
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.
Oct 22 '07 #4
praclarush
27 New Member
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

Expand|Select|Wrap|Line Numbers
  1. function Stop() {
  2.  
  3.     clearInterval(t1);
  4.     clearInterval(t2);
  5.     clearInterval(t3);
  6.     clearInterval(t4);
  7.     clearInterval(t5);
  8.     clearInterval(t6);
  9. }
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
Oct 22 '07 #5
praclarush
27 New Member
I figured it out, thank you for all your help,

sorry for any problems I gave you.
Praclarush
Oct 23 '07 #6
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.
Oct 23 '07 #7
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.
Oct 23 '07 #8
rexdreamer
3 New Member
@acoder
Has anyone got this to work? I am still getting errors.
Aug 15 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
6400
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
4
2693
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
3
7023
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:
0
1257
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...
3
26044
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
2
8189
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...
1
16358
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)...
0
1780
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
3
11846
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...
0
7862
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,...
0
8228
Oralloy
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...
0
8357
jinu1996
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...
1
7987
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,...
0
5398
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();...
0
3847
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...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
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
0
1196
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.