I am trying to make a program that either alerts or at least prints the multiples of a number (which the user inputs into a text field). I am required to use a do while loop for this, so here is what I have so far. Code:
I have been looking at this code for two evenings now, and rewrote it 4 times already. It started out as jQuery code and now it's just concatenating strings together.
What I'm trying to do: Build a menu/outline using unordered lists from a multidimensional array.
What is happening: Inside the buildMenuHTML function, if I call buildMenuHTML, the for loop only happens once (i.e. only for 'i' having a value of '0'.) If I comment out the call to itself, it goes through the for loop all 3 times, but obviously the submenus are not created.
I'm looking to send a loop variable (i) to a function inside the loop, but I can't seem to get it to use the value I want, it keeps making it a reference of i and therefore the function is always called using the last value of i rather than the one it was set with.
So if i have 5 Tabs then Tab 1, when clicked, should call DefaultTabClick(0) and so on rather than always using 4 for any of the tabs.
I have the code below, how could it be modified to loop over and over and reload the xml file each time. Flow would be: load xml, run thruogh code to display each xml node one at a time, when reach last node, start all over, reloading xml file,
I am doing some studying and we was to create a small loop using either the for loop, while loop or do while loop. I chose to do the for loop because it was easier to understand, but I want to know how to do the same using the while loop. Here is the for loop I have, but I cant figure out how to change to while loop.
for (var i = 0; i < 5; ++i) { for (var j = i; j < 5; ++j) {
I am using the code below to get the number of trs in the tbody.
This works fine when there is only one tbody within my code. How can I adapt it so if there are multiple tbody's then it will actually only return the first one and return all the trs across all of them? (The other tbody's will actually be embedded within the first tbody). I dont think that is valid html but the script I am using requires that unfortunatly.
Using DOM in IE, how can I loop through FORMs and access FORM elements in a specific form? For example, www.hotmail.com has about 13 forms. I believe the one displayed is dependent on the URL. If I want to access the submit button of the visible form, which is usually the last one, how is that done?
Currently, I look for type=submit using DOM but it doesn't find anything and only loops through the first FORM elements.
I have a form with an unknown number of checkboxes (the page is generated by a server-side script). I need to loop through those checkboxes, test whether the name of each checkbox starts with a known string and, if it does, clear that checkbox.
I've tried just about everything that I can think of, but to no avail.
Can someone tell me how to loop through the checkboxes of a form?
If you have a javascript interpreter running in an environment unknown to you (as in what objects it exposes to the language) is it possible to loop through all objects in some way?
This is a non-browser environment, specifically the scripting engine for doing xslt extensions in msxml.
so I have this code for a date form and I made a PHP loop and even a javascript loop for it. There is a script that supposedly adds multiple 'dates' when the user clicks this 'add more date' button and I use an innerHTML to clone it.
My problem is how will I put it inside an innerHTML on a javascript. Since innerHTML reads html tags, is it possible to put a PHP loop within it? and how will you also call a javascript function within it?
this is the PHP code: <select> <?php for ($i=date("Y"); $i>=1950; $i--)
[Code]....
I just need to know if what im doing is right, or is there another way to do this?
I have a PHP script that generates a large, tree structured, table from XML data.Depending on user input, I need to expand or collapse sections of the table (Show/Hide).The way I have written the PHP script, each row is labelled with an "id=" according to its tree position.e.g. block0, block0_0, block0_1, block1, block1_2_0, etc. The buttons for each branch of the tree call a Javascript function, e.g. onclick="return toggleMe('block1')" or onclick="return toggleMe('block2_0_1')", and the toggleMe function knows it has to Show/Hide every row who's id starts with that string. Each row has a unique id, just incrementing the last digit.My problem is that I do not know how many rows there are and what I want to do is to loop through all the rows and see if their id starts with the parameter sent to the function.
I have a loop that is running and I am trying to increment a number by one each time. Here is what I am doing, but each time it just writes out 1 for the value.
var i=1; Start of Loop document.write(i); var i=i++; End of loop
I have used a script in my site but would like to get the .wav file to loop can anyone advise how to change the script to allow this, I am not very good with Javascript! Here is the Javascript:
<!-- Functions Code Block Start--> <script> /* Here we are creating two functions. The first to start a sound object playing and the second to stop a sound object from playing. */ // // This function, when called will play the sound object function EvalSoundPlay(soundobj) { [Code]...
I want to loop through each one and take their number add it to another number set in a variable elsewhere and then alert that number.The amount of these elements on the page changes constantly, so I can't count on that. It has to loop through each one to find the values.I tried this:
var els,i,asig; els=document.getElementsByTagName('val'); for(i in els) {[code]..........
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'm trying to decrease my numeric variable in random increments from 0-4 every 5 seconds until this variable reaches 0. Basically it's a countdown, but has a random increment each count. Here's my code:
i am designing a function that will generate a menu to be used across several websites. the code i have developed goes through all of the motion i want it to, except for one quirk: while in the loop, instead of going through the loop and inserting choice1, choice2, et cetera i want it to insert, in this example, news, profile, et cetera.
I'm trying to pass a $counter2 value from php loop to javascript, but $counter2 is incremented so I'm passing the highest value of $counter2, which i not what I want to do. Is there a way to combine values with html identifiers and pass them to js?
I'm trying to loop through an XML file and display the contents on a HTML page. My problem is the loop is displaying the first set of data and on the 2nd run through says the node is undefined.
Here is a snippet of the XML node I'm looping through [code]...
I think there is an issue with the variable I'm setting in the getElementsByTagName("title")[i] selector, but I'm unsure.
I want to perform a loop while the scroll height of a div is larger than the set height (this will be done for excerpts) however the loop doesn't work (I realize this would be an endless loop). Yet it works when I replace "while" with "if".
function scrollDetect(elemId) { var elem = document.getElementById(elemId); while (elem.scrollHeight > elem.clientHeight) { alert('test!') } } scrollDetect('pmessage');