I'm struggling with Javascript and the DOM. Can anyone help me with
the appropriate script to get the SVG <g> element and loop through the
<text> elements, changing the value of each "y" attribute as I go.
it has been a short time since i use jquery. I am now stuck on a problem with jquery- getting a xml node's all attributes as an array for example.. I have searched a lot on that with no luck Is there a way on getting all attributes of a node with jquery?
What I want to do is add an onclick event handler to row1 to insert a row after row1. I can't seem to find a way to do it though. After creating the new row node, I could try something like document.getElementById("row1").parentNode.appendChild(newNode) but that would add the new row to the bottom of the table. The insertBefore() method is the right idea but I want to insert the new row AFTER row1 and there doesn't seem to be an insertAfter() method.
I thought about navigating through the DOM tree to get the row after row1 and then using insertBefore() but the table is generated dynamically and there won't necessarily be a next row.
I've recently moved over from Protoype and was used to using the update() function to replace text within a node - something like this:
PROTOTYPE <p id='dText'>text to be replaced $('dText').update('New text string')
[code]....
Now it appears to me that in jQuery, there isn't an out of the box function to replace the contents of a node without also replacing the node too, hence the reason I am chaining remove() and append().
If there a way to have all title attributes become qtips? Right now I'm just going through and finding all the tags that need to be done but this is slow and not reliable.
I'm using a simple dom parser function to catch xpath information of all nodes of a document. Say html is like : HTML Code: <div> <div>Everyday People</div> <div>My name is ACE</div> <div>Hello world</div> </div>
And parsing the DOM to store the xpath infor in array 'arr' Code: <script type="text/javascript" src="js/jquery/js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery/js/xpath-selector.js"></script> <script type="text/javascript"> function get_XPath(elt) {var path = ''; for (; elt && elt.nodeType==1; elt=elt.parentNode) {var idx=$(elt.parentNode).children(elt.tagName).index(elt)+1; idx>1 ? (idx='['+idx+']') : (idx=''); path='/'+elt.tagName.toLowerCase()+idx+path; }return path; }var arr = Array(); htmlDoc=document; x=htmlDoc.documentElement.childNodes; for (i=0;i<x.length;i++){ arr.push(get_XPath(x[i])); } </script> And later on in the script using the values stored in 'arr' to perform some functions like showing,hiding or changing content of nodes.
Code: <script> for(i=0;i<arr.length;i++){ //catch the object reference with the xpath info $(arr[i]) } </script>
But in the snippet above,I'm getting a object but unable to I'm unable to get the object reference..and use it for something like $(arr[i]).text(); Any work on Jquery Xpath selectors?
I have a drop down menu that is populated by the following javascript:
Code: // Place holder var AS_Airport = [code]....
The drop down category is Heathrow Airport. When that is selected another drop loads the shortcuts (Terminal 1, Terminal 3 etc).what i would like to do is add another selection with another set of shortcuts to the above but am unsure how to do it.for example i have tried the following without success:
Code: // Place holder var AS_Airport = {[code]....
when i use the code above to try and add another group and set of values it doesn't add any of the groups. if someone could please let me know the correct way to add a group to the above i think it will work fine.
I'm trying to develop a module for an aplication and i'm basing on an example from the jquery ui dialog [URL] But i'm using radio buttons and a datepicker field but problems occur when i try to add a second row to the table. It just adds the date value but the "motivo" value don't. I mean everything works fine at the first attempt but at the next it fails.
Here is part of my code: $(function() { var fecha = $("#datepicker"), motivo = $("[name=motivo]"), allFields = $([]).add(fecha).add(motivo),
I'm a neophyte to Javascript, but I need it to dynamically add lines to a form. I was able to cobble together this inelegant looking code below. It adds the row when called, but there are more attributes needed for this to be correct for the application. 1) need to center the input in the TD 2)the input tags need type, size, maxsize, and value attributes added I have not been able to figure out the correct way to do this.
Also, is there a way for the value attribute to work with a PHP echo, or is there a Javascript method to display associative array values?
[Code]...
BTW is there an good online tutorial and/or reference for javascript or book(s) that you could recommend?
I'm trying to read a select(dropdown) box from an HTML form along with all its options. My core requirement is to be able to read a select element with all its option and store it in some variable/node using one JS function. Use another JS function to pick the node and convert the values from node back to the options of select box.
We can probably make use of jQuery as well, provided it is supported by IE6.
In a string (that contain the Flash version installed), I want to replace:
all "," by "." "win" by <nothing> all spaces by <nothing> So far I do it this way: strFlashVer = strFlashVer.replace(/,/g, '.'); strFlashVer = strFlashVer.replace('win', ''); strFlashVer = strFlashVer.replace(/ /g, '');
but I'm sure theres better way (I'm not really good with reg exp).
I'm a relative novice at java script. I've been working on a google map that can be found at: [URL](way too much code to post here). Each of the makers on the map has s particular set of information that pops up in a window when it is clicked, including a hyperlink called "join this group." Right now clicking on that link merely takes the user to the form at the bottom of the page.
What I would like the link to do is to both take the user to form at the bottom of the page and automatically select from the drop down menu the group associated with that particular "join this group" link. For example, if a user selected the marker representing the Neighborhood, Beverly group and then hit the join this group link, the drop down menu would automatically select the Neighborhood, Beverly (Pless) for them. I suspect this involves using java script to pass a value. I just have had no luck getting it to work.
I have searched the web and this forumn with no results. I need to replace the value in a second select menu with the value from the firts select menu. So if I select ACD from the first menu it should go thru all the option values in menu 2 and replace the '~' with 'Computing'
I have a radio group that, when a certain option is selected, it makes the radio group disappear and a textbox appear. It works great in Firefox, but it appears to be glitchy in IE.
<script type="text/javascript"> function showRestaurantTextBox() {
I am not able to get Child Node values from "DIV" using JavaScript. I wrote the programme like, using div id i added the child nodes to that div. probleme is i am not able to get node values from that div and i am not able to control duplication while adding child nodes to div.
I'm trying retrieve the value of a radio group, which ever button is selected I need to assign a value to a var. I can't seem to get this right, I'm not even sure if I'm going about this the right way. Here's my code.
//the alert is just to see If I'm getting a value to start with. function validateOrder() { for (var i=0; i<document.getElementById('Size_rg').length; i++) { if (document.getElementById('Size_rg')[i].checked) { return i; alert(i + 'you got a value'); }}}
I'm sure this is probably the wrong place to ask, but is there a way to execute an SSI script in javascript?
I'm using an SSI script to read a memory address, and I'd like to be able to update the value every few seconds without having to refresh the entire page. Does anyone know a possible way to do this, or am I stuck with refreshing the entire page every 4 seconds?
i have a list of 10 radio buttons all with the same ID=R100 i need a javascript to select (checked) say the 4th radio button AFTER the form is created.
I use this function to find the value of a radio group:
function valButton(btn) { var cnt = -1; for (var i=btn.length-1; i -1; i--) { if (btn[i].checked) {cnt = i; i = -1;} } if (cnt -1) return btn[cnt].value; else return null; }
I however found an incompatibility with Internet Explorer, when the radio group name contains brackets. For example, the radio group name is 񟡂[a]'. The Ms Script Debugger stops on btn.length, saying that it is null or not an object. You may also want to know that it works well in Firefox and Safari.
Does anyone knows any way I can get IE to digest this? Do you know another way to acquire radio group value?
I would like to group some function in Jquery, I have this code: $(document).ready(function() { $('#menu1').hide('fast'); $('#menu2').hide('fast'); $('#menu3').hide('fast'); $('#menu4').hide('fast'); return false; );
I would like to group all of this loke that: $('#menu*').hide('fast');