I'm using zclip to copy text in an element to the clipboard. At the moment I have multiple instances of a text area and copy button like so <textarea class="adCode">
I am working on a problem that wants me to use a for loop to give an array a random number for each of it's elements (total of 10) and then using a second loop to add them up and display the result.
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) {
This does what I want; without the operator 'Number' I get a concatination of the various variables (as expected). Is there some way of globally defining all variables as numbers instead of strings?
How do I find the row & column number of the table for a checkbox on its Onclick event
The following HTML sample works perfect in IE. On click of the checkboxes, I am displaying the row number and its column number. How do I manage the same in Firefox? Code:
I have create a spinnrer (numeric up and down field) in my form. Below is the code for it:
Code: <form action="create_session.php" method="post" name="createsession"> <!-- This will post the form to its own page"--> <table cellpadding="0" cellspacing="0" border="0"> <tr>[code]............
Now what my question is how can I get the spinner to only allow numbers to be inputted in the spinner and not letters. Also how can I get it to only allow 2 digits to be entered in the spinner?. I know it will require an if statement but I don't know how to do it.
iwant to ask on how to display the sum of the 20 numbers i allready get the everage but i want to display the sum together of the everage this my code..
I am tring to sort some six numbers..the problem is that it doesnt work when I use "document.getElementById" instead of "document.write() my program is supposed to write six numbers every second..line by line Could you get it work ?
How can you join two numbers together in javascript, like you would join two strings?For example, if you have two variables, with 1 stored in each, how can I join them together, so I get 11, instead of 2?
Another quick question. I have the script to add each field up I need, but if the ending 0 after a decimal is present it doesnt show. How do I keep the leading zero and how do I keep just 2 digits after the decimal?
For example:
1 + 1.50 = 2.50
But javascript displays it as 2.5
Now sometimes when I do math I get:
2.3454545
In this case I just want 2.34. So if there is a ending zero I want to keep it, and if there is more than 2 numbers after the decimal I want to cut the rest off and leave the 2 there.
iw ant to have a function so that user can only enter numbers in the text box and + ( only once in the beggininging). if user wants to add + he can only enter + once as the first character like +123 or 123 bt cannot enter 1+2 or 123+ or +123+
I trying to get numbers from <div>'s and use them in if() commands.I've got the number but the if() commands don't seem to be working.Here is the code I'm using:
Code: window.onload = showPhoto var pNum = 1; // global num