I found this script that hides text and would like to add a loop to the function code. I have given it my best shot but I'm afraid to say my Javascript ability is a little ordinary.with this.PHP Code:
<body>
<script language="JavaScript" type="text/javascript">
function sizeTbl(h) {
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 a simple password protection setup on my site but the password is displayed when it is typed in is there a way to change it to a # or * when it is typed in
I have a survey/form for people to fill out. It has 3 sections. The first question has 3 checkboxes asking which of the 3 events the person attended. I want to hide the 3 sections of the form and then when the user checks the box sayign he/she attended certain events, to then show those sections of the form.
Im playing around with some JQuery and have a small problem with my menu. I want the text to always be visible, be on hover and not on hover. Currently, the text is only visible when I hover the <li> item. Check it out at http://cooper.zxq.netBelow is my code using to produce the menu.
This might be more of an HTML question, but I'm encountering it via a javascript function. I'm trying to do rollovers without using images. Here's some of the code:
I have some pages being loaded via ajax and I want some of the elements hidden when the page is loaded.I could hide them with CSS and then change the css attribute when I want them to show but that just seems clunky to me since I'd have to assign <input style="visibility: hidden;"> to everything I wanted hidden on load. I know how to make it visible later when I need it.Using jquery's document.read doesn't seem like a good solution either since I'd have to make a list of everything I might want hidden right there on the main page.
i'm wondering why this hiding and showing function works on IE (6) but it doesn't work in Mozilla Firebird (0.7)
function fnc_show(num){
for(i=1;i<7;i++){ eval("t_" + i + ".style.display = "none""); } eval("t_" + num + ".style.display = "inline"");
}
t_1, t_2 ...t_7 are the ids for TR elements in a table, i.e. with fnc_show(3), it will show only t_3. This works without a problem on IE, but it seems to do nothing in Mozilla, i only get an error telling that t_1 is not defined.
I'm wondering too, if there is a better way to do it, cause i read that eval function is inefficient .
I am trying to make a countdown that takes a users number from the text box and then counts down from there. I cant seem to get the user input into the loop.
Have an example with an orderform for two products. The form has columns of textboxes. Split in a lot of sections (showing the first two as an example) These textboxes are then sent to a PHP script. But I want to validate that the form is correct first. In the last section I have two textboxes "sum_amount1" and "sum_amount2". Basically I want to add up all amount1[] boxes into sum_amount1. Not using textbox1 + textbox2 etc. but instead using a for loop.
I'm working on a script(for giving points to a soccergame 0, 1 or 3 points) that give a value to a hidden field, i got a function but only works on 1 field.
I want that the function loops till all hidden fields are fill in.
why the function "changeDiv(the_div,the_change)" is not called from the for loop in the function displayUsers(keeper)that I generated. The displayUsers is written to get rid of excess code in the function display(keeper).
function changeDiv(the_div,the_change) { var the_style = getStyleObject(the_div); if (the_style != false)
I want to start javascript for fun, so I gave myself an assignment to use a for loop that will display "Hello world!" 6 times in the 6 different heading tags. The problem I'm having is that I don't know how to display it in the remaining 5 tags. I have it in the first one.
Here's my code: <html><head></head><body> <script type = "text/javascript"> var is = "<h1>Hello world!</h1>"; for (i= 0; i<= 5; i++){ document.write(is);} </script></body></html>
So here's what I'm trying to do. Creat a continuous text fade-in / fade-out. Basically I'm going to have a banner at the top of a page that loops through text from a db. So, I get my data and create the divs and a csv that I pass to js as an array, all good, that works. This is what it would look like:
<div id="div_one"> Text 1...... </div> <div id="div_two"> Text 2...... </div> <div id="div_three"> Text 3...... </div> And then the js array is Array('div_1,'div_2','div_3') etc. Now, this is where I'm getting mixed up, I want to loop that array of div id's and fade them in / out one by one.
Here's what I've tried: loop_running = false; function start_loop(){ loop_running = true; }function end_loop(){ loop_running = false; }function loop(arr){ if(arr.length > 0){ for(i=0;i<arr.length;i++){ if(loop_running == false){ // set loop_running var to true start_loop(); // fade in div fadeIn(arr[i], 1000); // pause for 3 seconds then fade out var t = setTimeout("fadeOut('"+arr[i]+"'), 1000", 3000); // now set another timer to end the loop after 5 seconds var e = setTimeout("end_loop()", 5000); } // now check to see if we're at the end of our array, if we are we need to call this function again to repeate if(i == arr.length){ // repeat loop(arr); }}}}
But that just gets the first div and then stops after fading out.... I've tried other variations too but with no avail..... I need to be able to tell the for loop to take 5 seconds for every one, so as it's looping it'll get the first div (first one in the aray), fade it up over one second, pause for 3 seconds then fade out, then get the next index in the array and do it again until it gets to the end of the array then it'll repeat.
obvious...they're not necessarily obvious to me yet.I am writing some basic image gallery functionality, using my owndefined jquery functions.I am trying to use .each() to loop throughthe "image" tags of an xml file, and create a thumbnail for each ofthem. I want to catch the index of each iteration to create avariable I can use to match my thumbs with my full-size images...
I'm trying to make it so when you click a cell in a table it runs a function based on the value within that cell. With the current code, no matter what cell is clicked, the alert box displays the same number, which is the last number in my array. The variable, princ, is just being overwritten rather than writing code to each the cell with the proper value.
i'm having trouble with some of my codes.i've been trying to put variables in function calls parameters, but it just does not work. for example, if I try to do sth like this:
Code: //a function that creates page numbers based on number of pictures that can be shown on the page function MenuBar() { pageSpan = [document.createElement('span')];[code]....
when i try to run it, it won't work.what i'm trying to do is that every time the loop runs, the "onclick" event of the created span will be the value of the loops "x" variable -1, and the value of x variable.meaning, for every new span, the parameters in the showImage() function are different.
Code: pageSpan[1].onclick = function () { showImages(0, 1) }; pageSpan[2].onclick = function () { showImages(1, 2) }; pageSpan[3].onclick = function () { showImages(2, 3) }; pageSpan[4].onclick = function () { showImages(3, 4) }; pageSpan[5].onclick = function () { showImages(4, 5) };
I know that each of the objects in the array have data because I tried to run each one of the lines above separately without calling the other two and it worked fine.
I am trying to implement an onclick function in a loop. To simplify things, I only print the essentials:[code]where id is an array assigned by AJAX and delLogic is another javascript function which takes in the id as the argument.I always get 'undefined' regardless of which onclick element I click on.[code]but it always give me the last id number of the array instead of the current one.[code]
So I am working on a project to take an integer that the user gives, and then get all the squares and cubes of all the numbers before that to the number given. It displays it in a text area. Maybe I am just lost for the moment, but It just prints the number that I give with the square root and cube instead of starting from 1, and ended on the integer I give.