• Welcome to Valhalla Legends Archive.
 

JavaScript

Started by Hazard, July 01, 2003, 08:09 AM

Previous topic - Next topic

Hazard

I'm currently working on a project for a computer science class I am taking and am looking for somebody to review my work (Note: I didn't ask anybody to do it for me so don't start flaming me.) It is a simple addition to a website plugged into the source. If anybody knows anything about the language and is willing to check over my work please reply to this post and I'll post my project for you to review. Also there is one correction I don't know how to make and if you'd like to give that a shot and trying to explain it to me I would appreciate it. I'm sure the answer is right in front of me... I'm just not looking in the right place. Thank you.

!~!HaZaRD!~!

"Courage is being scared to death - but saddling up anyway." --John Wayne

Zakath

What language is this dealing with?

Incidentally, this is a good example of the right way to ask for help, in my opinion.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Eibro

Quote from: Zakath on July 01, 2003, 09:58 PM
What language is this dealing with?

Incidentally, this is a good example of the right way to ask for help, in my opinion.
Re: Javascript
Check the thread title! :)
Eibro of Yeti Lovers.

Hazard

#3

<Script Language=JAVAScript Type="Text/javascript">
   myMsg="-:HaZarD NeT:";
      x=0;
         scrollMsg();
              function scrollMsg()    {
             window.status=myMsg.substring(x,myMsg.length) + myMsg.substring(0,x-1);
             if (x < myMsg.length)
                 x++;
                 else
                x=0;
       setTimeout("scrollMsg()",180);
                                      }
</Script>


Ok I'll just let you all take a look at it. Yes I know this program is found in certain places on the web and I could just go steal it. The problem of course being this is going to be on my final and I need to actually know it. I know the script works but I'm looking for suggestions on it. Also, if you save the script as .html and look at it, it will not scroll along the entire bar, it is condensed in the lower left hand corner of the screen. If anybody can give me a push in the general direction of how to fix this problem I'd appreciate it. Feel free to point out any errors with the format of the script as well. Thanks.

!~!HaZaRD!~!

"Courage is being scared to death - but saddling up anyway." --John Wayne

Camel

Well for starters, you could learn to indent properly. :)

<Script Language=JAVAScript Type="Text/javascript">
myMsg="-:HaZarD NeT:";
x=0;
scrollMsg();
function scrollMsg()
{
   window.status=myMsg.substring(x,myMsg.length) + myMsg.substring(0,x-1);
   if (x < myMsg.length)
      x++;
   else
      x=0;
   setTimeout("scrollMsg()",180);
}
</Script>

Hazard

Bah... +1 to Camel for correcting my mistake. Thats the kind of stuff I want to know. Second, I ask again if anybody knows how to make the next scroll across the ENTIRE bar at the bottom of the screen rather than just the lower left hand corner?

!~!HaZaRD!~!

"Courage is being scared to death - but saddling up anyway." --John Wayne

Noodlez

#6
You want to know how to indent? Just indent everything that's nested.
Example

function(void)
{
->indent eveyrthing in here
->if{
->->double indent
->}//nest is closed, lose the indent
->do{
->->if{
->->->stuff
->->}
->}
}

btw, incase you haven't figured it out -> is a tab
get it?

Camel

you're missing a "->}" :)

Noodlez


j0k3r

Quote« Reply #7 on: Today at 05:47:19pm »
Quote
« Last Edit: Today at 06:33:41pm by Noodlez »
;D

Indenting is only part of the curriculum/program in universities, I doubt your teacher will remove marks for it. However, it is good practice, makes it very much easier for any programmer to read.

Also, I don't know Java... Is scrollMsg previously defined? Cause if not then your only declaring it... but not calling it.
QuoteAnyone attempting to generate random numbers by deterministic means is, of course, living in a state of sin
John Vo

JoeCool

um.. get a book on it.. Java Script Coding For Dummies  ;D

Camel

Any time someone asks me for help and shows me code, the first thing I tell them to do is indent. I would say at least two thirds of the time that alone solves their problem.

Banana fanna fo fanna

Quote from: j0k3r on July 08, 2003, 08:22 PM
Quote« Reply #7 on: Today at 05:47:19pm »
Quote
« Last Edit: Today at 06:33:41pm by Noodlez »
;D

Indenting is only part of the curriculum/program in universities, I doubt your teacher will remove marks for it. However, it is good practice, makes it very much easier for any programmer to read.

Also, I don't know Java... Is scrollMsg previously defined? Cause if not then your only declaring it... but not calling it.

JavaScript != Java!!!

Camel

Quote from: St0rm.iD on July 10, 2003, 11:38 AM
Quote from: j0k3r on July 08, 2003, 08:22 PM
Quote« Reply #7 on: Today at 05:47:19pm »
Quote
« Last Edit: Today at 06:33:41pm by Noodlez »
;D

Indenting is only part of the curriculum/program in universities, I doubt your teacher will remove marks for it. However, it is good practice, makes it very much easier for any programmer to read.

Also, I don't know Java... Is scrollMsg previously defined? Cause if not then your only declaring it... but not calling it.

JavaScript != Java!!!

JavaScript = VBScript with Java syntax
VBScript = uber-stripped-down VBA

Banana fanna fo fanna

Quote from: Camel on July 13, 2003, 06:14 PM
Quote from: St0rm.iD on July 10, 2003, 11:38 AM
Quote from: j0k3r on July 08, 2003, 08:22 PM
Quote« Reply #7 on: Today at 05:47:19pm »
Quote
« Last Edit: Today at 06:33:41pm by Noodlez »
;D

Indenting is only part of the curriculum/program in universities, I doubt your teacher will remove marks for it. However, it is good practice, makes it very much easier for any programmer to read.

Also, I don't know Java... Is scrollMsg previously defined? Cause if not then your only declaring it... but not calling it.

JavaScript != Java!!!

JavaScript = VBScript with Java syntax
VBScript = uber-stripped-down VBA

All lies.

JavaScript = new language with no relation to Java or VBScript, Microsoft just happened to make them both part of ActiveX scripting

VBScript = QBasic that can make viruses