I have a rather simple question. It's been four long years since I last dealt with JS and although I remember the basic concepts behind loops I don't remember how to actually implement them.
This is my current code:
What's bothering me is how redundant it is. I would much rather simplify it into a few lines where i increments by 1 from 0 to 13 in the case of image[i] and cover[i]. Is this possible? And if so, how would I go about articulating it?
<script> var rXL = ""; do { rXL = prompt("Enter more entries? Y/N"); // IF Y or N is entered, the loop should in theory exit } while (rXL != "Y" || rXL != "N"); </script>
IF Y or N is entered, the above loop should in theory exit, however it results in a infinite loop :/.
What I want to do is have 5 <div>s displayed in a fixed position on my page. The divs will contain text and pictures. Only one div is displayed at a time, and every 5 seconds, the next div slides over the top of the current div (from right to left) until it is completely obscured. At the conclusion of the fifth, it starts again with number 1.
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 have a form1 with two fields, field1 and field2. I want the contents of field1 to be transferred to field2 onBlur, but with some changes. I want the contents of field1 to have its spaces replaced with Dashes, and all punctuation removed, so this can happen:
FIELD 1 value: Today's rate is 15%, & the outlook is good.
onBlur should then create a value of:
FIELD 2 value: todays-rate-is-15-percent-and-the-outlook-is-good
Notice that the "&" was converted to "and", the "%" to "percent". The comma was deleted and all spaces replaced with Dashes. The second field should only every contain alphabetic letter, dashes, and numbers.
Here's a small collection of bookmarklets for disecting your own (or other people's!) websites. They do things like, show all TABLE elements with a red border, hide non-link images, and so on...
i need a 5 second counter to start when the page loads. basically the usage is I want people to click a link, and if the page has been loaded for more than 5 seconds, do thisFunction().. if not, do nothing.
so basically
<script type="text/javascript">
window.onload --> start the counter // when the counter hits 5 seconds, set var done = true;
function thisFunction() { if (done = true) { proceed with function) else {do nothing} } </script>
I'm trying to write some validation for a field called Propid, in a form called qSearch. Basically if there's nothing in Propid, or it is says "ref no.", I want to alert the user, otherwise, I want the form to submit.
<!-- function submitForm() { window.setTimeout(document.email_inner.submit(),5000); } //-->
im trying to submit my forum after 5 secounds of viewing the page and i have no knowlege of java wat fo ever but ey told me this is the onlyway to do such a thing ... this i wat i have so far in hte header .... it dose nothing at all
Just a few questions about simple animations (that aren't Flash). I've searched around but haven't been able to find anything really concrete about alternatives to JS. Basically in terms of simple animation, is JS the be-all-end-all? What other options are there in terms of simple animated menus (besides Flash & animated GIFs)?
Something like the above Quick Links menu; would something like that be possible in only Javascript? Or would there be an alternative?
I'm looking for a javascript that will do a 3 minute countdown and display it on the screen, preferably not in a textbox, but i'm not picky.
Here is how it works. Someone will make a selection from a form. The date/time of that selection is then stored in a database. I want to use the date time stored in the database as my starting time and then countdown 3 minutes. After 3 minutes I would like a message saying Times Up, please make a selection.
How do I use JavaScript instead of using this " <a target="_blank" href="http://www.OtherWebsites.com">Other websites</a> " if I want to use a list of JavaScript links?
I am building a stand alone html help system (.chm.) So the usual woes with mailto are not going to be encountered. Likewise I am ensured all my intended users have Outlook installed. With that said This is what I want to do.
I have a simple html form with a an radio button option group, a listmenu, a text box, and a text area. What I would like to do is have a user fill out this form, and hit a button that sends the results via outlook. The TO, CC, and subject fields will be hard coded. I want the option from the list menu on line one, the radio button on line two, the text box on line three and the multi-line text area starting on line 4.
I haqve searched the web, and groups all day to no avail. Everything I have tried simply fails. I even tried breaking this down into a simple one text box one button, with no good results via javascript. I can get it to work ok without javscript, but instead of new lines they just overwrite each other.
I'm trying to dynamically change the contents of a select box by doing the following...
function myfunc() { var obj=document.getElementById("objname"); // name of the select box var str='' str+='<option>blah</option>' obj.innerHTML=str; alert(obj.innerHTML); }
For reasons I don't understand, the alert gives me 'blah</option>'. Where is the leading <option> tag?