Valhalla Legends Archive

Programming => Web Development => Topic started by: Hazard on July 01, 2003, 08:09 AM

Title: JavaScript
Post by: Hazard on July 01, 2003, 08:09 AM
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!~!
Title: Re:JavaScript
Post by: 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.
Title: Re:JavaScript
Post by: Eibro on July 01, 2003, 11:15 PM
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! :)
Title: Re:JavaScript
Post by: Hazard on July 02, 2003, 08:08 AM

<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!~!
Title: Re:JavaScript
Post by: Camel on July 02, 2003, 08:44 PM
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>
Title: Re:JavaScript
Post by: Hazard on July 02, 2003, 09:08 PM
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!~!
Title: Re:JavaScript
Post by: Noodlez on July 08, 2003, 04:15 AM
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?
Title: Re:JavaScript
Post by: Camel on July 08, 2003, 05:47 PM
you're missing a "->}" :)
Title: Re:JavaScript
Post by: Noodlez on July 08, 2003, 06:34 PM
lies!
Title: Re:JavaScript
Post by: 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.
Title: Re:JavaScript
Post by: JoeCool on July 08, 2003, 09:47 PM
um.. get a book on it.. Java Script Coding For Dummies  ;D
Title: Re:JavaScript
Post by: Camel on July 09, 2003, 01:47 PM
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.
Title: Re:JavaScript
Post by: Banana fanna fo fanna 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!!!
Title: Re:JavaScript
Post by: 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
Title: Re:JavaScript
Post by: Banana fanna fo fanna on July 13, 2003, 08:38 PM
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
Title: Re:JavaScript
Post by: Skywing on July 13, 2003, 09:21 PM
Quote from: St0rm.iD on July 13, 2003, 08:38 PM
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

By the way, Netscape created JavaScript.  Microsoft created JScript, which is similar but not entirely compatible.