During development of Bing Maps, I've come across a problem when reading in an XML file and plotting a ploygon. The code works fine on IE, but FireFox is giving me the following error message: Error: xNodes[i].getAttribute is not a function
The function in its entirety is copied below and the problem line is marked in red. Hoping that someone may have come across this problem?
I'm trying to get the value of an object's property. getAttribute returns "null" even though I'm sure the property is set. I can easily set the property, and in my actual script I do so dynamically. I just want to read the property and can't.
To help explain my problem, I've attached an example .html file as a .txt file.
The critical part of the code is this section that is based on "textbook" examples of how to get an attribute:
<script type="text/javascript"> function showcolor() { var myobject = document.getElementById("lab"); var myproperty = myobject.getAttribute("color");
alert(myproperty); } </script>
This is called via a button on the bottom of the page. The DIV object with the ID "lab" exists and has a color attribute defined in CSS, but I cannot read it, nor any other attribute, with a script. The alert displays "null".
It seems to be a problem with the getAttribute('style') portion of the code because if I change the request to getAttribute('id') it executes properly....
I am trying to get a url attribute from an xml node: <item> <media url="http://blablabla.com" /> </item>
I can do this in IE with the following code: var newDom = xmlhttp.responseXML; var x = newDom.getElementsByTagName("item"); var urlNode = x[0].getElementsByTagName('media'); var myUrl = urlNode[0].getAttribute('url');
If I try this code in FireFox it gives me the following error:
urlNode[0] has no properties referring to this line : myUrl = urlNode[0].getAttribute('url');
I am trying to get my script working in FF, IE and Opera but the getAttribute isn't working for me. The domain name isn't getting picked up I have tried this:
I'm working on a slider script and it would be just lovely to be able to specify the slider's width in a width attribute on the input that represents it. In the code below, getAttribute("width") is returning 0 in IE, but seems to work fine in firefox. . . .
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript"> var curr_slide=""; var ie = (document.all && !window.opera)?1:0; if (!ie) document.captureEvents(Event.MOUSEMOVE) var tempX = 0 var tempY = 0 var slide_width=200; window.onload=function() { buildSlider(); } function buildSlider() { var sliders=getElementsByClassName(document,'input','slider'); var len=sliders.length; for(var i=0;i<len;i++) { var div=document.createElement('div'); div.className='slider_house' alert(sliders[i].getAttribute('width')); if(sliders[i].getAttribute('width')) { slide_width=sliders[i].getAttribute('width')*1; } div.style.width=(slide_width+10)*1+'px' var handle=document.createElement('div'); handle.className='handle' handle.style.left=Ɔpx' handle.onmousedown=function() { curr_slide=this; document.onmousemove=function(e) { getMouseXY(e); } document.onmouseup=function() { document.onmousemove=""; } } div.appendChild(handle); sliders[i].parentNode.insertBefore(div,sliders[i]); } } function getSlide(obj) { var s=obj.parentNode; var lft1=s.offsetLeft; var lft2=obj.offsetLeft; var num=(lft2-lft1)-1; if(ie) { num=num-10; } return num; } function getElementsByClassName(oElm, strTagName, strClassName){ var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName); var arrReturnElements = new Array(); strClassName = strClassName.replace(/-/g, "-"); var oRegExp = new RegExp("(^|s)" + strClassName + "(s|$)"); var oElement; for(var i=0; i<arrElements.length; i++){ oElement = arrElements[i]; if(oRegExp.test(oElement.className)){ arrReturnElements.push(oElement); } } return (arrReturnElements) } function getMouseXY(e) { if (ie) { tempX = event.clientX + document.body.scrollLeft tempY = event.clientY + document.body.scrollTop } else { tempX = e.pageX tempY = e.pageY } if(tempX < 0) { tempX = 0 } if(tempY < 0) { tempY = 0 } n_spot=tempX-curr_slide.parentNode.offsetLeft; var c_obj=curr_slide.parentNode.nextSibling;
within this page that has been created, there is an AJAX tree folder which calls another page to be loaded into a DIV by AJAX again. Code:
[Code]...
I don't know why it doesn't work because the page has been loaded with the JS file, but as soon as the link is added afterwards it doesn't work. I take it this is because it doesn't know where to find the JS, but how can I overcome this?
jquery provides ajaxStart() and ajaxStop() events. Those two events do not seem to be triggered if the ajax requests are made by Microsoft Ajax tool Kit (from ASP.Net code). Is there any way to bridge those two event models? If not currently possible, is there any future initiative or plan out there to make this happen?
i was using $.ajax method to get my ajax page on my main page,which is working great.But now if i have links in that ajax page then i can't open them in that same div,the links are opening in new window,but i want to open in same part,i tried google it and then found, i have to use iframe instead of div.how to do with only use jquery and div.
i have a series of <select> fields. The first one, via ajax(), generates a 2nd one, based on the first ones' data with the .change() method. there is then a 3rd <select> - who's data will depend on choice of the second one although step 1 works, and i can generate the 2nd one, i still can't generate the 3rd one.
when i test the script on its own, both the 2nd and 3rd <select> fields are fine - but not via the ajax, which leads me to believe that the .change() from the 2nd one, isnt triggering the ajax call - its not being picked up (even the 'hello' alert isnt working).
Am calling Webservice in one ajax post, In the success funtion am calling another another method in same webservice through another ajax post method. First ajax post is getting called and returning the string from the webservice method but the inner ajax call is not getting called. I have placed the code here.
Am trying to set up a very simple AJAX script for my website. The javascript i have in an external file which reads as below.
This works perfectly in firefox but IE doesn't display anything at all. No error messages, just a blank IE window. If you look at the IE source this html is all there it just won't show it! Code:
I was playing a little bit with a lot of ajax frameworks. I have even wrote one small by myself. But one thing still drives me crazy: Whenever I'm doing an ajax call I need to specify handler to handle data coming from a server script. That means that almost for every action I need two functions.
Since I'm still new to all of this I'd like to ask how can i achieve something like this:
function function_name(el) { var i_need_this = get_what_i_need(el.id); return _i_need_this; }
where get_what_i_need function is returning some information using ajax from a server.
I've noticed a strange behavior with Ajax in internet explorer. In my page I've four links, that call four different pages by using XMLHttpMethod. By entering for the first time in the page and selecting the various links, all work correctly (the 4 pages are called and displayed into the page), but if I click again on a link previously clicked, trying to repeat the call, the responseText won't to appear!
I'm new in javascript and ajax and I need a IDE to write and debug my codes and I want it to be something like phpdesigner or dreamwawer that have snipper and suggest me when I write some of the code.
In particular, there is a pretty nifty little box effect that seems to be popping up all over the place these days. It would work perfectly for a project I am working on, but I have no idea how to go about doing it.
I found a joomla template over here that has just what I want. I don't use Joomla, I'm a wordpress boy, and I also don't really want to dig in there and rip it out. Could someone look at the template and possibly point me in a direction on finding something similar to that? Possibly something easy? Code:
I'm currently engaged on a dissertation which is investigating AJAX technologies and I was wondering if anyone had any references that might shed light on the subject?
I will of course carry out a literature review but in the mean-time has anyone any (preferably print based) sources of data on AJAX?
I am trying to call a servlet i created. Basically this servlet will let user create a new account at the server. I have created the function "CreateAccount()" but http_request.readyState always return me 0.
What is wrong with my code?
function CreateAccount() { if( window.XMLHttpRequest ) { http_request = new XMLHttpRequest(); } else if( window.ActiveXObject ) { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } var parameters = "username=" + encodeURI( document.getElementById("username").value ) + "&password=" + encodeURI( document.getElementById("password").value );