Array Functionality
May 14, 2003
An old script I recently found reasons to bring to life again...
/*
* Array Functionality
* script: array.js
* for: browsers not implementing the full array functionality of ECMA262-3
* by: liorean <http://liorean.web-graphics.com/>
* thanks to: beetle
*/
if(typeof Array.prototype.copy=='undefined')
Array.prototype.copy=function(a){
var
i=0,
b=[];
for(i;i<this.length;i++)
b[i]=(typeof this[i].copy!='undefined')?
this[i].copy():
this[i];
return b
};
if(typeof Array.prototype.concat=='undefined')
Array.prototype.concat=function(a){
var
i=0,
b=this.copy();
for(i;i<a.length;i++)
b[b.length]=a[i];
return b
};
if(typeof Array.prototype.pop=='undefined')
Array.prototype.pop=function(){
var
b=this[this.length-1];
this.length--;
return b
};
if(typeof Array.prototype.push=='undefined')
Array.prototype.push=function(){
var
i=0,
b=this.length,
a=arguments;
for(i;i<a.length;i++)
this[b+i]=a[i];
return this.length
};
if(typeof Array.prototype.shift=='undefined')
Array.prototype.shift=function(){
var
i=0,
b=this[0];
for(i;i<this.length-1;i++)
this[i]=this[i+1];
this.length--;
return b
};
if(typeof Array.prototype.slice=='undefined')
Array.prototype.slice=function(a,c){
var
i=0,
b,
d=[];
if(!c)
c=this.length;
if(c<0)
c=this.length+c;
if(a<0)
a=this.length-a;
if(c<a){
b=a;
a=c;
c=b
}
for(i;i<c-a;i++)
d[i]=this[a+i];
return d
};
if(typeof Array.prototype.splice=='undefined')
Array.prototype.splice=function(a,c){
var
i=0,
e=arguments,
d=this.copy(),
f=a;
if(!c)
c=this.length-a;
for(i;i<e.length-2;i++)
this[a+i]=e[i+2];
for(a;a<this.length-c;a++)
this[a+e.length-2]=d[a-c];
this.length-=c-e.length+2;
return d.slice(f,f+c)
};
if(typeof Array.prototype.unshift=='undefined')
Array.prototype.unshift=function(a){
var
b;
this.reverse();
b=this.push(a);
this.reverse();
return b
};
View 10 Replies
ADVERTISEMENT
Aug 30, 2010
I have an array like this:
I need to compare these array items to my site div id's and make an onblur functionality that changes the input field value.
It does not change the selected input field value(this.value). And it only alerts when blurring from the input field that is first in the array(id1). If i click to the input field id="id2" it does not alarm?
View 2 Replies
View Related
Aug 2, 2005
Could someone explain the discrepancies within and between the stated
definitions / usage of 'document.location' , 'document.URL' vs. their actual
functionality?
Should they be read-only when in fact they are not?
Is 'document.URL' also deprecated, and should therefore never be used?
What is the last word re: the proper syntax for returning and setting the
current window's location?
We have:
document.location
document.location.href
document.URL
window.location
window.location.href
location
location.href
The documentation:
View 9 Replies
View Related
Jul 25, 2007
I would like use a image button like a submit button in a form.
it is possible to do
i.e. (in the end of a form)
<a href="" onClick="funcSubmit()"><img src="../immagini/save.png"
alt="Save" /></a>ù
View 4 Replies
View Related
Jul 21, 2009
I'm trying to accomplish an accordion-like function, but instead of dropping down the section below, the content just lays over the other options.
For example, take a look at the Accordion example here: [url]
Notice how when section 2 is clicked, section 1 rolls up. I'm trying to achieve something where with section 1 open, the user would need to click on section 1 to close it and then could select section 2 which would overlay its content below, rather than pushing section 3 down.
Is there an option on accordion that I'm missing or can this be accomplished using another widget or plugin?
View 1 Replies
View Related
Aug 17, 2011
I want to make the add functionality in the jquery, where i can add successfully but i also want that when after add, my dialog closes, the div on parent should get refreshed and show me added entry, all is working but i have to reloadthe whole page to make it work
Here is my code!
So on close it should refresh my div or may be it should rerun my query to fetch final records from the db
Do not how, but how it will work!
Close the dialog this is where i tink needs some change, should it be edited enough that onclose it should refresh parent div and requery my query.
View 4 Replies
View Related
May 20, 2009
i want to remain on the same tab while while refreshing the page. while in my case whenever i am refresing the page its going to the first tabindex page...!!
View 1 Replies
View Related
Dec 21, 2010
[URL] Note check box in left vertical column, at top, encapsuled between a and b, click, click, click. That is what it should do. Open in IE, clicking same thing, nothing happens. The recipe for anything to happen is:
1. refresh
2. check the check box encapsuled between a and b
3. Click first checkbox to the right :eek:
Getting nowhere here, as far as I see IE reports no js errors.
View 2 Replies
View Related
Jul 9, 2010
I have image rollover code. And I want to add functionality, for ex-this scripts roll overs images (slides them). I would like let it stops when onmouseover event. Here is script
<html>
<head>
<title>HTML ders | 09.07.2010</title>
<script>
var sekil1=new Image();
sekil1.src="bir.jpg";
var sekil2=new Image();
sekil2.src="iki.jpg";
var sekil3=new Image();
sekil3.src="uc.jpg";
var sekil4=new Image();
sekil4.src="dord.jpg";
var sekil5=new Image();
sekil5.src="bes.jpg";
</script>
</head>
<body>
<img name="az" src="bir.jpg" width="250" height="200">
<script>
var addim=1;
function slide(){
if(!document.images)
return
document.images.az.src=eval("sekil"+addim+".src")
if(addim<5)
addim++
else
addim=1
setTimeout("slide()", 2500);
} slide();
</script>
</body>
</html>
View 4 Replies
View Related
Mar 7, 2009
can I get a list of the ActiveX Objects in Javascript . ???
I mean : I can do this : fso = new ActiveXObject("Scripting.FileSystemObject");
so I can use the fso object to do some FileSystem functionality
and I can do this :
var WshShell=new ActiveXObject("wscript.shell");
so I can do this
WshShell.run("D:\\vbnetskywalker.exe" + " " + "1");
[Code]...
View 2 Replies
View Related
Jul 20, 2005
We have to develop a small engine which the client uses. It supposed
to work like this. Our engine resides in a frame (frameA) which will
be loaded only once and it provides set of functions. The client can
call these functions. We inturn should get the values from the server
or set the values in the server and return with the values. The way we
are planning to implement is that we will have have another frame
(frameB hidden) and submit it whenever the client (frameClient) calls
our function and wait till the page reloads and return with the value
( set in the reloaded page by the server). The problem we face now is
that we don't have any sleep functionality in javascript ( being event
driven) and if we have a loop waiting for the reply, it will consume
the cpu cycles and the the frameB wont load.
View 3 Replies
View Related
Oct 22, 2009
I've been trying to find out if jQuery has any functionality that can help me with creating bbCode style buttons (ie, like on this forum, click B and a [ b ] tag appears, second time creates a closing, or if you have text highlighted, it wraps it). I've tried Google-ing a lot, and randomly found this forum.I found/modified code using standard javascript a while ago,but I'd like to find out if jQuery has any funcionality that can help, mostly to learn.
View 3 Replies
View Related
May 15, 2011
I m using a Jquery tab on my website and I want to disabe the mouseover funtionality. I was thinking it was just a case of removing the mouseover event from the javascript in the head of my code but; there is no mouse over event! that I can see, but the tabs are still changing on mouseover.
View 8 Replies
View Related
Dec 8, 2011
The CMS I use for my site currently runs/supports jQuery 1.7. The developers have chosen to leave the minified v1.2.6, v1.3.2, v1.4.2 files in the system too. I was wondering if any functionality was deleted over time from the lib. Does v1.7 contain all functionality from all older versions? Can I safely delete these older libs?
View 1 Replies
View Related
Jul 6, 2009
I want search functionality in the grid. I found one link but it is in php, but I don't know php. I want it in jsp. Here is the link: [URL] in this there is a take any example which contains search records it. One more link I got for grid but it does not have the functionality of searching another link: [URL].
View 4 Replies
View Related
Apr 28, 2009
I have an HTML page having a table and many columns.In that page i have to add new rows and cells dynamically. Adding new rows is working fine using inner HTML.But for particular textboxes i have two buttons namely "edit" and "save".the edit button will make the textbox editable and "save" button will make the textboxes in that row uneditable.Now my question is that as i am adding new rows using innerHTML how to add this functionality (making the textbox editable and uneditable) to the buttons that are dynamically created.
View 1 Replies
View Related
Nov 6, 2010
I have been using a tr onclick function in my tables to change the color of the most recently clicked row, it works fine. I have recently added sorttable [URL] to my table with the simple
<table class="sortable">
Making the table sortable has overwritten my tr onclick functions, which are now dead.
Heres a quick sample of what it looks like:
<table class="sortable">
<thead><th scope="col">Header 1</th>
<th scope="col">Header 2</th></thead>
<tr onclick="doSomething(this);"><td>Some data</td><td>Some more</td></tr>
</table>
View 4 Replies
View Related
Oct 26, 2005
I've got the following JS function that does a basic countdown to a specific date. I have a series of dates, and rather than change the date manually each time the previous one has passed, I'd like to automate it a bit and have it just read the date from an array, and use that date for the countdown. The check would be if the countdown'd date has already passed. Here's what I currently have:
<script language="javascript">
// date/countdown
function showDate () {
var now = new Date();
var date = now.getDate();
var month = now.getMonth() + 1;
var year = now.getYear();
currentDate = now.getMonth() + 1;
window.status = month + "/" + date + "/" + year + " thisdomain.com ";
var roundCDiv = document.getElementById('roundC');
var showDate = month + "/" + date + "/" + year;
//roundCDiv.innerHTML = showDate;
// countdown
var nextDateB = new Date("October 30, 2005");
var diffB = nextDateB.getTime() - now.getTime();
var daysLeftB = Math.ceil(diffB / (1000 * 60 * 60 * 24));
var roundBDiv = document.getElementById('countdown');
//roundBDiv.innerHTML = daysLeftB + " days until ...;
roundBDiv.innerHTML = daysLeftB;
roundBDiv.innerHTML = daysLeftB + " ";
}
</script>
View 1 Replies
View Related
Mar 12, 2009
I have a working gallery with side buttons to scroll through the images. My only problem is that I want the first image that shows up to be the image with the highest [number].jpg value so that when I add a picture to the gallery, the gallery will start on that picture.HTML:
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN"
"http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:www.w3.org/1999/xhtml">
[code]....
View 1 Replies
View Related
Mar 24, 2009
I am using jquery in my current application to add min/max functionality, i.e, when the user close at maximize, table gets maximized, when clicked on minimize, table gets minimized. It works fine functionality wise, but, ideally, when maximized, max image should replace with min image and vice-versa, but images gets replaced only when clicked 2nd time around, for very first time, images don't get replaced, though the system works fine,
Here's how I am calling the function:
<a href="javascript:void(0);" onclick="showinghide('contacting')"><img src="images/arrows/opened.gif" id="contactingarrow" class="myarrows"></a>
Here's the function:
function showinghide(oobj){
if(oobj=="contacting"){
jQuery("#contacting").toggle('slow');
mycookies("contacting");
}
And the jquery code is:
function mycookies(myobbj) {
var mycookiesvar=myobbj+"cook";
if(jQuery.cookie(mycookiesvar)){
if(jQuery.cookie(mycookiesvar)==myobbj+"hide"){
jQuery.cookie(mycookiesvar,null);
jQuery.cookie(mycookiesvar,myobbj+"show",{expires:365});
jQuery("#"+myobbj+"arrow").attr({'src':'images/arrows/open_bk.gif'})
} else if(jQuery.cookie(mycookiesvar)==myobbj+"show"){
jQuery.cookie(mycookiesvar,null);
jQuery.cookie(mycookiesvar,myobbj+"hide",{expires:365});
jQuery("#"+myobbj+"arrow").attr({'src':'images/arrows/close_bk.gif'})
}} else {
jQuery.cookie(mycookiesvar,myobbj+"hide",{expires:365});
}}
View 5 Replies
View Related
Jun 10, 2004
window.attachEvent doesn't work in Netscape 7.2 or other browsers, is there an alternative that can be used? I did some searching on the web but all I could find was how to use window.attachEvent, not what else could be substituted for it to work with other browsers (if anything)
View 24 Replies
View Related
Jan 28, 2011
I found a decent way to include a toggle feature for displaying detail rows underneath "parent" rows in a regular old HTML table displaying heaps of data: [url]
See "Expandable "Detail" Table Rows" rows section.
Would anyone know what it would take to add an "expand all/collapse all" link that would toggle all child rows open/hidden?
If so, how difficult would it be to have multiple tables with this functionality on the same html page?
View 10 Replies
View Related
Nov 1, 2011
I have successfully implemented the jquery cycle plugin, but on some machines we see poor performance. We are trying to implement the lite version and perform other optimizations in an effort to improve performance on older machines. Many functions of the cycle plugin we can go without, but one important feature is the ability to run a function once the cycle is finished. We accomplish this via "nowrap" and "end" without issue using the full plugin, but I believe these options to be missing from the lite as the function does not execute upon cycle end.
The first part of this topic is to determine (since there is no list of features available in the lite versus full) that the nowrap/end are not available in lite.If they are not available, we would like assistance in performing a simple function to redirect the user when the cycle ends. We are using the cycle plugin to create a "splash" page and we want the page to auto-redirect to the main page upon completion. The "end" function did this perfectly, so what options do we have to redirect the user without the "end" function?
View 1 Replies
View Related
Apr 9, 2011
I am attempting to build a page, however using some sample code the page have drag and drop functionality.
After using a simple jqeury statement to add to this form, every thing working (drag and drop)properly.
Now my actual requirement is
I need to generate the controls dynamically. Whne I generated all controls from server side and put all the generated controls HTML snipet in
<
div
id
="sort1"
class
="groupWrapper">
its working fine but when I try to put same HTML snippet in the same DIV using JavaScript drag and drop functionality not working;
Below is the code I am using.
Case when drag and drop functionality Not working.
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml">
[Code].....
View 2 Replies
View Related
Jul 22, 2009
I posted a while ago about the Truncate plugin not preserving html links in FF. I like the plugin, but it needs to present properly in FF. I couldn't figure it out and nobody responded. Is there any other plugins that provide similar funcationality?
View 2 Replies
View Related
Aug 4, 2010
I have implemented a tooltip type control in my site. Basically when a user rolls over an image with the class 'friend_pic', a div with the id "members_tooltip" pops up with more information about the source of the image and when the user rolls away from the image the div gets removed. The data is retrieved via an ajax post. The tooltip pops up down and to the right of the mouse pointer and there is also a function to move it as the mouse moves.
This sort of works but gets buggy if you roll around the image really quickly often the div's content will disappear but the empty div stays on the page. Here is how it is coded: //display a tooltip type popup with more information about a person when you hover over their pic
[Code]...
});Again it only happens when the mouse is moved really quickly, and the error is often the content of the tooltip being removed but the empty div remaining.
View 2 Replies
View Related