Search Results

Search found 602 results on 25 pages for 'getelementsbytagname'.

Page 1/25 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Javascript getElementsByTagName broken firefox?

    - by Sheldon Ross
    I'm getting the weirdest issues with Javascript in Firefox today. I'm trying to manipulate some table rows, but .getElementsByTagName("tr"); is pulling back junk. dynamicTable.tableBody = dynamicTable.getElementsByTagName("tbody")[0]; var tableRows = dynamicTable.tableBody.getElementsByTagName("TR"); var actualTableRows = new Array(); for(var i in tableRows) { var row = tableRows[i]; alert(row.tagName); if(row.tagName == "TR"){ actualTableRows.push(row); } } dynamicTable.bodyRows = actualTableRows; The puzzling part of course is my temporary hack to fix the error. For some reason .getElementsByTagName("tr") is pulling back some functions also. Incidently the alert above goes something like this TR TR TR TR undefined undefined undefined. The code I wanted was something like this dynamicTable.bodyRows = dynamicTable.tableBody.getElementsByTagName("tr"); But then bodyrows does not contain just tr elements it has the aforementioned junk in it. Any thoughts?

    Read the article

  • PHP DOMDocument getElementsByTagname??

    - by FFish
    This is driving me bonkers... I just want to add another img node. $xml = <<<XML <?xml version="1.0" encoding="UTF-8"?> <gallery> <album tnPath="tn/" lgPath="imm/" fsPath="iml/" > <img src="004.jpg" caption="4th caption" /> <img src="005.jpg" caption="5th caption" /> <img src="006.jpg" caption="6th caption" /> </album> </gallery> XML; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($xml); $album = $xmlDoc->getElementsByTagname('album')[0]; // Parse error: syntax error, unexpected '[' in /Applications/XAMPP/xamppfiles/htdocs/admin/tests/DOMDoc.php on line 17 $album = $xmlDoc->getElementsByTagname('album'); // Fatal error: Call to undefined method DOMNodeList::appendChild() in /Applications/XAMPP/xamppfiles/htdocs/admin/tests/DOMDoc.php on line 19 $newImg = $xmlDoc->createElement("img"); $album->appendChild($newImg); print $xmlDoc->saveXML(); Error:

    Read the article

  • Using variable for tag in getElementsByTagName() for PHP and XML?

    - by Jared
    See my PHP: $file = "routingConfig.xml"; global $doc; $doc = new DOMDocument(); $doc->load( $file ); $ElTag = "Route"; $tag = $doc->getElementsByTagName($ElTag); XML is: <Routes> <Route></Route> <Route></Route> <Routes> Error returned is: Fatal error: Call to a member function getElementsByTagName() on a non-object I'm not sure how to do this?

    Read the article

  • Parsing XML in Javascript getElementsByTagName not working

    - by Probocop
    Hi, I am trying to parse the following XML with javascript: <?xml version='1.0' encoding='UTF-8'?> <ResultSet> <Result> <URL>www.asd.com</URL> <Value>10500</Value> </Result> </ResultSet> The XML is generated by a PHP script to get how many pages are indexed in Bing. My javascript function is as follows: function bingIndexedPages() { ws_url = "http://archreport.epiphanydev2.co.uk/worker.php?query=bingindexed&domain="+$('#hidden_the_domain').val(); $.ajax({ type: "GET", url: ws_url, dataType: "xml", success: function(xmlIn){ alert('success'); result = xmlIn.getElementsByTagName("Result"); $('#tb_actualvsindexedbing_indexed').val($(result.getElementsByTagName("Value")).text()); $('#img_actualvsindexedbing_worked').attr("src","/images/worked.jpg"); }, error: function() {$('#img_actualvsindexedbing_worked').attr("src","/images/failed.jpg");} }); } The problem I'm having is firebug is saying: 'result.getElementsByTagName is not a function' Can you see what is going wrong? Thanks

    Read the article

  • getElementsByTagName returns 0-length list when called from didFinishLoad delegate

    - by Emerick Rogul
    I'm using the Chromium port of WebKit on Windows and I'm trying to retrieve a list of all of the images in my document. I figured the best way to do this was to implement WebKit::WebFrameClient::didFinishLoading like so: WebNodeList list = document->getElementsByTagName(L"img"); for (size_t i = 0; i < list.length(); ++i) { // Manipulate images here... } However, when this delegate fires, list.length() returns 0. The only times I've seen it return a list of non-zero length is when I substitute "body" or "head" for "img". Strangely enough, if I call getElementsByTagName(L"img") outside of the delegate, it works correctly. I'm guessing that the DOM isn't fully loaded when didFinishLoading is called, but that would seem to contradict the delegate's name. Does anyone know what I may be missing here?

    Read the article

  • Chrome extension:Cannot call method 'getElementsByTagName' of null

    - by T_t
    Hi,i am beginner with chrome extension.There is simple problem. There is the code in my extension,but it do not work.I don't know how to figure it out. In my extension, i used a xml file to stroe some data.There is the code in my background.html,but it do not work,i don't know how to figure it out... <!DOCTYPE html> <html> <head> </head> <body> <script> function loadXmlFile(){ var xmlDom = null; var xmlhttp = new XMLHttpRequest(); if( xmlhttp ){ xmlhttp.onreadystatechange = function(){ if( xmlhttp.readyState == 4 ){ if( xmlhttp.status == 200 ){ xmlDom = xmlhttp.responseXML; } } } xmlhttp.open( "GET",chrome.extension.getURL("/xml/123.xml"),true); xmlhttp.send( null ); } return xmlDom; } var xmlDom = loadXmlFile(); var s = xmlDom.getElementsByTagName( "to" ); alert( s[0].nodeType ); </script> </body> </html> I used developer tools to debug,but it says " Cannot call method 'getElementsByTagName' of null"... who can help me?

    Read the article

  • convert xml.documentElement.getElementsByTagName("marker")[index].getAttribute(temp) to string in ja

    - by user324884
    I am parsing xml file in javascript and after that want to cancatenate all the the data into string. but failing to do the same and it is returning undefined. GDownloadUrl("./include/dataemp2.xml", function(data) { var xml = GXml.parse(data); markers = xml.documentElement.getElementsByTagName("marker"); for(var t=0;t<18;t++) { var temp= markers[index].getAttribute("address"); html = html + temp; } }); it is returning as undefined because temp is not concatenating in "html"; whereas when i do this like html = html +markers[index].getAttribute("address"); it is giving me expected output;

    Read the article

  • getElementsByTagName problem in chrome and safari

    - by Ilian Iliev
    I`m parsing a Google Maps RSS with javascript and using the following code to get the point coordinates: point_coords = items.getElementsByTagName('georss:point') Unfortunately it works in FF but not in safari and chrome (still not tested in Opera and IE) The XML looks like: <item> <guid isPermaLink="false">guidNo</guid> <pubDate>Mon, 23 Mar 2009 20:16:41 +0000</pubDate> <title>title text</title> <description><![CDATA[text]]></description> <author>UniCreditBulbank</author> <georss:point> 42.732342 23.296659 </georss:point> </item>

    Read the article

  • getElementsByTagName() equivalent for textNodes

    - by levik
    Is there any way to get the collection of all textNode objects within a document? getElementsByTagName() works great for Elements, but textNodes are not Elements. Update: I realize this can be accomplished by walking the DOM - as many below suggest. I know how to write a DOM-walker function that looks at every node in the document. I was hoping there was some browser-native way to do it. After all it's a little strange that I can get all the <input>s with a single built-in call, but not all textNodes.

    Read the article

  • "Null" is null or not an object error in IE javascript

    - by user89691
    The following code executes fine in Firefox and Chrome, but gives an error: 'null' is null or not an object when executed in Internet Explorer. if (xmlhttp.responseXML != null) { var xmlDoc = xmlhttp.responseXML.documentElement ; var ResultNodes = xmlDoc.getElementsByTagName ("Result") ; <---- error here if (ResultNodes != null) { (I would have thought the line after the one indicated would be more likely to return the error but the debugger says the run-time error is at the line indicated) Any ideas why?

    Read the article

  • "Null" is null or not an object error in IE javascript

    - by rossmcm
    The following code executes fine in Firefox and Chrome, but gives an error: 'null' is null or not an object when executed in Internet Explorer. if (xmlhttp.responseXML != null) { var xmlDoc = xmlhttp.responseXML.documentElement ; var ResultNodes = xmlDoc.getElementsByTagName ("Result") ; <---- error here if (ResultNodes != null) { (I would have thought the line after the one indicated would be more likely to return the error but the debugger says the run-time error is at the line indicated) Any ideas why?

    Read the article

  • Javascript function variables being validated before function called by Internet Explorer

    - by CodingIsAwesome
    When my page loads it calls the function like below: <body onLoad='changeTDNodes()'> And the code it calls is below: function applyThresholds(myvalue, mycell) { var threshold = 10; if (myvalue.innerHTML >= threshold) { //mycell.style.setAttribute('cssText','font-size:x-large;'); mycell.setAttribute('bgColor','red'); } else { mycell.setAttribute('bgColor','green'); } } function changeTDNodes() { // there can be many 'td' elements; just return the nth element var RepairVideo_cell_value = document.getElementsByTagName('B')[21]; var RepairVideo_cell = document.getElementsByTagName('td')[16]; var PPV_cell_value = document.getElementsByTagName('B')[6]; var PPV_cell = document.getElementsByTagName('td')[1]; var LeadRepair_cell_value = document.getElementsByTagName('B')[11]; var LeadRepair_cell = document.getElementsByTagName('td')[6]; var LeadTier_cell_value = document.getElementsByTagName('B')[16]; var LeadTier_cell = document.getElementsByTagName('td')[11]; var CHSI_cell_value = document.getElementsByTagName('B')[26]; var CHSI_cell = document.getElementsByTagName('td')[21]; var HN_cell_value = document.getElementsByTagName('B')[31]; var HN_cell = document.getElementsByTagName('td')[26]; var CDV_cell_value = document.getElementsByTagName('B')[36]; var CDV_cell = document.getElementsByTagName('td')[31]; var CommOps_cell_value = document.getElementsByTagName('B')[42]; var CommOps_cell = document.getElementsByTagName('td')[36]; applyThresholds(PPV_cell_value, PPV_cell); applyThresholds(LeadRepair_cell_value, LeadRepair_cell); applyThresholds(LeadTier_cell_value, LeadTier_cell); applyThresholds(RepairVideo_cell_value, RepairVideo_cell); applyThresholds(CHSI_cell_value, CHSI_cell); applyThresholds(HN_cell_value, HN_cell); applyThresholds(CDV_cell_value, CDV_cell); applyThresholds(CommOps_cell_value, CommOps_cell); } Although the code executes succssfully, in the bottom corner of internet explorer the error shows as: Line: 12 Char: 1 Error: 'innerHTML' is null or not an object Code: 0 Yet if I move the applyThresholds function below the changeTDNodes function, the changeTDNodes functions complains that there is no such thing as the applyThresholds function. What am I doing wrong here? Thanks for all your help!

    Read the article

  • Changing content using innerHTML with a non-standard element in Internet Explorer

    - by Gus
    I have the non-standard element <testele></testele> In every browser except IE, this bit of JavaScript will successfully change the content of the above element document.getElementsByTagName("testele")[0].innerHTML = 'hi'; However, if I change the <testele> to just a <span> (in the HTML and the JavaScript), it now successfully changes the content of the element in every browser, including IE. Is there any fix? I have searched around and tried a bunch to no avail.

    Read the article

  • Why can't I add an event to each element in a collection that refers to Itself rather than the last

    - by user311403
    On Window's load, every DD element inside Quote_App should have an onCLick event appended that triggers the function Lorem, however, Lorem returns the nodeName and Id of the last element in the For statement rather than that of the element that trigged the function. I would want Lorem to return the nodeName and Id of the element that triggered the function. .js function Lorem(Control){ /* this.Control=Control; */ this.Amet=function(){ return Control.nodeName+"\n"+Control.id; }; }; function Event(Mode,Function,Event,Element,Capture_or_Bubble){ if(Mode.toLowerCase()!="remove"){ if(Element.addEventListener){ if(!Capture_or_Bubble){ Capture_or_Bubble=false; }else{ if(Capture_or_Bubble.toLowerCase()!="true"){ Capture_or_Bubble=false; }else{ Capture_or_Bubble=true; }; }; Element.addEventListener(Event,Function,Capture_or_Bubble); }else{ Element.attachEvent("on"+Event,Function); }; }; }; function Controls(){ var Controls=document.getElementById("Quote_App").getElementsByTagName("dd"); for(var i=0;i Currently you click on any DD element Lorem always returns the nodeName and Id of the last DD element. Lorem should return the nodeName and Id of the Control (Control[i]) that triggered Lorem. How do I go about making this happen? Thank you!

    Read the article

  • PHP DOMElement::getElementsByTagName - Anyway to get just the immediate matching children?

    - by rr
    Hi All, is there a way to retrieve only the immediate children found by a call to DOMElement::getElementsByTagName? For example, I have an XML document that has a category element. That category element has sub category elements (which have the same structure), like: <category> <id>1</id> <name>Top Level Category Name</name> <subCategory> <id>2</id> <name>Sub Category Name</name> </subCategory> ... </category> If I have a DOMElement representing the top level category, $topLevelCategoryElement->getElementsByTagName('id'); will return a list with the nodes for all 'id' elements, where I want just the one from the top level. Any way to do this outside of using XPath?

    Read the article

  • Javascript works great locally, but not on my server

    - by Jonathan Cohen
    I'm teaching myself javascript by creating a script for displaying an external rss feed on a webpage. The code I patched together works great locally. This is a screen grab of the code producing exactly the desired behavior. The code is populating all the information inside the section "Blog: Shades of Gray", except for "tagged" which I hard coded: But when I upload the site files to my server, the code doesn't work at all. This is a screen grab of the code on my site NOT producing the desired behavior... This feels like I'm not getting something really basic about how javascript works locally vs. on the server. I did my half hour of googling for an answer and no trails look promising. So I'd really appreciate your help. This is my site (under construction) http://jonathangcohen.com Below is the code, which can also be found at http://jonathangcohen.com/grabFeeds.js. /*Javascript for Displaying an External RSS Feed on a Webpage Wrote some code that’ll grab attributes from an rss feed and assign IDs for displaying on a webpage. The code references my Tumblr blog but it’ll extend to any RSS feed.*/ window.onload = writeRSS; function writeRSS(){ writeBlog(); } function writeBlog(){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET","http://blog.jonathangcohen.com/rss.xml",false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("item"); //append category to link for (i=0;i<3;i++) { if (i == 0){ //print category var blogTumblrCategory = x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue document.getElementById("getBlogCategory1").innerHTML = '<a class="BlogTitleLinkStyle" href="http://blog.jonathangcohen.com/tagged/'+blogTumblrCategory+'">'+blogTumblrCategory+'</a>'; //print date var k = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue thisDate = new Date(); thisDate = formatTumblrDate(k); document.getElementById("getBlogPublishDate1").innerHTML = thisDate; //print title var blogTumblrTitle = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue var blogTumblrLink = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue document.getElementById("getBlogTitle1").innerHTML = '<a class="BlogTitleLinkStyle" href="'+blogTumblrLink+'">'+blogTumblrTitle+'</a>'; } if (i == 1){ //print category var blogTumblrCategory = x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue document.getElementById("getBlogCategory2").innerHTML = '<a class="BlogTitleLinkStyle" href="http://blog.jonathangcohen.com/tagged/'+blogTumblrCategory+'">'+blogTumblrCategory+'</a>'; //print date var k = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue thisDate = new Date(); thisDate = formatTumblrDate(k); document.getElementById("getBlogPublishDate2").innerHTML = thisDate; //print title var blogTumblrTitle = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue var blogTumblrLink = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue document.getElementById("getBlogTitle2").innerHTML = '<a class="BlogTitleLinkStyle" href="'+blogTumblrLink+'">'+blogTumblrTitle+'</a>'; } if (i == 2){ //print category var blogTumblrCategory = x[i].getElementsByTagName("category")[0].childNodes[0].nodeValue document.getElementById("getBlogCategory3").innerHTML = '<a class="BlogTitleLinkStyle" href="http://blog.jonathangcohen.com/tagged/'+blogTumblrCategory+'">'+blogTumblrCategory+'</a>'; //print date var k = x[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue thisDate = new Date(); thisDate = formatTumblrDate(k); document.getElementById("getBlogPublishDate3").innerHTML = thisDate; //print title var blogTumblrTitle = x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue var blogTumblrLink = x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue document.getElementById("getBlogTitle3").innerHTML = '<a class="BlogTitleLinkStyle" href="'+blogTumblrLink+'">'+blogTumblrTitle+'</a>'; } } } function formatTumblrDate(k){ d = new Date(k); var curr_date = d.getDate(); var curr_month = d.getMonth(); curr_month++; var curr_year = d.getFullYear(); printDate = (curr_month + "/" + curr_date + "/" + curr_year); return printDate; } Thank you!

    Read the article

  • IE's responseXML.getElementsByTagName() unable to handle non English character ?

    - by trix
    I have a javascript that does this (http is your XMLHttpRequest object) var r = http.responseXML.getElementsByTagName('item'); The issue is variable r is always an empty list if the response contains non-English character (r.length is 0). The response header is correctly set Content-Type: text/xml;charset=ISO-8859-1 This is what the response from the webserver looks like <?xml version='1.0' encoding='UTF-8'?> <d> <r> <item value="jmob" label="John Möb"/> </r> </d> It happens only in IE (both IE6 and IE8), works in Firefox and Chrome. If items contain only English characters, it works fine. Is there a workaround for this ?

    Read the article

  • Intermittent Internet Explorer Error whilst using Javascript to traverse XML Nodes

    - by Sykth
    Hi there all, Basically I use a javascript SOAP plugin to send and receive XML from a web service. Recently I've been experiencing intermittment (1 in every 20-30 times) errors in IE when trying to access data in the XML file. Bear with me on this, I'm going to try and go into a fair amount of detail to help anyone who is willing to read this: I have a html file, with an external javascript file attached. In the javascript file I include 5 global variables: var soapRes; var questionXML; var xRoot; var assessnode; var edStage = 0; Once the html file is at a readystate I request the XML file from the web service like this: function initNextStage(strA) { // Set pl Parameters here var pl = new SOAPClientParameters(); // soap call var r = SOAPClient.invoke(url, "LoadAssessment", pl, true, initStage_callBack); } function initStage_callBack(r, soapResponse) { soapRes = soapResponse; initvalues(); function initvalues(){ xRoot = soapRes.documentElement; assessnode = xRoot.getElementsByTagName("ed")[0]; questionXML = assessnode.getElementsByTagName("question")[edStage]; } } Once this is completed the XML should be loaded into memory via the global variable soapRes. I then save values to the XML before moving one node down the XML tree, and pulling the next set of values out of it. function submitAns1() { var objAns; var corElem; var corElemTxt; questionXML = assessnode.getElementsByTagName("question")[edStage]; objAns = questionXML.getElementsByTagName("item")[0].getAttribute("answer"); corElem = soapRes.createElement("correct"); corElemTxt = soapRes.createTextNode("value"); questionXML.appendChild(corElem); corElem.appendChild(corElemTxt); if(objAns == "t") { corElemTxt.nodeValue = "true"; } else { corElemTxt.nodeValue = "false"; } edStage++; questionXML = assessnode.getElementsByTagName("question")[edStage]; var inc1 = questionXML.getElementsByTagName("sentence")[0]; var inc2 = questionXML.getElementsByTagName("sentence")[1]; var edopt1 = questionXML.getElementsByTagName("item")[0]; var edopt2 = questionXML.getElementsByTagName("item")[1]; var edopt3 = questionXML.getElementsByTagName("item")[2]; var edopt4 = questionXML.getElementsByTagName("item")[3]; var edopt5 = questionXML.getElementsByTagName("item")[4]; var temp1 = edopt1.childNodes[0].nodeValue; var temp2 = edopt2.childNodes[0].nodeValue; var temp3 = edopt3.childNodes[0].nodeValue; var temp4 = edopt4.childNodes[0].nodeValue; var temp5 = edopt5.childNodes[0].nodeValue; } This is an example of our XML: <ed> <appid>Administrator</appid> <formid>ED009</formid> <question id="1"> <sentence id="1">[email protected]</sentence> <sentence id="2">[email protected]</sentence> <item id="0" answer="f" value="0">0</item> <item id="1" answer="f" value="1">1</item> <item id="2" answer="f" value="2">2</item> <item id="3" answer="t" value="3">3</item> <item id="4" answer="f" value="4">4</item> </question> <question id="2"> <sentence id="1">Beausdene 13</sentence> <sentence id="2">Beauscene 83</sentence> <item id="0" answer="f" value="0">0</item> <item id="1" answer="f" value="1">1</item> <item id="2" answer="t" value="2">2</item> <item id="3" answer="f" value="3">3</item> <item id="4" answer="f" value="4">4</item> </question> </ed> The error I receive intermittently is that "questionXML" is null or not an object. Specifically this line when I call on the submitAns1() method: questionXML = assessnode.getElementsByTagName("question")[edStage]; This solution works on FF, Opera, Chrome & Safari without any issues as far as I am aware. Am I accessing the XML nodes incorrectly? I've been toying with fixes for this bug for weeks now, I'd really appreciate any insight into what I'm doing wrong. On a side note, this is a personal project of mine - it's not university related - I'm much too old for that! Any help greatly appreciated. Regards, Sykth.

    Read the article

  • Accessing XML file using JavaScript And ASP.net |VB code

    - by Bubba
    Am trying to read in data from an xml file but using javascript which is embedded into my asp.net|vb code. I am new to asp.net but coming from a programming background. so I declared the xml objects for the appropriate browsers, as well as the name of the local xml to read data from, I then start by appending the create the table tag and then append it to the div tag in hack5.aspx I declare the variable that will represent/ hold the xml returned data object. I then run a for loop , before creating a row tag and then appending it to the div tag in hack5.aspx I then create the a row tag and then appending it to the div tag in hack5.aspx | then create a TextNode which is passed to variable, then create a td and append to div . then lastly append the textnode to td this format is the same for creating another 13 td tags that are to hold the data. The main problem is when I run the script - I see nothing display on my screen . no errors are shown, but with your sample code runs smoothly. So the first file hack5.aspx is as follows: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="hack5.aspx.vb" Inherits="_Default" %> <!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" > <head runat="server"> <title>Diplaying MessageBox from ASP.NET</title> </head> <body> <form id="form1" runat="server"> <div id="showtime" > </div> </form> </body> </html> The next file hack5.aspx.vb is as follows: Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim scriptString as String = "<script language=JavaScript> if (window.XMLHttpRequest) " scriptString += " { " scriptString += " xhttp=new XMLHttpRequest(); " scriptString += " } " scriptString += " else " scriptString += " { " scriptString += " xhttp=new ActiveXObject('Microsoft.XMLHTTP'); " scriptString += " } " scriptString += " xhttp.open('GET','yes.xml',false); " scriptString += " xhttp.send(null);" scriptString += " xmlDoc= xhttp.responseXML; " scriptString += " var table1 = document.createElement('table'); " scriptString += " document.getElementById('showtime').appendChild(table1); " scriptString += " var x=xmlDoc.getElementsByTagName('Table'); " scriptString += " for (i=0;i<x.length;i++) " scriptString += " { " scriptString += " var assessment = document.createTextNode(x[i].getElementsByTagName('Assessment')[0].childNodes[0].nodeValue);" scriptString += " var row1 = document.createElement('tr'); " scriptString += " document.getElementById('showtime').appendChild(row1); " scriptString += " var column1 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column1); " scriptString += " column1.appendChild(assessment); " scriptString += " var Issue_Date = document.createTextNode(x[i].getElementsByTagName('Issue_Date')[0].childNodes[0].nodeValue);" scriptString += " var column2 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column2); " scriptString += " column2.appendChild(Issue_Date); " scriptString += " var Due_Date = document.createTextNode(x[i].getElementsByTagName('Due_Date')[0].childNodes[0].nodeValue);" scriptString += " var column3 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column3); " scriptString += " column3.appendChild(Due_Date); " scriptString += " var Interest = document.createTextNode(x[i].getElementsByTagName('Interest')[0].childNodes[0].nodeValue);" scriptString += " var column4 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column4); " scriptString += " column4.appendChild(Interest); " scriptString += " var Summary = document.createTextNode(x[i].getElementsByTagName('Summary')[0].childNodes[0].nodeValue);" scriptString += " var column5 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column5); " scriptString += " column5.appendChild(Summary);" scriptString += " var Amount_Due= document.createTextNode(x[i].getElementsByTagName('Amount_Due')[0].childNodes[0].nodeValue);" scriptString += " var column6 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column6); " scriptString += " column6.appendChild(Amount_Due);" scriptString += " var IEduty = document.createTextNode(x[i].getElementsByTagName('IEduty')[0].childNodes[0].nodeValue);" scriptString += " var column7 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column7); " scriptString += " column7.appendChild(IEduty);" scriptString += " var LEsurtax = document.createTextNode(x[i].getElementsByTagName('LEsurtax')[0].childNodes[0].nodeValue);" scriptString += " var column8 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column8); " scriptString += " column8.appendChild(LEsurtax);" scriptString += " var CEsurtax = document.createTextNode(x[i].getElementsByTagName('CEsurtax')[0].childNodes[0].nodeValue);" scriptString += " var column9 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column9); " scriptString += " column9.appendChild(CEsurtax);" scriptString += " var EXduty = document.createTextNode(x[i].getElementsByTagName('EXduty')[0].childNodes[0].nodeValue);" scriptString += " var column10 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column10); " scriptString += " column10.appendChild(EXduty);" scriptString += " var IMvat = document.createTextNode(x[i].getElementsByTagName('IMvat')[0].childNodes[0].nodeValue);" scriptString += " var column11 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column11); " scriptString += " column11.appendChild(IMvat);" scriptString += " var SYSfee = document.createTextNode(x[i].getElementsByTagName('SYSfee')[0].childNodes[0].nodeValue);" scriptString += " var column12 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column12); " scriptString += " column12.appendChild(SYSfee);" scriptString += " var AItax = document.createTextNode(x[i].getElementsByTagName('AItax')[0].childNodes[0].nodeValue);" scriptString += " var column13 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column13); " scriptString += " column13.appendChild(AItax);" scriptString += " var Cduty = document.createTextNode(x[i].getElementsByTagName('Cduty')[0].childNodes[0].nodeValue);" scriptString += " var column14 = document.createElement('td'); " scriptString += " document.getElementById('showtime').appendChild(column14); " scriptString += " column14.appendChild(Cduty);" scriptString += " } " scriptString += " <" scriptString += "/" scriptString += "script>" If(Not ClientScript.IsStartupScriptRegistered("clientScript")) ClientScript.RegisterClientScriptBlock(Me.GetType(),"clientScript", scriptString) End If End Sub End Class And finally the xml file is as follows: <?xml version="1.0" encoding="utf-8" ?> <DataSet xmlns="http://tempuri.org/"> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="Table"> <xs:complexType> <xs:sequence> <xs:element name="UserName" type="xs:string" minOccurs="0" /> <xs:element name="Password" type="xs:string" minOccurs="0" /> <xs:element name="UserLevel" type="xs:string" minOccurs="0" /> <xs:element name="FName" type="xs:string" minOccurs="0" /> <xs:element name="LName" type="xs:string" minOccurs="0" /> <xs:element name="Branch" type="xs:string" minOccurs="0" /> <xs:element name="Department" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1"> <NewDataSet xmlns=""> <Table diffgr:id="Table1" msdata:rowOrder="0"> <Assessment>CHR/A157/2009</Assessment> <Issue_Date>20/10/2009</Issue_Date> <Due_Date>01/11/2009</Due_Date> <Interest>2.00</Interest> <Summary>BENTLEY 2009</Summary> <Amount_Due>28000000.00</Amount_Due> <IEduty>3000000.00</IEduty> <LEsurtax>4000000.00</LEsurtax> <CEsurtax>5000000.00</CEsurtax> <EXduty>0.00</EXduty> <IMvat>5000000.00</IMvat> <SYSfee>8000000.00</SYSfee> <AItax>2000000.00</AItax> <Cduty>1000000.00</Cduty> </Table> <Table diffgr:id="Table1" msdata:rowOrder="1"> <Assessment>CHR/A167/2009</Assessment> <Issue_Date>20/10/2009</Issue_Date> <Due_Date>01/11/2009</Due_Date> <Interest>2.00</Interest> <Summary>BENTLEY 2009</Summary> <Amount_Due>24000000.00</Amount_Due> <IEduty>3000000.00</IEduty> <LEsurtax>4000000.00</LEsurtax> <CEsurtax>5000000.00</CEsurtax> <EXduty>0.00</EXduty> <IMvat>1000000.00</IMvat> <SYSfee>8000000.00</SYSfee> <AItax>2000000.00</AItax> <Cduty>1000000.00</Cduty> </Table> <Table diffgr:id="Table1" msdata:rowOrder="2"> <Assessment>CHR/A196/2009</Assessment> <Issue_Date>11/11/2009</Issue_Date> <Due_Date>21/11/2009</Due_Date> <Interest>2.00</Interest> <Summary>BENTLEY 2009</Summary> <Amount_Due>20000000.00</Amount_Due> <IEduty>3000000.00</IEduty> <LEsurtax>4000000.00</LEsurtax> <CEsurtax>5000000.00</CEsurtax> <EXduty>0.00</EXduty> <IMvat>1000000.00</IMvat> <SYSfee>4000000.00</SYSfee> <AItax>2000000.00</AItax> <Cduty>1000000.00</Cduty> </Table> </NewDataSet> </diffgr:diffgram> </DataSet>

    Read the article

  • Why is CDATA needed and not working everywhere the same way?

    - by baptx
    In Firefox's and Chrome's consoles, this works (alerts script content): var script = document.createElement("script"); script.textContent = ( function test() { var a = 1; } ); document.getElementsByTagName("head")[0].appendChild(script); alert(document.getElementsByTagName("head")[0].lastChild.textContent); Using this code as a Greasemonkey script for Firefox works too. Now, if want to add a "private method" do() to test() It is not working anymore, in neither Firefox/Chrome console nor in a Greasemonkey script: var script = document.createElement("script"); script.textContent = ( function test() { var a = 1; var do = function () { var b = 2; }; } ); document.getElementsByTagName("head")[0].appendChild(script); alert(document.getElementsByTagName("head")[0].lastChild.textContent); To make this work in a Greasemonkey script, I have to put all the code in a CDATA tag block: var script = document.createElement("script"); script.textContent = (<![CDATA[ function test() { var a = 1; var do = function() { var b = 2; }; } ]]>); document.getElementsByTagName("head")[0].appendChild(script); alert(document.getElementsByTagName("head")[0].lastChild.textContent); This is only works in a Greasemonkey script; it throws an error from the Firefox/Chrome console. I don't understand why I should use a CDATA tag, I have no XML rules to respect here because I'm not using XHTML. To make it work in Firefox console (or Firebug), I need to do put CDATA into tags like <> and </>: var script = document.createElement("script"); script.textContent = (<><![CDATA[ function test() { var a = 1; var do = function() { var b = 2; }; } ]]></>); document.getElementsByTagName("head")[0].appendChild(script); alert(document.getElementsByTagName("head")[0].lastChild.textContent); This doesn't working from the Chrome console. I've tried adding .toString() at the end like many people are doing (]]></>).toString();), but it's useless. I tried to replace <> and </> with a tag name <foo> </foo> but that didn't work either. Why doesn't my first code snippet work if I define var do = function(){} inside another function? Why should I use CDATA as a workaround even if I'm not using XHTML? And why should I add <> </> for Firefox console if it's working without in a Greasemonkey script? Finally, what is the solution for Chrome and other browsers? EDIT: My bad, I've never used do-while in JS and I've created this example in a simple text editor, so I didn't see "do" was a reserved keyword :p But problem is still here, I've not initialized the Javascript class in my examples. With this new example, CDATA is needed for Greasemonkey, Firefox need CDATA between E4X <> </> and Chrome fails: var script = document.createElement("script"); script.textContent = ( <><![CDATA[var aClass = new aClass(); function aClass() { var a = 1; var aPrivateMethod = function() { var b = 2; alert(b); }; this.aPublicMethod = function() { var c = 3; alert(c); }; } aClass.aPublicMethod();]]></> ); document.getElementsByTagName("head")[0].appendChild(script); Question: why?

    Read the article

  • [SOLVED] javascript insertBefore() Method

    - by Robert
    I'm trying to insert a TH as the first column. But so far always put it at the end of all columns. Any help will be appreciate it. Thanks var someNode = document.createElement("th"); someNode.innerHTML = "Hello"; var sp = document.getElementById("table").getElementsByTagName("thead")[0].getElementsByTagName("tr")[0]; var ref = document.getElementById("table").getElementsByTagName("thead")[0].getElementsByTagName("tr")[0].getElementsByTagName("th")[0]; sp.insertBefore(someNode,ref);

    Read the article

  • iphone app store rss failed to open

    - by suvendu
    I write this, $opts = array( 'http' = array( 'user_agent' = 'PHP libxml agent', ) ); $context = stream_context_create($opts); libxml_set_streams_context($context); $doc = new DOMDocument(); $doc-load("http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/toppaidapplications/limit=25/xml"); foreach ($doc-getElementsByTagName('item') as $node) { $title = $node-getElementsByTagName('title')-item(0)-nodeValue; $desc = $node-getElementsByTagName('description')-item(0)-nodeValue; $link = $node-getElementsByTagName('link')-item(0)-nodeValue; $date = $node-getElementsByTagName('pubDate')-item(0)-nodeValue; echo $title; echo '<br>'; echo $desc; } ?

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >