For Loop Speed Trick?
Aug 31, 2006
In the Yahoo! UI event.js file I see the following quite a bit
for (var i=0,len=unloadListeners.length; i<len; ++i) {
when I always just write
for (var i=0; i<unloadListeners.length; ++i) {
Is it worth it to declare the variable len to save time evaluating
unloadListeners.length?
View 14 Replies
ADVERTISEMENT
Jul 20, 2005
I'm using the following to allow dynamic resixing of an image (when the usre
presses down on a button):
function widthup() {
image.width = image.width + 1;
width.innerText = image.width;
if(x==1) {
setTimeout('widthup()',0);
}
}
even when the 'setTimout' is at zero it goes pretty slowly. Any way to have
something faster?
View 3 Replies
View Related
Jun 2, 2009
Does anyone know why IE7 is refusing to do 'the trick'?
It works nice in modern browsers and even in IE6 [url]...
View 1 Replies
View Related
Jun 8, 2009
If you write javascript:document.forms[0].submit(); in the location bar, automatically it submits the form, which bypass the form validation. It there any trick to block this form submit?
View 4 Replies
View Related
Oct 3, 2006
Since XMLHTTP Request does not support loading of XML from other
servers, I decided to use a trick:
load XML into hidden iframe and then get that XML with JavaScript to
parse.
But, is this a good idea? I am stuck. How do I get XML loaded in the
iframe and pass it on to JS function for parsing?
View 11 Replies
View Related
Nov 21, 2006
I was looking for a way to have a popup window appear when someone left
my page, but not have it appear when they hit the refresh or back
buttons on the browser. Since using onUnload="..." in the body tag
causes the window to appear when you hit the refresh or back buttons,
that didn't do what I wanted.
After doing Google searches for many days I never did find an answer
for how to do this. I thought I could have each page open the popup
onUnload, but then also have each page close the window onLoad, so the
window only stays visible if you actually exit from my whole website.
The problem is, I didn't have the handle to the window object in the
page that wanted to close the window. I tried passing the handle in a
cookie, but that didn't work either.
My solution, which I haven't seen anywhere else before, works like
this:
Every page (they are php) includes the same header which has this code
in it:
var exit = true;
<?php
$popstuff = file_get_contents("_popstuff.txt");
$values = explode("|",$popstuff);
$usepop = $values[0];
if ($usepop!="on") {
echo("exit = false;
"); // turn off popup window
}
?>
function offerWindow() {
if ( exit ) {
offerPop=window.open('_offer.php',
'offer','width=425,height=298,resizable=0,toolbar= 0,location=0,directories=0,status=0,menubar=0,scro llbars=0');
offerPop.blur();
window.focus();
}
}
function noExit() {
exit = false;
}
function closeOffer() {
offerPop=window.open('_offer.php',
'offer','width=0,height=0,resizable=0,toolbar=0,lo cation=0,directories=0,status=0,menubar=0,scrollba rs=0');
offerPop.close();
}
// End -->
</script>
</head>
<body onUnload="offerWindow();" onLoad="closeOffer();">
Now what happens is if you leave the page it opens the popup, but
before you even get to see it, the next page closes it (by window name
instead of by handle). If you close the browser, or leave the whole web
page then the popup remains. If there is a path you wish to take out of
the site that does not show the popup then just include
onClick="noExit()" to the link and it turns off the popup. Normally the
links that go from page to page within the website will all include the
"noExit()" call so the popup never even shows up. But the problem where
the popup shows up on browser refresh or back buttons just goes away.
View 14 Replies
View Related
Jul 23, 2005
I'm using the 'standard' trick to force the load order of my frames:
<HTML>
<HEAD>
<TITLE>Frametest master page</TITLE>
<SCRIPT Language="Javascript">
function refreshFrame() {
frames['vFrame'].window.location.href = "VisibleFrame.htm"; }
</SCRIPT>
</HEAD>
<FRAMESET COLS="100%,0" BORDER="0"
<FRAME SRC="blank.htm" NAME="vFrame">
<FRAME SRC="HiddenFrame.htm" NAME="hFrame">
</FRAMESET>
</HTML>
but this does not work when the user hits F5 (refresh). I want this specific load order because VisibleFrame.htm accesses objects in HiddenFrame.htm.
View 1 Replies
View Related
Nov 8, 2011
Does anyone know of an alternative coding for this function that will do the trick in browsers such as firefox?
with (document)
{
write("<STYLE TYPE='text/css'>");[code]....
View 2 Replies
View Related
Jul 23, 2005
I would like to design a page that measures the user's download
connection. Does anyone have an example link or script that might aid
me in this task?
View 4 Replies
View Related
Jul 23, 2005
anyway to check connection speed?
View 3 Replies
View Related
Oct 16, 2007
Ive been having a problem of late with one of my sites that uses PHP5 /
Ajax. The problem is that periodically the ajax functions lock up and it
gets stuck in the loading phase of the request. If i restart the apache
server everything goes back to normal (i assume it severs the connection
to the ajax called function).
I think this is a problem with the javascript part as i have tried it
using a straight post request and have have no problems and slow loading
time is localized to the one user (ie. still works fine on the other
computers on my office network).
I have recorded this happening in Firefox, safari and IE6 & 7
My server is running debian with apache2 and php5
Just wondering if somebody can shed some light on what my problem may be? Code:
View 3 Replies
View Related
Apr 6, 2010
I've got the following site that loads great in FF and Chrome (no surprise), but is terribly slow in IE7. It's even quick in IE6, but not 7. Here's the site code...
Now I'm using JQuery in a couple places, but it's by no means nothing crazy. The page is fairly simple.
I thought of preloading the main content images, but even after they are loaded in the cycle, the loading time is still slow.
View 10 Replies
View Related
May 21, 2011
I read somewhere that putting Javascript code after CSS code on webpages makes them feel like they load faster. I was wondering if any of you has any experience with this and if you do follow this rule in your projects.
View 5 Replies
View Related
Sep 30, 2000
Just wondering if anyone knew if there was a definite speed advantage to VBScipt as opposed to JavaScript?
View 7 Replies
View Related
Apr 5, 2010
Why does the speed not permanently change?
<SCRIPT>
<!--
function ScrollMarquee(speed) {
var speednow = "";
speednow = speed;
window.setTimeout('ScrollMarquee('+speednow+')',speednow);
[Code]...
View 7 Replies
View Related
Feb 6, 2009
I wonder javascript execution speed depends on what ?
Meanwhile, if a flash slide show vs flash-like javascript slide show, which one will win due to download speed and execution speed?
View 2 Replies
View Related
Jan 22, 2011
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.
Here is the test object:
test = [
{
"name" : "Menu 1",
"url" : "menu1.html",
"submenu" : [
[Code].....
'Menu 2' and 'Menu 3' don't show up! I'm sure it's something small that I'm overlooking.
View 2 Replies
View Related
Aug 4, 2011
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.
View 2 Replies
View Related
Jul 23, 2005
I have to move 2 layers (one from up to center and one from bottom to
center) and I found this way:
<div id="up" style="position:absolute;left:10px;top:-20px">Up</div>
<div id="down" style="position:absolute;left:10px;top:200px">Down</div>
function movediv(){
var u = document.getElementById("up")
var d = document.getElementById("down")
u.style.top = "100px";
d.style.top = "100px";
}
It doesn' work...because:
1) They don't move at "the same time"...I would like to obtain
simultaneous move.
2) I can't control speed so moving is invisible!
View 8 Replies
View Related
Jun 22, 2011
It's possible to set custom speed for each pic or for some pics?and How remove the frame
View 4 Replies
View Related
Oct 31, 2011
I am new at this jquery stuff. In fact, I'm more of a cut and paste kind of gal I have a web page that I incorporated a slideshow. The picture seems to change a bit faster than I'd like, and I can't seem to make the picture go slower than it already is. Can anyone tell me what value I need to change to accomplish this? I changed a couple numbers, but didn't seem to have an affect. Also, is there a way to add a pause and play button so if the fading picture bothers someone, they can pause it?
[Code]...
View 3 Replies
View Related
Feb 2, 2010
Suppose I want to populate a drop down ajaxly. The population is written like:
var $select = $("#target");
$.each(datas, function(){
$("<option/>")
.val(thia.value).html(this.name)
.appendTo($select)
.data('srcData', this);
});
But the speed is considerably slow when the datas is large. I know that I can use just string concatenation and html() finally to speed it up but what can I do with the data()?
View 10 Replies
View Related
Jul 28, 2009
I'm trying to create a button that will increase and decrease the var speed variable
ex:
View 2 Replies
View Related
Nov 12, 2010
I'm justing wondering about the behavior of JS in regards to adding elements, suppose I have something like this:
I'm just wondering at the point I hit that "// DO SOMETHING WITH ONE OF THESE DIVS", are all the divs I have added in the DOM available to access?
I ask because I have some code at work in which a tester is reporting an error that happens which I can't reproduce, and they and others have had it a few times.
The only way I can explain it in my mind is if the div is not available to me at the time of execution. So I'm just looking to rule it out or confirm my hunch.
Is document.getElementById("myDiv").appendChild(obj); synchronous and the next line of code wont execute until the DOM is ready or is it in fact a asynchronous call and therefore adding alot of elements to the DOM could result in a lag so some divs or not available straight away.
View 1 Replies
View Related
Nov 17, 2010
In the home page (index.html) i have a flash intro. The first time a user sees the website, the intro should play. Once he goes to another page (about_us or contact_us) and comes back to the home page, it should show a different swf (the version without the intro) - i have created two swf files. I need to know how to change them when the user has already seen the intro or was in the home page before. When i googled, i found something on cookies. I have no clue on how to set them and change the swf file.
View 1 Replies
View Related
Jan 27, 2011
I have a JS file on site A which reads a few parameters from a short text file on site B. The call is made through code...
Any ideas on how to speed this up, either by bypassing DNS (but without exposing username) or by offering another way of reading data across sites?
View 2 Replies
View Related