Executing ForLoop Delays Consistently
Nov 16, 2011
I have a bunch of longitude and latitude values sent to google maps V2 api but i cant seem to get the requests to match. So my code is set up where
Onclick I have it read the longitude and latitude from textfile and send it to there geocoding server. I have that in a for loop which goes through each point it looks like this.
Code:
Where address2 is the text file in a split() array and then is sent to request geocoded values. When i get the response it doesnt seem to write it directly after in the text file. It ends up writing everything in the for loop first and then all the received requests.
View 1 Replies
ADVERTISEMENT
Jun 6, 2006
I know how to use setTimeout, but I'm having a problem with my script
in that I don't really want a function called by the timeout. So I need
a way to insert a brief pause. (I know that theres no direct facility
to do so in javascript, and I don't want to waste cpu time by using a
date and time to do this.)
The situation is that I have an array full of hex codes to change
colors of an div, however I need a delay in order to make it look
right.
A loop adjusts the codes for me,
function fruitLoop()
{
for(i=0;i<=213;i++)
{
//would like a pause here
ook.color = myarray[i]; //adjusts div to another color
}
}
So how do I insert a pause? It should be simple, but I just can't think
of a suitable mechanism.
View 2 Replies
View Related
Apr 4, 2010
I recently created my first theme shortly after leaning css, but i am having trouble with my navbar. The main bar is a list with images, then when a user hovers over one a list drops horizontally on the bar below. Problem is when trying to click far off links it is very easy to slip and the menu disappears. What i need is some sort of delay to prevent this, or some way to make the menu show after clicking instead of hovering.
Here is my code, i have two questions;
1) I have never written a theme before, is this the proper way to code a navbar? (i hear making an actual list is important)
2) How can i add a hover delay or change the submenu to be click activated?
Here is a link to my test site [url] so you can see it in action.
Here are the two js scripts i tried, honestly I am not sure how to use them and couldn't get either to work. I think i installed them in the proper places, but i dont think i edited them to work properly:
View 1 Replies
View Related
Apr 6, 2011
I want to make a webpage with 6 div's:
One on the left and contains the buttons to control the others and occupies half the page -left half- 2nd that upon a button press from the 2nd slides down in the middle the others occupy the right half of the page and are behind each others and are viewed up button click on the 1st, on 1st click the 2nd comes down in the middle and the 1st one of the right divs slides out of sight and makes the one behind it visible, on second button the one behind it slides out of sight and makes the one behind THAT one visible my problem is only ONE part of the sliding div's is sliding and then they just disappear, and i want to be able 2 force a delay between actions, and the 2nd div that is supposed 2 slide down is actually sliding UP :
1st things first does anyone know how do i hide a div on button click and show the one behind it?
Update 2 question: how do i make #box8 slide to the right out of side.
View 1 Replies
View Related
Jun 6, 2011
Many slider solutions available but they have parameter that forces same delay for display of each element in the slideshow. I'm looking for existing code that:
(1) would display the contents of a div, that is, HTML plus img, as element in slideshow
(2) automatically progresses to next element in slideshow unless paused by mouseover
(3) each part of the slideshow would have its own delay to determine viewing time
(4) FWD and BACK ability for user to interrupt sequence and move along manually
(5) wrap-around at end to resume at begin
Many snips of code out there do everything except (3) since they set one delay that applies to all elements in the slideshow instance, do not support individual delays for each part of the slideshow.
View 2 Replies
View Related
Nov 20, 2009
I am trying to get my site [URL] to run consistently on all browsers. I'm using AJAX code that works great on Safari and IE8, but only work intermittently on Firefox and Chrome.
[Code]....
View 4 Replies
View Related
Jun 11, 2010
my problem is that im having a problem the toFixed function. it is not rounding numbers consistently. pasted below is a sample code where i have done some number testing:
<html>
<body>
<script type="text/javascript">
var num = new Number(1023.465);
document.write(num.toFixed()+"<br />");
document.write(num.toFixed(1)+"<br />");
[Code]...
View 1 Replies
View Related
May 22, 2010
I am a new poster here and new to javascript as well. I made a script in which if a user enters the correct coupon code, he will be directed to a confirmation page. If not an alert box will say the coupon code was wrong. It sounded simple enough and it worked for sometime. Here is what the code looks like code...
As I mentioned, it was working originally, but now it only works when I change the variable 'pass' to something different. I want to be able to keep the variable the same. I don't understand what exactly is going on here.
View 4 Replies
View Related
Jul 31, 2009
My problem is on this page using IE 7 & 8:[URL].. If you click the tabs, you'll see that the footer doesn't adjust accordingly. Only in IE. Works fine in Firefox (Mac & PC) and Safari Mac.
Here's the javascript:
<script type="text/javascript" charset="utf-8">
$(function () {
var tabContainers = $('div.imgswap > div');
tabContainers.hide().filter(':first').show();
$('div.imgswap ul.tabNavigation a').click(function () {
[Code]...
View 2 Replies
View Related
Jul 31, 2009
I just found out I can't post a link. But it's a tinyurl dot com with /m8ajyp If you click the tabs, you'll see that the footer doesn't adjust accordingly. Only in IE. Works fine in Firefox (Mac & PC) and Safari Mac.Here's the javascript:
Code:
<script type="text/javascript" charset="utf-8">
$(function () {
var tabContainers = $('div.imgswap > div');
[code]....
the menus page /menus (which should be identical code and structure as the other page) it looks like the footer adjusts on the FIRST click of a different tab. But then it doesn't adjust again. On /special-events the footer doesn't adjust even the first time.
View 5 Replies
View Related
Nov 4, 2011
I have links that, when clicked, open up a larger image. If the link has the class of "sold selected" then a semitransparent "sold" image should dynamically load as well. What I'm noticing is that it seems to appear on every other click, and I don't know why.
I've created experimental files so as not to disrupt the functioning site. [URL]
I added the variable "linkClass" on line 18; value assigned on line 53 as part of the linker.click anonymous function IF statement on lines 106-108 at bottom
I also have an alert on line 105 just to prove to myself that linkClass was appropriately setting (it is). Images 4-12 should all have the "sold" banner attached, but no matter which of those I click first, the clicking previous/next makes the banner appear/disappear.
View 2 Replies
View Related
Jul 26, 2009
I'm having difficulty loading images via Ajax on a site that I've been working on.I'm performing the ajax by using the Request.HTML object of the MooTools framework. Basically, I'm just passing some parameters to a php script which outputs some image tags and then I insert that HTML into a pre-defined content div. For some reason though, it seems that big images don't seem to load consistently when using this technique. Usually, they will just show up as broken images, but when I navigate to the url of the image that is 'broken', it displays just fine. Also, occasionally after navigating to the actual url of the image, my browser will cache the image and then it will display just fine when loading it through Ajax.
View 3 Replies
View Related
May 30, 2011
i have this code:
if (($has_freechat1['confirmed'] == 1) && ($has_freechat2['confirmed'] == 1))
{
$was_clicked = 0;
[code]....
View 5 Replies
View Related
Nov 14, 2006
I have a perl script running on my server on a chosen port, and I want to be able to execute functions that this script provides from inside Javascript functions.
For example, I need to call ....
View 3 Replies
View Related
Aug 2, 2007
I am using an ASP.NET AJAX control (ValidatorCallout) that requires
client-side validation to work with a custom validator I added. This
is an example of some code that works:
<asp:CustomValidator ID="CV_PartNumberExists" runat="server"
ClientValidationFunction="CheckPrime"
ControlToValidate="PartNumberText" ErrorMessage="b><br />A Part
Number is required."></asp:CustomValidator>
<script language="JavaScript">
<!--
function CheckPrime(sender, args)
{
var iPrime = parseInt(args.Value);
var iSqrt = parseInt(Math.sqrt(iPrime));
for (var iLoop=2; iLoop<=iSqrt; iLoop++)
if (iPrime % iLoop == 0)
{
args.IsValid = false;
return;
}
args.IsValid = true;
}
This is code I borrowed from another site to test this method - and it
works. My problem is that I need the JS to execute a VB function in
my project and I don't know how to do that. I want to do something
like:
function CheckValue(sender, args)
{
var sPartnumber = String(args.Value);
if FindExistingPN(sPartNumber)
{
args.IsValid = false;
return;
}
args.IsValid = true;
}
....where FindExistingPN is a funciton in my VB class. I have seen
some other posts about this, but none of them really gave me any
sample code that I could run. As I mentioned earlier, my JS skills
are lacking, so I am unable to create this myself.
View 3 Replies
View Related
Oct 7, 2010
Having trouble executing external javascript functions. I have a select option list where a different function is executed depending on the value of the selected option. An internal function checks which option is selected and then calls the appropriate external function. The internal function works as far as checking the value of the option, but the external function(s) will not execute. This code is of this nature:
Code:
function DoWhat()
{
[code]....
View 2 Replies
View Related
Apr 27, 2009
I have a c program and I need to call method in the program from a javascript file. is it possible.Another question which I have is whether it is possible to import other js files in a js file (in order to segment code into differnt files not all in one file)
View 1 Replies
View Related
Dec 16, 2003
I need to execute a javascript function on a page on a site. The link of a button is javascript:executefunction(2). However, I need to execute the function javascript:executefunction(1). Is there a way to do this by typing it into the internet explorer address bar (like the view-source:address thing)? Or is there a program that can accomplish this? I need to do this to test how it would execute the command differently. I have no access to the server (it is not my server/site) and don't have to option of download all the files to my computer (too many external css and js files).
View 3 Replies
View Related
Feb 26, 2010
Can somebody explain the following code:
var dbg =
(
function(){
[code]....
View 5 Replies
View Related
Jul 5, 2010
i've been trying to make an animated fly/slide-out menu and am just trying to get the basic mechanics down. long story short i'm just starting with a simple mouseover/out setup to get things going.currently (as seen in the code below) i have a div which should simply move down 30px from its starting point on mouseover and return to its starting point on mouseout. this works perfectly the first time the mouse enters and leaves the div but nothing happens the next time the mouse enters the div unless the page is refreshed.
Code:
<html>
<head>
[code]....
View 1 Replies
View Related
Jul 23, 2005
I'm trying to execute a bat file on the server in javascript. The javascript sits on the server as well. I'm currently using:
document.location.href='testme.bat'
However the only thing it does is just opens up the bat file and shows my bat code in the browser. How can I execute the batch file instead of opening it and viewing it in the browser?
View 5 Replies
View Related
Oct 20, 2005
I'm loading an XML file which has a processing instruction
(<xsl-stylesheet href="..."/>). I need a cross-browser solution which
will load the XML file and have it's XSL PI run and translate the XML
to genereate the desired output.
View 3 Replies
View Related
Nov 23, 2005
I want to execute server code invoked from inside Javascript code.
I will have my server code in a servlet, callable with a URL, but how
do I invoke the servlet from Javascript without reloading the page and
not opening any window? I mean, I don't want to display the HTML result
of this request.
View 8 Replies
View Related
Mar 7, 2006
I've got a function, which must do thinks in 3 steps.
1. Change the innerHTML of an element to show a message (Please wait
while ...)
2. Work with datas
3. Re-Change the innerHTML to show the result.
The work on datas may take a few seconds (working with XML, DOM and so
on) I did a cut and paste of an old post, but no one did any answer, so I
hope to give any help now.
View 3 Replies
View Related
Sep 16, 2006
I'm jusing prototype-1.4.0.js as framework.
I have a function to populate three listboxes. The items in the
listboxes are from a MYSQL database and are related. The items are
requested by a php page.
Most of the time everything works fine, but sometimes I end u with only
one or two listboxes.
I can't figure out what's going wrong here. I've tested in Firefox and
Internet Explorer, both the same problem.
Does anyone know why my code sometimes stops executing?
Could it be that i made too many requests in a short time so the next
request can't execute because the current has't finished?
Hope anyone has an idea of what's going wrong.
View 9 Replies
View Related
Nov 23, 2010
I'm using this script to replace text on a page loaded into another frame, called 'booker'. the script works when i use it on the same page, but i can't seem to get it to reference the other frame for some reason. it executed with 'body OnLoad' any ideas for what i'm doing wrong?
View 3 Replies
View Related