The Function Takes An Array And Progressively Hides Each Element At Constant Interval?

Oct 29, 2011

I'm having a hard time getting my head round it again. I know it could be more efficient in jQuery, but I'd be happy just to get it working, with an extra variable, in straight js.The function takes an array and progressively hides each element at constant interval, in this case 50ms:

function hide_50(arrayA,visibility,current) {
if ( current == null ) current = 0;
var arrayB=(typeof arrayA == 'string')? arrayA.split(',') : arrayA;

[code]....

View 2 Replies


ADVERTISEMENT

JQuery :: Submenu From Array - Function ToggleOptions Takes 3 Variables - Target - Array - State

Feb 15, 2011

I am trying to understand somecode. I don't think I am understanding everything correctly. Can someone confirm or add to my understanding?

Here is the code, below is my explanation:

- CODE 1 - is saying if the the class subnav_dd is called on an anchor tag on a li, then make the function in the if statement "live". (Live in a sense binds the function to the condition, but unlike bind it allows the condition to be used more then once. ) So if the class subnav_dd is the parent, and has a class of .dis then prevent anything below it from firing. CSS - If code 1 is true, then I will only get the first li to fire, the remaining ones will not.

- CODE 2 - This one is a little tricky. Function ToggleOptions takes 3 variables (target, array, state). The condition is if the div subnav + target have siblings, then check to see how many siblings are there. Put the amount of siblings into an array, then check the state of each sibling. I don't completely the rest of it.

I think if the div subnav is called and something is found in the array then the class dis is either added or removed. Then what? I don't understand why I still need the else that adds a class to #subnav_ +.target

View 1 Replies View Related

Element.focus() Function Takes Ages To Perform?

Sep 28, 2010

My problem is that it takes ages to perform the element.focus() function. This is not a function I have written myself but is part of the Javascript language itself. There are probably a lot of reasons why this might be slow but I cannot find the right one. Let me describe my problem. We have a product which was created around 2004 and has been developed on since. The HTML and Javascript used for the product was based on a prototype which we then converted into a server based solution (we use Servlets/JSP).

Due to the nature of the prototype (and also the graphical layout) the major page consists of one huge HTML page which a lot of hidden DIV tags. These DIV tags are then toggled visible/invisible to make it look like we have a kind of tab functionality. We also do not load all tabs when we load the mail page, instead each tab is loaded into a hidden iframe and then with Javascript we grab the resulting HTML content and paste it into the main page, making that one tab visible while hiding all other tabs.

In one of these tabs we also do some more magic. The layout is as follows; we have sets of three columns each and then a lot of rows. Each set of three columns contains one text field per column. The last text field contains a percentage value and when edited, we check if the value is lower then before the edit and if it is, then we split the column, creating another set of three columns.

When we load the page the first time, there exists only one set of columns with the last column having the value 100. There can however easily be 100 rows as well. For the larger pages we can have (at load time) three columns which makes it 900 text fields. I do not know if this is much or not.So, with the above info, to my problem. First off, when I try to move the marker and click on a given field (so that the marker starts blinking on the selected field) it takes maybe 2-3 second (although not always, seems to be more the first time). If I then tab to the next field it goes very fast (like one would expect).When I try to edit a value (by simply adding or removing values) it again takes a very long time (the first time).

When I then try to tab, it takes ages (this happens always, not only the first time).My Javascript then. I have two events, onchange and onkeydown. onkeydown checks if a variable is set to true or not. If it is set to true, the method does nothing. If set to false it does a bunch of tests and sets the variable to true. onkeydown is what I think causes my first lag but the code is not really that advanced (no loops or anything). onchange does the same checks plus all the magic (with the split etc). One of the last things it does is try to set focus on the next text field and this goes extremely slow all the time.

We use IE8. We (sadly) have a lot of IE specific stuff so the site doesn't even work in Firefox. I have used IE8 Developer Tools and used the Profiler which basically gives a list of Javascript calls and their execution times. My own functions take basically zero time, but there are A LOT of calls to functions that are not named, or anonymous, according to the Profiler.

How do I find what the anonymous function calls are?Why is it the focus() function that takes time, can it (or is it) still some of our own Javascript that makes that function go slow, even though it is part of the Javascript language?Can it be the amount of elements on the page (900 text fields)? Is that much?Can it be IE8? Are there known issues with this?

View 1 Replies View Related

JQuery :: Firebug Shows The Updated Class Of An Element But Live() Function Takes The Old Class?

Jul 2, 2009

I am new to this discussion but hope you would post reply for my query and encourage me to keep in touch with this discussion. Well here is my problem. I have made an edit in place form in which we can add and remove the elements. I have used jquery.jeditable.mini.js and jquery.duplicate-remove.js plugins for edit in place and add and remove action. I have live() function to access the dynamically ganerated elements like this. $(".addressDiv span").live("mouseover", function(){
clickable function here...

[Code]...

View 1 Replies View Related

Get A Constant Variable Of Array?

Jun 16, 2009

i hav an array named contents [i] where i wanna get every 3rd value out of it.below i make an example:

contents [i] = [2,4,6,8,10,12,14,16,18];

i wanna find a script dat could return every third value which is 3,6,9

View 1 Replies View Related

JQuery :: Any Way To Run Function Before Validation Takes Place?

Aug 14, 2009

We are using JQuery for one of our software projects, and it's a very nice library. It's making things far easier. We are also using the Validation plugin, which is working wonders for form validation.However there's one wrinkle that we have not been able to figure out.Is there any way to run a function before the validation takes place?We have help text displayed in some of our text inputs and text areas,which are cleared onFocus (and restored onBlur if the user has not entered anything). We would like to clear those help text before validation is run, so that we don't get any false validations based on the help text, rather than the actual value of the field, which is blank.

View 1 Replies View Related

Force - Display Is Not Updated During The Interval Function

Apr 10, 2010

I have an image rotator that uses nested intervals. The outer one switches the images, and the inner one preforms the fade. The problem is is that the display is not updated during the interval function, and so, the fade is not displayed; the new image just appears- no fade. Is there anyway to force the display to update during the interval? Here is the code:

[Code]....

View 3 Replies View Related

Ajax :: After A Time Interval Call A Function?

Apr 7, 2011

I'd like to have basically rotating images on my page but I'd like to pull them from a database. how to set an image rotation like every 10 seconds but have it call a function which will use AJAX to be able to pull the images from the database?

View 3 Replies View Related

Create A Function That Hides Two Divs?

Mar 8, 2011

I've created a function that would hide and show paragraphs from a drop down list, that paragraph contains a link that will show a div containing a map of google. But when I switch to another State on the drop down list I'd like to have the original first paragraph that showed up to disappear. So far, I can only get the <div> that contains the map to disappear.a function that would hide the paragraph and the <div>? Again, Here's the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>[code].....

View 4 Replies View Related

Function - Compares Two Strings And Then Shows Or Hides A Div Depending On Results Of Comparison

Oct 8, 2011

I have been on this for over an hours now, it is probably something simple and/or stupid, but why doesn't this script work? I have read forums til my eyes are crossed and can't see what I am doing wrong I am new to javascript, but not programming. The point here is to create a function that compares two strings and then shows or hides a div depending on the results of the comparison. I was trying to pass in the name of the two input text boxes containing the text and the name of the div to show or hide (so that it can be used in multiple scenariios.) Right now my error message is that document.getElementById(field1).value is not a function.

Here is the code below..

View 6 Replies View Related

Progressively Loading Very Big Image In A Div?

Aug 1, 2010

I was searching for a way in which I can load a very big image progressively in a div or when we use thickbox for example : when we open a very big image file directly in Firefox , it started showing the image right away progressing it to complete image.

View 4 Replies View Related

Progressively Change Margin From Something To Something - 50px At A Time?

Nov 18, 2011

I'm trying to play around with overflow: hidden and javascript. My idea is to have a button that will add or subtract margin-left from a div onclick.

Code:

<div style="overflow: hidden; width: 500px;"><!-- container div -->
<div id="idofthediv" style="width: 1000px; margin-left: -250px;"><!-- centered div inside the container -->
!!stuff inside the centered div with the negative margin-left so it starts outside the container!!

[code]....

but not beyond, 50px at a time, for example">

View 3 Replies View Related

Correct Syntax For An Nested Array Where Each Array Element Has 3 Elements, A Number And Two Text Strings?

Sep 17, 2010

What is the correct syntax for an nested array where each array element has 3 elements, a number and two text strings?

Code:

array = ['1, Old Man, Old Man','2 Black Sheep, Black Sheep',....]

should the text strings be in double quotes("")?

Code:

array = ['1, "Old Man", "Old Man"','2 "Black Sheep", "Black Sheep"',....]

View 3 Replies View Related

Take Data From An Array And Apply Each Array Item To An Element

Mar 26, 2010

I'm trying to grab values from a set of arrays based on the value returned by my select box.

**Caveat - this is not an area I have any real experience with**

My arrays look like:

Code JavaScript:

I then need to test for each, then associate with one of my fees arrays, then grab each of the values in the array and write those values to elements within my page.

I'm then doing this to evaluate for each degree

Code JavaScript:

I need to first figure out how best to import all of these 60+ arrays and then in each of my conditions pull out each value and write to my page.

There is a unique 1 to 1 relationship between each degree and array so I can't consolidate as the values for each degree differ slightly.

View 3 Replies View Related

JQuery :: Using A Veriable Instead Of A Constant?

Dec 15, 2010

is it possible reference an input tag based on a variable passed to a function instead of its name directly. For instance I have a function:

function checkedAll(Name)
{
$('input.Day1').attr('checked', true);

[code]....

View 1 Replies View Related

Having IFrame With Constant Scrollbars?

Oct 9, 2011

how to have an iframe with constant scrollbars so the scrollbars are visible even though there is nothing to scroll!

I have this now:

Code:

<script type="text/javascript">
function ChangeScrollState (select) {
var iframe = document.getElementById ("thisIframe");

[code]....

If I hit the option with scroll I get what I want, but how do I make this static?

View 2 Replies View Related

Newline Character In String Constant

Jul 23, 2005

I have a form with a textarea field. I want to validate the input from
the textarea using javascript. Suppose I want to check that the user
has not entered the string:
"Hello
World!"

To do this I am using the script:
form["text"].value == "Hello
World"

But this gives an "unterminated string constant error" because the
browser converts this to:
form["text"].value == "Hello
World"

So how do I do my check?

View 3 Replies View Related

Define A Constant In A Virtual Class

Jun 8, 2007

How is it possible to define a constant in a virtual class?

E.g. I wrote the following code

tml = {
sayHello : function()
{
alert('hello');
}}

now if I want to add a constant into tml virtual class, what I need to
do?

I tried something like

tml = {
const1 : Integer = 0,
sayHello : function()

or

tml = {
const1 : function(){return 0;},
sayHello : function()

in both case, trying to get - inside tml object - the value of
const1 ... it results in a Object value and not the Integer value I
need.

View 4 Replies View Related

Getting Unterminated String Constant Error

Jul 20, 2005

What do i need to add to the document line to stop getting an Unterminated
String Constant error?

itemtocheck = &#55614;&#56452;'
document.writeln('<!--#include
virtual="checkQty.cgi?item='+itemtocheck+'"-->');

View 3 Replies View Related

Unterminated String Constant Error

Apr 6, 2005

I'm getting an error message come up in IE6 when somenone subscribes to my newsletter from my home page (either from the drop down hover box form or the left hand form) here .

After entering a name and email address
I get:

A runtime error has occurred....do you wish to debug?
Line 4
Error: Unterminated string constant

When I click NO I then get a second small windows popup which says:

A runtime error has occurred....do you wish to debug?
Error: Expected ')'

I've looked at lines 4 and 43 of my thanks.php page (the page subscribers get when they fill out the form but before they double optin via the email) and I can't find anything wrong. I guess the first message expects a semicolon and the second obviously a closing bracket. Code:

View 2 Replies View Related

Constant Website Visitor That Is Online 24/7 ?

Apr 29, 2011

I desperately need to have a constant website visitor that is online 24/7 on my website. Due to a js error. We need to keep an absolute minimum of one online site visitor. This is a temporary measure while we locate the error which so far has taken 3 js coders 3 days with no success in finding. We really need to keep the script thinking that a user is online.

Is there a bot setup that will simulate a website user that NEVER leaves a certain webpage?

If not. How can I set up the script so that I can fool it into thinking there is someone online? I really need this info... i have spent hours and another thread, with NO help on the repair. I really need to be able to keep the js rolling. I am on the verge of giving up on this project as impossible.

View 3 Replies View Related

Run Time Error Unterminated String Constant

Dec 8, 2005

I am facing a problem in javascript. strdata is a variable of
javascript and following is an assignment(hmm a Huge one but
unfortunately its not mine code, I am just trying to rectify it) to
this varibale.. Now I am facing a run time error(Unterminated string
constant).....

View 3 Replies View Related

JQuery :: Append() Function - Select Element Using ID And Add A Row To Table With A HTML Form Element

Oct 13, 2009

I'm having some problems understanding the append() function. What I'd like to do is select an element using it's ID and add a row to the table with a HTML form element. The table is dynamically generated using a Django template ( form.as_table() ) so I'm not able to alter the original HTML markup too much.

If I had a table like this...

View 3 Replies View Related

JQuery :: Each Loop With An Interval

Sep 28, 2011

Currently i am working on ajax slideshow in which slides come from xml document. each slide contain slide having source code for example

as " <li><a
href
=
"#pix1"
><img

[Code].....

View 1 Replies View Related

JQuery :: Set The Interval Value By A Variable?

Dec 30, 2010

I ammodifying an gallery script calledslideSwitch. I want to set the interval value by a variable. For example, If I click button 1 the interval value is 5000 and If I click button 2 - the interval value is 2000 etc. Do I need to pass the value somehow? I might be totally off track here.

[Code]...

View 4 Replies View Related

Unicode + Escape Character = IE Unterminated String Constant Error!

Nov 1, 2007

Let's say I have a string:

div.innerHTML = "<a onclick='foo(""+myWord+"");'></a>";

in IE only (tested version 7) if var myWord = "English" then it works
fine but if var myWord = "Modifier Chau00EEnes" then I get "Unterminated
string constant" error.

What fix would you suggest to keep div.innerHTML = "" format?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved