function overlay(e,num) {
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode;
targ.src = fdot[num].src;}
Overlay is called as an onmouseover event from an image's map AREA tag, sending event and a number. FF's JS Console spits out that fdot has no properties. Ideas? Better ways to do this effect (replace the image depending on which area of the imagemap is mousover'd)?
I know what attributes are. But I am stuck at the attribute property. So heres what i am trying to explain : I have form with an id "form0" . Its has some attributes. So i wrote this code, pasted in address bar while the form was loaded and hit enter: Code: javascript: (function klo() { var k = document.getElementById("form0"); alert(k.attributes); })();
And I got this in alert box : Code: [object NamedNodeMap] Now k in the above code is an array of attributes so basically I should be getting the array of attributes in alert box?
I know that I can get (eg) the href attribute via $('a').attr('href') BUT I would like to do the following :
get *all* the attribute names and values without knowing anything about the attribute names and values in advance (or even how many there are) - something like a loop and $('a').(attribute name, attribute value). I suppose they would best be placed in a JavaScript object as a set of name/value pairs eg { href: 'page.htm', id: 'foo', alt: 'alt text' }
I need a function that can return any elements attributes when clicked.
Mostly this is for getting link data. But there are a few elements in the Google Maps javascript api that I don't know what type of element they are.
Once I am able to get any clicked elements attributes, I will execute the data in ajax to log the data in my database. Once I have an idea of what needs to be and doesn't need to be tracked, I will apply filters accordingly.
I would like to grab the id attribute of every element with a specific class, and append the id names to a div.
Something a bit like:
// select everything with a class of widget, and pass all the ids to an array var idArray = $('.widget').attr('id').toArray(); // get each id in the array and seperate by a comma var idPrint = $.each(idArray, function(i, val) {
When you need for a certain element (say a text input box) to remember some data, what is the best way to do this? Can you extend the input box object with jquery? Right now i've been storing it in the rel tag $('#testInput').attr('rel','extrainfo') it just seems like there should be a better way to do this.
I'm developing a web-template editor for a client, and they want it to update the changes in real-time using javascript. So, in other words, when a person selects a different background image, I use:
document.body.style.backgroundImage="url("+bgimg+")"; Well, I've run into a little problem. I can't seem to find any manual on what comes after style.*
So far, I've seen style.color, style.backgroundImage, style.backgroundRepeat, style.backgroundColor. But, I'm looking for something that can control text-decoration, font-weight and a:hover
Does anyone no where I can find a list of all properties support after style.*?
I have a JavaScript file which Adds and Removes elements when you click a button.
Adding stuff is okay, but removing elements is more complicated.
When you add an element you also add id=x. Each time you add an element x goes up one. For example if I click "add element" 5 times it would be like this:
HTML Code:
If I wanted to remove the thrid element then I would want the following divs to replace it, for example it should look like this:
HTML Code:
I can't figure out how to do this, here is what I tried but it won't work
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.
I am trying to try jQuery 1.4.3 updated .data() method with HTML5 data attributes. The way I understood these changes is that an element with these attributes would automatically have their data populated by .data(). For example, if I have an element:
<ahref="#" data-cheese="cheddar">DataElement</a>
I can access this with .data('cheddar'). This part works fine. The issue I am having is that calling JUST data like $(this).data() just produces an empty object. Is this how it should be expected to function?
I've a graphic designer who wants to be able to see what he's styled and what he so far hasn't. So I'd like to write a script that will work in, say, FireFox, so that he can point FireFox at has websites and the script will loop through the page after its loaded and perhaps for each element do something like throw an alert() with the style rules. I can call the style() method on each element to get its rules, but how do I get every element?
I wrote a simple script to remove an element of an array but I don't think this is the best way to go about it. I have a list of about five elements seperated by ";"
I split the array using array.split(";") command and proceeded to update the elemment by assigning the null value to the arrayindex
array[index]=""
This of course assigns null to the element
But there are two problems
1. The array size is still five instead of 4 and my list is now seperated by "," with an exta "," to go.
Im trying to add to each element within an array. In this program I have an existing array which is called aScores. I have copied its contents into another array called aScores using slice. Now Im trying to add the value of variable called classCurve to each element of aCurve using a for loop (see under the Curve Scores functrion section). However, it does not seem to add the two together(e.g 78 + 5).
I'm fairly new to javascript. I have a code where I'm trying to generate scrollx1 through scrollx100. I can get the array to work with doc.write and I can get one concat variable to work in the element but when I combine them it doesn't work. Any suggestions as to what I need to add to this code:
var sp=1; for (sp=1;sp<=100;sp++) { var sx = "scrollx"; var sy = "scrolly";
when I capture the dispatch of the form and try to get the value of any of these file fields:
PHP Code:
There's a Javascript error saying that form.file is undefined. It's strange because I see in Firebug that "file" actually exists as a property of "form". The same happens if I get rid of the temporary variable "form" and I do it this way:
So, I eventually had to use the getElementById('image' + i) method in order to do what I wanted. But there must be a "natural" way to get a value from an array defined in a form.
I could use some help with a form I am trying to complete. If someone could PM me and I could attach the file. It's only a small problem but I am tired of spending hours trying to figure it out.
I need to geocode 100 addresses from google maps, but if I iterate an array with a simple for loop, google maps stop all my request with a "OVER_QUERY_LIMIT" because te request are too fast.
What I want to get is to send a single request to google maps every 5 seconds but I don't know how to iterate avery item of my array every 5 seconds.
When i click once on a button, i create one picture on the fly. And so on. It works ok. Then, using livequery, when i click on one of the all created pictures, i would like to see it removed. But it appears that only the first pic is removed (since all have the same name). What is my mistake ?
I want to loop through an array called "otherBox" using .each(), but I want to skip the element that is equal to the variable "box". When i run the code, it does work, but doesn't skip any elements. Here is my code:
i am having a problem understanding exactly how setInterval and setTimeout work and really need some I want to create an array and then print out each element one at a time at one second intervals.
I've only been able to come up with something like this, but it just prints the last value of the array after a second.
<script type = "text/javascript"> <!-- var myArray = new Array(); for (var i = 0; i < 11; i++){ myArray[i]=i+50;