outputs lines of text, with two <br> between them. What I want is for if it's the last loop for that only to be one <br> but I can't figure out what that "last loop" code should be.
What I'm trying to do just doesn't seem like it should be that difficult but I'm sure struggling with lacking skills I should say. I'm trying to automatically scroll a div up and down. For say if div.scrollTop = 0 then scroll to the bottom once it reaches the bottom scroll back up and so forth not stopping in a loop with say a timeout of 10.. Just need help putting it all together.
I've figured some stuff out: I can tell if I'm at the bottom of the scrollable area with: (document.getElementById(id).clientHeight + document.getElementById(id).scrollTop) - document.getElementById(id).scrollHeight
this is a homework project which kind of works but isn't perfect. My tutor said the result must be an alert but I ended up with a document.write instead.He said it was fine but I'd like to know how to make it alert the result if anyone can help.FWIW I tried making the contents of the for loop into a variable without success.
I have a small textfield input and submit button. The user is required to input the prefix of their UK postcode and a dialogue boxpopsup saying basically yes or no. My problem is I have an array of postcodes, but if for example someone in Liverpool entered their postcode as L1 1AA, it would say 'yes' but if their mate who enterd in L12 1AA, it would still say 'yes' but it should say 'no'. L1 should be true and L12 should be false. Also to mix things up a bit. I have now been asked to creat a third 'if',if a user enters a code of JE (and then any suffix after ie. 1, 2, 3, 4 etc.), could this be made to say 'unavailable' or some sort.
I pulled this code from Google's example section to make markers on a v3 Google Maps API (I have added my own lat/long points and corresponding event listeners, of course, but this is still the spirit of the code):
[Code]...
It's not throwing up any errors in Firefox's developer or in IE but there it sits, a blank map. I'm sure this isn't clean or optimized code, but it looks correct to me. I've color-coded the code above to show what "for" loops are being used to try to replace which code. Hopefully that makes this more sensible.
I'm using ajax to update options in several select forms.Its basically, like in most automotive applications, there is a drop down for brand...once selected, it will populate another select form with the "makes" of that brand. Once a make is selected.. it returns the models of that make... and ect...The program works fine for one selection. When one brand is selected, a second select box is populated with the correct makes of cars that brand produces, however, if the brand is changed, the select box with the makes of the cars is populated by the original query..twice... and then the second query. Looking for help on whats the best way to clear both the results array; i was using this...
autobrandsf.length = 0;
and also clear out the select box, which is what the removeAllOptions() function is for. As it stands, if i use the removeAllOptions(), the makes are never populated.Here is my code, broken down the best i could, in order of process.. ish.A select form that shows the brands is displayed, once a choice is made, it passes the value of the choice into this function, which will query the database
// this is the function that is called once a brand is selected: // h = the brand passed.. function carBrandCheck(h){[code]....
This is where, the query is returned, each row is split into an individual array, and then the second element of those individual arrays are put into yet again another array.The elements of that array are then compared against eachother to make sure there are no duplicates, storing the non-duplicates into a new array. The final array is then passed into a select form, for the makes of the selected brand.
// the ajax handler: function handleWorkResponse(){ if(xmlHttp.readyState == 4){[code]......
i am declaring an array in javascript var a = new array();
now before assigning a value to the ith element of this array, i have to check if some value has already been assigned there. But at the time of defining array, it gives undefined values to the array. Is there a way/function, thru which i can find, whether a particular index value was assigned before or not.
I am using the following script on an e-commerce site to ensure that not both drop downs cannot be selected at the same time, as well as ensuring one must be selected at all times.The problem with this code is that not all of my product pages have these 2 drop downs so I wanted to try and add in an if statement saying that if id2=9999 and id3 == null then pop up the error. That didnt work because I don't think it can be equal to null if it does not exist on the page. I tried to assign id3 a value of 99999 so that on pages that it doesnt get reassigned after (i.e pages it does not exist on) it will still be equal to 99999 and pop up the error according to the second if clause.Unfortunately that did not work either. Is there any other way I can do via javascript?
Here in my case a[0] and a[5] is duplicate because i am using 1 or 0 for active and deactivate purpose a[4] is deactivate value so we can ignore the 10 in this. so in my case 10 is repeated twice on a[0]and a[5] not a[4], so its duplicate value. can any one help me to solve this.
I have a text box and would like to see if the value of the input matches the values defined in a JavaScript array.For example, the JavaScript array will hold five values:
i am new to programming and have been given the challenge of writing code to request a password, then search through the cP array,until a match is found, then the index number on the cC array which corisponds to the 1st array should show me the customer code. i have sat here all day and got nowhere, the textbook i have is next to useless and is just confusing me more.
i dont want someone to do it for me but i do need help in getting started as i dont understand how to search for a specific string within the array or how to link the arrays for the correct output. Code:
I am having a hard time figuring this out, I have two simple arrays and I want to populate one by asking a visitor to enter information, it goes something like this...
var country = new Array(5); c_list[0] = "USA"; c_list[1] = "UK"; c_list[2] = "France"; c_list[3] = "Germany";
[Code]....
how do I use a simple for loop to use the names entered and populate the second array?
I have created a 2D array as a sort of "game board" and would like to place an object(cubeShape) in each square and be able to interact with specific instances. Since I am using the O3D API, I would like to do this by taking the object's place in the transform matrix and storing it in the 2D array. The problem is, I run this code:
[Code]...
And then when I check it, every value in my array is filled with 9 instead of the actual count. i.e. myBoard[1,2] = 9, myBoard[2,2] = 9, etc. Whats going on?
write a while loop that prompts user to enter name.add their names to an array.if they enter "exit" end the prompting
sort array and list in sorted order ----------------------------------- this is what i got so far. sooo confused because i cant get the user input into an array
var names = new Array(); var loopCounter; loopCounter = 0;[code]......
im trying to make a program that passes an array to a method. the method then finds the smallest number in the array and passes that number back to the main where its printed out. I am getting an error saying: "error: number cannot be resolved to a variable". I am using drjava. here is my code.
import java.util.*; public class homeWorkTwo{ public static void main(String[] args)[code].....
I am trying to get good using the $.each() in jQuery. I have a simple little task that I want to solve.
I have created a simple page with 100 boxes, each box with 4 colors. What I want to happen is if you click one box, it will change colors to the next box and so on. so for example here are 4 boxes
Red | Green | Blue | Yellow
If you click on Red you would get:
Green | Green | Blue | Yellow
If you click on the Green (1st one) you would get:
Blue | Green | Blue | Yellow
I have created a jsfiddle for you to view with what I have so far. I am stumpped at creating a match for the class name and if it matches to then go onto the next color in the array.
I have an array that I want to loop through and display the values of the array on the page as it loops (so I guess there should be a slight delay before the next one appears over it).
I am trying to create a function that creates an array comprised of filenames based on a given range. I.E if 2-8 is selected and a foldername of UMCP/ and a common name of college is also given, the function should return and array such as [UMCP/college2.jpg,UMCP/college3.jpg.....UMCP/college8.jpg]. Here is what I've got but the alert that should tell me the filename of the first image says it is undefined, how can i fix this?
function getArrayPhotosNames (total,count,first,last) { /*window.alert("get Array Photo Names");*/ var folderName = document.getElementById("photofold").value; var Alias = document.getElementById("commonName").value;
The difficulty is in declaring my array properly and then looping through it to output the contents as desired. You can see the details below. What I should be doing with the array and loop to make it work proplery?
I put some HTML together to gather a user's language abilities. Originally it was a multi-select box that pulled a its values from a mySQL table and, upon form submit, a PHP script posted the languages selected into an array and then pushed into a mySQL table.
Then the client decided he wanted the user to enter in the number of years/months they studied each language selected. He found someone on RAC and they gave him this code below. Which works, but doesn't integrate well with my PHP-array loading code. The client paid the RAC before I was able to test.
It's actually more complicated than that (with Fluent/Passable options), but once I know how to change the loop from the increment to an array, I'll be able to solve the rest.
What's happening now is the JS is looping, creating ids, fluentLanguageTimeQuantity_0, fluentLanguageTimeQuantity_1, fluentLanguageTimeQuantity_2, etc for each selection. Instead I'd like it to create an array fluentLanguageTimeQuantity[] with the selections loaded into it.
What I am trying to do is loop through an array, and update / animate the CSS properties of the div.[code]I am able to loop through everything fine, but I cannot for the life of me get the css properties to update. Here is where I am at within the loop. I cannot figure out how to target the class.[code]