SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xmlDoc.getElementsByTagName("ForexBuying")[0].childNodes[0].nodeValue;

    This code is working on İnternet Explorer. But it is not working on Firefox and Opera. What can I do? Thanks...
    Code:
     
    <html>
    <head>
    <script type="text/javascript">
    var xmlDoc;
    function loadXML()
    {
    // for IE 
    if (window.ActiveXObject)
    {
    	xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    	xmlDoc.async=false;
    	xmlDoc.load("http://www.tcmb.gov.tr/kurlar/today.xml");
    	getmessage();
    }
    // for Mozilla, Firefox, Opera, 
    else if (document.implementation && document.implementation.createDocument)
    {
    	xmlDoc=document.implementation.createDocument("","",null);
    	xmlDoc.load("http://www.tcmb.gov.tr/kurlar/today.xml");
    	xmlDoc.onload=getmessage;
    }
    else
    {
    	alert('Your browser does not support this script.');
    }
    }
    
    function getmessage()
    {
    var a = xmlDoc.getElementsByTagName('Currency')[0]
    document.getElementById("veri1").innerHTML=a.getElementsByTagName("ForexBuying")[0].childNodes[0].nodeValue;
    document.getElementById("veri2").innerHTML=a.getElementsByTagName("ForexSelling")[0].childNodes[0].nodeValue;
    document.getElementById("veri3").innerHTML=a.getElementsByTagName("BanknoteBuying")[0].childNodes[0].nodeValue;
    document.getElementById("veri4").innerHTML=a.getElementsByTagName("BanknoteSelling")[0].childNodes[0].nodeValue;
    
    }
    </script>
    <style type="text/css">
    b { color:red;}
    h3 {color:blue;}
    </style>
    </head>
    
    <body onload="loadXML()">
    <h3>AMERİKAN DOLARI- US DOLLAR</h3>
    <p><b>D&#246;viz Alış (Forex Buying)</b> <span id="veri1"></span><br />
    <p><b>D&#246;viz Satış (Forex Selling)</b> <span id="veri2"></span><br />
    
    <p><b>Efektif Alış (Banknote Buying)</b> <span id="veri3"></span><br />
    <p><b>Efektif Satış (Banknote Selling)</b> <span id="veri4"></span>
    </p>
    </body>
    </html>
    Last edited by muazzez; May 27, 2007 at 22:56.

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try setting the onload handler before you call load().
    Code:
    if (document.implementation && document.implementation.createDocument)
    {
    	xmlDoc=document.implementation.createDocument("","",null);
    	xmlDoc.onload=getmessage;
    	xmlDoc.load("http://www.tcmb.gov.tr/kurlar/today.xml");
    }
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Addict
    Join Date
    Aug 2006
    Posts
    266
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kravvitz,
    I tried that. Firefox give me same error message:
    Error: uncaught exception: Permission denied to call method XMLDocument.load

    http://www.webdeveloper.com/forum/sh...d.php?t=149113


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •