Learning Loops & Want To Produce A Number Sequence

Aug 29, 2009

I have no js experience or coding experience of any kind other than the last few hours of reading a book called 'object-oriented javascript', and all was well until loops. firstly, this is how he teaches the while loop...

var i = 0;
while (i <10)
{i++;}

which results in 9 we move on to for loops...

var res ='';
for( var i = 0; i <10; i++)
{res += 'sometext' ;}

which repeats, but I'd like to be able to make that into a sequence of numbers... 123456789.

View 3 Replies


ADVERTISEMENT

JQuery :: Add A Number To The Class On A Sequence Of Elements?

Jul 29, 2011

I've got some code like this:

$(".slide-1").hover(
function () { $('.caption-1').animate({ bottom:0 },200); },
function () { $('.caption-1').animate({ bottom:-35 },200); }

[code]....

I don't have to repeat this block over and over manually? I know I can get jQuery to repeat each code block and insert the number automatically.

View 2 Replies View Related

Does Firefox Have Alimit On The Number Of Loops Dne With Settimeout?

Aug 22, 2006

I have created a script that needs to constanstly poll a webpage, I do
this with a controling function that fires off different functions to
do the work, then restarts by calling itself after a second using
settimeout.

on IE it runs forever, on firefox it stops after a while,

what am I doing wrong?

is there a limit on the number of times you can go around this type
loop you can go around in firefox?

if there is a limit, how do I get around it?

Would it be freak out if the function is already running when it is
fired again?

View 2 Replies View Related

Can Javascript Produce A File?

Jul 20, 2005

I'm thinking about javascript's producing another file.

View 3 Replies View Related

JQuery :: Can Produce An Initial Animation?

Apr 19, 2011

I'd like to know how I can produce an initial animation.I want animate a div automatically when the page is opened.I can animate my div associating the animation, for example, to a button or to a mouseover action, but i can't create an automatic animation.[code]

View 1 Replies View Related

Cannot Get Equlcolumns.js To Produce Its Height / Solve This?

Aug 11, 2009

This is the program.and here is the script.

I have tried all I know without success. This Sources program is on another css/html forum for another issue.code...

View 4 Replies View Related

Learning Guide

Jul 20, 2005

Does anyone have and good resources(free possibly) for learning javascript?

View 1 Replies View Related

Learning OOP In JavaScript

Jan 10, 2007

I learn OOP in javascript. and a few articles say that we can create a static prop/meth to an object just like a predefined object. But i think it just a prop/meth assingned to a constructor. Or is there really static meth/pro in javascript?.

View 1 Replies View Related

Learning Javascript?

Sep 8, 2003

how long did it take you to kearn Javascript to the point that you felt comfortable and confident! I am finding that I seem to be having a harder time with it than others! I have been learnig javascript for 4 years now and still find myself having trouble grasping the big picture?

I would think after so long one would know their way around the language what ever it maybe! I guess basically I would like to know if it is normal to be so confused about javascript?

View 16 Replies View Related

Best Book For Learning JavaScript?

Jul 23, 2005

Anyone have a javascript book recommendation. I'm experienced in development in ASP.NET and VB.NET, but have little knowledge of javascript.

View 2 Replies View Related

Best Resource For Learning Script?

Jun 6, 2011

I'm in the process of learning JavaScript. I picked up a "JavaScript for dummies" book at the library and it wasn't going too well. It was poorly written and made it difficult to understand things in the later chapter.

What is the best online resource to learning JavaScript? Preferrably one that is good at explaining format ( I often find myself wondering if certain aspects in my script need ()'s or a "=" sign).

For example, HTML has tags and that is what forms the mark up. I know JavaScript has multiple aspects (functions, objects), but I want an online resourcethat properly explains the format of these aspects.

View 6 Replies View Related

Books / Video Tutorial About Learning JS?

Aug 24, 2009

Can someone tell me how to learn JS? Can you recommend me some books or video tutorials? What is the best?

View 2 Replies View Related

Start Learning ECMAScript 5 - ES3 And Then Learn ES5?

May 19, 2010

I am a begginer in JavaScript,

Do I start learning(today) ECMAScript 5 or ES3 and then learn ES5?

View 2 Replies View Related

JQuery :: Keyup Event From Learning - 1.3 - Not Working In FF Or Safari

May 8, 2009

I am currently learning jQuery from the book Learning jQuery 1.3 and I have run across a block of code that is not working for me in FF or Safari.

Here it is copied straight from the book (page 64)

I tested the next step that accomplishes the same thing with different code but I would like to understand why this is not working.

View 2 Replies View Related

JQuery :: Make Learning Accordian Work With Unordered List?

Jun 7, 2009

I was wondering how to make URL...by Karl, work with an unordered lis instead of divs. I tried the below but did not work. I think what I have done here ('.links:visible');looks plain wrong (I can't put a class or an Id in there right??)[code]

View 3 Replies View Related

JQuery :: More Columns Than Header Columns Produce Variable Not Found Error

Sep 20, 2011

When a thead contain less columns than real columns in the tbody section, the Tablesorter plugin produces a variable not found error in jquery coreTo reproduce simply do not put all <th> in thead that correspond to columns in tbody.

View 1 Replies View Related

While Loops

Nov 4, 2007

i am trying to do but I have no clue how to write it. Im trying to write a while loop that prints out all of the multiples of 5 between 10 and 95. I just need to know how to write the while loop i got everything else.

View 1 Replies View Related

Sequence Of Loading

Aug 31, 2005

I have a number of sources of javascript and don't really know the sequence of when each gets loaded.

<SCRIPT FOR="window" EVENT="onLoad">
var tmp = "where are you";
</script>

<script language="JavaScript">
alert(tmp);
</script>

<script language="JavaScript" src="code.js"></script>

Are they loaded based on the order they are seen in the page?

View 7 Replies View Related

Multiple Loops

Feb 6, 2006

I'm my script I've three loops processing a very huge data file. IE & Firefox show a message box after some time saying my script could be infinite looping and give me a chance to stop it.

Is there a way to prevent this dialog box to show up? I'm writing a script used only on a intranet and the final customer should not see the message box.

View 6 Replies View Related

Question About Loops

Jan 12, 2007

Hi, I want to have something like this:

function callme1() {
alert('somestuff');
}

function callme2() {
alert('somestuff');
}

function callme3() {
alert('somestuff');
}

function callme4() {
alert('somestuff');
}

etc.

except, it's going to be created in a loop, like

var x=0;
while (x<10) {

function callme[x]() {
alert('somestuff');
}

x++
}

So, out of that I would like to get 10 callme(1-10 or A-J) functions...
I guess I am lost which way to build this with the placement & parsing
of the variables.

View 3 Replies View Related

How To Break Out Of All Loops

Jun 6, 2009

Is it possible, when you have a loop in a loop, that when the inner loop reaches a certain point, it breaks out of both loops? For example:

[Code]....

The code above will break out of the (b=0;b<=10;b++) loop when b==5, but it will continue to do the a loop. not putting the first loop at all or making the first loop stop at 1): Is there a way to break out of both loops when the if condition is met? (I only ask that you not give a work-around because what I have in mind is much more complicated than this)

View 3 Replies View Related

Using SetInterval In Loops

Dec 15, 2007

i'm scratching my head over achieving similar results with setInterval() function, and how I can keep it from looping infinitely.

I want to do something like this:
var i = 0;
var endTime = now + ((1000*60)*2); // 2 minutes after now
while (now <=endTime) {
i = i + 1;
now = new Date().getTime();
}
document.write("total iterations: " + i);

however you can't do this because of lag issues, so i'll settle for using setinterval on its smallest interval of a millisecond, here is my attempt to translate the above to a setinterval solution:
var endTime = now + ((1000*60)*2); // 2 minutes after now
var intervalID = setInterval(loopFunc(endTime),1);
function loopFunc(endTime,intervalID) {
if (new Date().getTime() <= endTime) {
i = i + 1;
} else {
clearInterval(intervalID);
}}

as you can see I have prolbems figuring out how to stop the interval from continuing to iterate, and passing the interval id, I'm clueless Also I'm clueless on echoing the total iterations via this method.

View 4 Replies View Related

Getting Averages From Loops?

Nov 8, 2009

I want to get averages from a for loop. Let's say I had a # of exams and in that loop I wanted to add the exams up and calculate the average. How would I go about doing this? Is this even possible in a for loop?

View 1 Replies View Related

Using While Loops Incrementer?

Jul 26, 2009

If I were to have a script:

Code JavaScript:
var numbers = [1, 2, 3, 4, 5];
var incrementer = 0;
while (incrementer < numbers.length)
{

[Code]...

View 1 Replies View Related

Different Header On Each Page In Sequence?

May 29, 2011

I have 6 headers that are animated gifs. They transition, 3 of them left to right, the other 3 right to left.I would like to have them to change to next header in sequence no matter which page on my site they click.I'm not sure this can be done, but think javascript is my best bet. Can anyone point me in the right direction?

View 4 Replies View Related

Image Refresh In Sequence?

May 24, 2011

I want the images to change in sequence when the page is refreshed not random like i have below. Also I also need text to change on refresh to because I am going to have a descritption of the image below.

[CODE]
<script type="text/javascript" language="JavaScript">
var imgs = new Array('<a href="VW_1.shtml"><img border=0 src="img/samples/VW/large_1.jpg" width=165 height=109" class="thumbnail_img">',

[Code]....

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved