Removing Possible Redundant Loads
Sep 12, 2007
I am using a neat postload script to load a bunch of images into the user's cache after the page has fully loaded, and I have a quick question
<script type="text/javascript">
//<![CDATA[
function postLoad(){
if(!window.name.match(/preLoad.complete/gi)){
var images = new Array('img/EnglishOn.gif',
'img/EnterOn.gif',
'img/EntrerOn.gif',
'img/FrenchOn.gif',
'img/butt_1_blank.gif',
'img/butt_1_red.gif');
var loader = new Array();
for(var i=0; i<images.length; i++){
loader[i] = new Image();
loader[i].src = images[i];
}
window.name = 'preLoad.complete'
}
}
//]]>
</script>
Can this script be modified to check whether an image has already been loaded, and if so, not reload it? I ask because I may have a long list of images and if the user navigates to another page I would like the script to not re-download X number of images Code:
View 7 Replies
ADVERTISEMENT
Sep 16, 2011
I read a lot of data from excel sheets into JS arrays.I have a situation where i have name, hours, product id and other few entries.
I have all these details as array in array concept.eg.
array.push(new Array(name,hours,pid,price,place))
Redundant entries that include same names,pid, places will be found in the array.My prob is to sum up all the hours of the records that belong to same name and product id and store the unique records in one array and ofcourse the hours column sumed up.
name pid hours place
----------------------
aaaa 11 100 chennai
aaaa 11 200 chennai
cccc 22 30 coimbatore
[code]....
View 2 Replies
View Related
Dec 29, 2010
Assume we have one button that fires ajax request, ajax call will talk 15 seconds to load the results. Assume the user clicked on that button first time and waited for 5 seconds, then he/she clicked again. In this case the page will be loaded two times. i.e. first time will be loaded and after finishing the first ajax request, the second one will start!
Is there any way to cancel the second ajax request(both first and second ajax calls come from first button) while having the first one in process? The problem, if the user clicks more than one time on the same button, then a queue of ajax calls will be executed and the user will wait for long to process all of them. So I need to cancel similar requests that come after first request.
View 9 Replies
View Related
Dec 1, 2010
I'm building a JavaScript-based calendar for a client that will require me to replace the page's HTML based on the user's input. For example, if the user clicks on a particular date, then the month/week calendar will be replaced with the day calendar. Needless to say, there are several event listeners involved. However, if I suddenly swap out the month calendar for a day calendar, does that mean that there are several event listeners in memory for elements that no longer exist? Or are those listeners destroyed when the elements are destroyed? Basically my question is, every time I swap out the HTML, do I have to detach all of the old events too?
View 3 Replies
View Related
Jun 5, 2010
i have situation that i need to remove table that is automaticly generated, but i also need to not remove contents of table.
<UL>
<table class="mytable" width="100">
<body>
[code]....
View 2 Replies
View Related
Dec 2, 2011
It seems like when I load javascript code into a page, that each item I add, such as an accordian vertical navbar, image slider, etc, that each time I add one, the page loads a second or so slower with each one added. I would like some of these features, but is this just a part of life, or are there tricks to avoid the slower load time? It is not major time but after the 2 items I mentioned, it added on about 2 seconds.
I read that $(document).ready(function() might slow me down but I do not see that statement in any of my .js files.
View 4 Replies
View Related
Aug 14, 2009
I am looking for something like when someone clicks on product list on templatemonster.com and the dive appears with check boxes and the sidebars moves and the page get focus on the that div;
what I am going to achieve is that when someone clicks on a button/link so that a div appears having a form and check boxes and the screen focus gets on it
View 1 Replies
View Related
Jul 23, 2005
I have an HTML file that has a call to a Javascript function in it as
follows:
<!-- bunch of stuff -->
<script type="text/javascript">doXMLFromString()</script>
<!-- bunch of stuff -->
Now I make a copy of this HTML file by creating a new window and writing
var body = document.body.innerHTML;
printWin.document.write (body);
But this copies the script tag above as well, and then tries to call
that JS function (doXMLFromString). I don't want it to do that.
In other words I dont want that javascript statement to be executed. I
tried removing it from the document (using removechild) however it would
still get called.
How can I stop this?
View 2 Replies
View Related
Jul 23, 2005
Just wondering there is any other way to remove the toolbar from the browser
than using
" ...toolbar=no ..."
in the
window.open(...)
is there a way to do it after the browser opened? (say some Java script)
are there any parameters or style like stuff that can be embedded in the
HTML code and does it when the new page created?
or is the above method the ONLY way?
View 8 Replies
View Related
Dec 26, 2005
I am weak when it comes to regexp but hoped someone might know in this case.
I am trying to take a url like this :
something.lasso?blah=blah&blah2=blah2&sort=hello&blah3=blah3
And remove the &sort=XXX without hurting the rest of the url. The parameter
to be replaced would be a parameter passed to a function. Here is what I
have so far:
function refresh(item) {
current = document.location.href;
if(current.match(item.name+'='))
//pseudo code here
//current.replace(item.name regexp , '');
return (current + "&" + item.name + "=" + item.value);
This function would be fired like this :
All <input type="radio" name="show" value="all"
onclick="document.location=refresh(this);">
Mine <input type="radio" name="show" value="mine"
onclick="document.location=refresh(this);">
View 13 Replies
View Related
May 24, 2006
I've been given a large number of HTML pages. Each page has one or more
tags. When the pages were being built I asked that an ID attribute be
included with each element that will later be referenced. The first
ID'ed element on the page has the ID 'item0', the next 'item1' and so on.
Unfortunately they also included a NAME element which in many cases is
similar to the ID but out by one. That is the first element on the page
has the NAME 'item1', the next 'item2' and so on.
This stuffs up some things that depend on the ID (IE seems to make use
of the NAME instead of the ID when I ask getElementByID). Is there an
"easy" way to remove all the NAME attributes, or at least make them
invisible to IE, on page load?
View 2 Replies
View Related
Apr 4, 2009
I'm having an issue in Internet Explorer to where the javascript i'm using isn't working now. In firefox it works great!
Code:
<script src="::URL::/jscript/php.js" type="text/javascript"></script>
<script language="Javascript">
function gup( name ) {
name = name.replace(/[[]/,"\[").replace(/[]]/,"\]");
[Code]....
I am using php.js from phpjs.org
You can see a live sample by visiting [URL]
View 1 Replies
View Related
Jan 4, 2011
My goal with a script I am writing is to remove signatures from a forum I am a part of. Some of the people abuse it with half a page of stuff and it's out of control. So here is what the HTML source code for it looks like
<table cellSpacing="1" width="100%" border="0" class="tback" cellPadding="2">
<tr>
<td width="100" class="headcell">Author</td>
<td class="headcell">Topic</td>
</tr>[CODE]...
The very bottom where it has the 'span' tag and it says "SEC Champions" is where the Signatures are located. I want to completely remove that using my script and this is what I have right now
function sigRemove() {
var sigs = document.getElementsByTagName('span');
for (var i = 0; i < sigs.length; i++) {
sigs[i].style.display = 'none';}}
I know it's incomplete but I only want to remove that bottom span tag and everything inside of it and not every span tag on the page.
View 8 Replies
View Related
Mar 21, 2004
I am retrieving a memo field from a db and using SS VB writing it to a JS function like so:
document.form.textarea.value = "<%=rs("Story")%>";
The problem I have is if the value of the recordset contains a CR, the function errs. How can I replace the CR with a /n or something similar that fixes this problem?
View 1 Replies
View Related
Mar 28, 2006
I have finally figured out how to make a call to an XML file using AJAX and then bringing it into the browser to manipulate with JavaScript. The only problem I'm having now is that I can't figure out how to remove the whitespaces between nodes so they won't show up as a childNode.
View 1 Replies
View Related
Jul 13, 2007
How do I remove the resulting comma from the output in this sort snippet?
<script type="text/javascript">
var arr = new Array()
arr[1] = "C"
arr[2] = "B"
arr[3] = "A"
document.write(arr.sort())
</script>
Gives me: A, B, C
Needed: A B C
View 1 Replies
View Related
Jun 19, 2010
I'm working on a Wordpress site and am using a photo gallery plugin. However, this plugin, for some reason, generates an empty table row and it's messing with my layout because I'm inserting a background image for each of the "TDs". I don't want to mess w/ the core files since the changes will be gone after the next upgrade. check out these two image links to see exactly what I mean.
[URL]
I know there are ways to dynamically remove elements using DOM. Would I be able to use that method here?
-edit- This gallery is paginated and I just noticed that on the last page, the last row actually contains two pictures and a " ". So, a better question would be: Is there a way to target just the td elements that have in them so I can add a display:none via css?
View 14 Replies
View Related
Nov 24, 2011
at the moment my code: new Date();
this displays:
Thur Nov 24 201115:28:53 GMT+0000 (GMT)
I only want it to say:
Thur Nov 24 201115:28:53
View 6 Replies
View Related
Mar 2, 2007
I was wondering if there any examples out there that create a Draggable ifram
that display another URL in it. In this iFRAME before loading the URL it
will display a progress bar once the url has loaded the progress bar will
disappear.
View 1 Replies
View Related
May 14, 2009
I have some code which toggles the content on the page. This works fine but I need the first div to be showing when the page loads and its tab to have a selected state.
<html>
<head>
<title></title>
<style type="text/css">
img {border:none;}
#tab-nav {
padding: 0px 0 0px 110px;
height:41px;
[Code]...
View 8 Replies
View Related
Jun 6, 2010
i have a javascript bookmark to log me onto my schools site[URL].. it works fine if the page is already open, but with using the link to open the page, it runs the remaning script before the page loads and it doesn't work. is there any way to fix this withou using setTimeout()
View 2 Replies
View Related
Sep 14, 2011
where a div slides onto the screen as soon as a page loads.
My client wants something like this: [URL] (without parallax or the fade-in) but I refuse to do it in Flash, obviously.
I have this gallery here: [URL] The div id is wrap.
View 13 Replies
View Related
Jun 10, 2010
I have a php code in a div. I'd like to cancel clicking on that div, until the page loads.
I'm having the problem if i click on the div too fast which calls a popup div... it doesn't get the content from the php.. so it is a blank popup div.
View 3 Replies
View Related
Feb 24, 2011
I have a script that reloads the page to get a PDF generated by PHP. I could have PHP send the file with a content disposition of 'attachment' and the browser will catch the file, open the save dialog, and general happiness follows.My boss wants the user to be unable to do anything while this is going on. Tired of arguing the point about the benefit of handling transactions asynchronously, is there a way for me to detect in the origin page when this attachment has arrived so that I can shut of any loading indicator I have running?
Any window events fired by this? I mean, when the browser gets the response and sees it is an attachment and not a page does an event get raised in the calling page?
View 4 Replies
View Related
Jul 19, 2010
Instead of using many external scripts and CSS files in the header, can I just load them all using Javascript? The easiest way that I can think of is using document.write.. to get all the external files.
View 5 Replies
View Related
Aug 20, 2010
How to execute function after div loads
heres my function, if div exists return "true", now how to use chkObject('div') do loop until return true?
Code:
function chkObject (theVal)
{
if (document.getElementById(theVal) != null)
{
[Code]....
View 7 Replies
View Related