×

Discussion Board

Results 1 to 2 of 2

Thread: help me....

  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    5

    help me....

    index.html
    Code:
    <!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>
    	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    		<script language="javascript" type="text/javascript" src="basic.js"></script>
        	<link rel="stylesheet" href="basic.css" type="text/css">
        	<META NAME="Generator" CONTENT="Nokia WRT plug-in for Aptana Studio 2.3.0" />
    </head>
    
    <body onload="javascript:loadXMLDoc();";>
    <div id="tab"">
    <table>
    	<tr>
    		<td class="name">교시 / 요일</td>
    		<td>월</td>
    		<td>화</td>
    		<td>수</td>
    		<td>목</td>
    		<td>금</td>
    	</tr>
    	<tr>
    		<td class="name">1교시 [09:00~09:50]</td>
    		<td id="A0"></td>
    		<td id="B0"></td>
    		<td id="C0"></td>
    		<td id="D0"></td>
    		<td id="E0"></td>
    	</tr>
    	<tr>
    		<td class="name">2교시 [10:00~10:50]</td>
    		<td id="A1"></td>
    		<td id="B1"></td>
    		<td id="C1"></td>
    		<td id="D1"></td>
    		<td id="E1"></td>
    	</tr>
    	<tr>
    		<td class="name">3교시 [11:00~11:50]</td>
    		<td id="A2"></td>
    		<td id="B2"></td>
    		<td id="C2"></td>
    		<td id="D2"></td>
    		<td id="E2"></td>
    	</tr>
    	<tr>
    		<td class="name">4교시 [12:00~12:50]</td>
    		<td id="A3"></td>
    		<td id="B3"></td>
    		<td id="C3"></td>
    		<td id="D3"></td>
    		<td id="E3"></td>
    	</tr>
    	<tr>
    		<td class="name">5교시 [1:00~1:50]</td>
    		<td id="A4"></td>
    		<td id="B4"></td>
    		<td id="C4"></td>
    		<td id="D4"></td>
    		<td id="E4"></td>
    	</tr>
    	<tr>
    		<td class="name">6교시 [2:00~2:50]</td>
    		<td id="A5"></td>
    		<td id="B5"></td>
    		<td id="C5"></td>
    		<td id="D5"></td>
    		<td id="E5"></td>
    	</tr>
    	<tr>
    		<td class="name">7교시 [3:00~3:50]</td>
    		<td id="A6"></td>
    		<td id="B6"></td>
    		<td id="C6"></td>
    		<td id="D6"></td>
    		<td id="E6"></td>
    	</tr>
    	<tr>
    		<td class="name">8교시 [4:00~4:50]</td>
    		<td id="A7"></td>
    		<td id="B7"></td>
    		<td id="C7"></td>
    		<td id="D7"></td>
    		<td id="E7"></td>
    	</tr>
    		<tr>
    		<td class="name">9교시 [5:00~5:50]</td>
    		<td id="A8"></td>
    		<td id="B8"></td>
    		<td id="C8"></td>
    		<td id="D8"></td>
    		<td id="E8"></td>
    	</tr>
    		<tr>
    		<td class="name">10교시 [6:00~6:50]</td>
    		<td id="A9"></td>
    		<td id="B9"></td>
    		<td id="C9"></td>
    		<td id="D9"></td>
    		<td id="E9"></td>
    	</tr>
    </table>
    </div>
    <div id="tab2">
    <button onclick="javascript:small();">
    Click Me!
    </button>
    
    </div>
    	</body>
    </html>

    Code:
    var xmlhttp;
    
    var mday;
    function loadTime()
    {
    today = new Date();
    dday = new Array('sun','mon','tue','wed','thu','fri','sat');
    year=today.getYear();
    month=today.getMonth()+1;
    date=today.getDate();
    day=today.getDay();
    hour=today.getHours();
    mday = dday[day];
    }
    function small()
    {
    xmlhttp=null;
    if (window.XMLHttpRequest)
      {// code for IE7, Firefox, Mozilla, etc.
      xmlhttp=new XMLHttpRequest();
      }
    else if (window.ActiveXObject)
      {// code for IE5, IE6
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    if (xmlhttp!=null)
      {
      url = "cd_catalog.xml";
      xmlhttp.onreadystatechange=aa;
      xmlhttp.open("GET",url,true);
      xmlhttp.send(null);
      }
    else
      {
      alert("Your browser does not support XMLHTTP.");
      }
    }
    function aa(){
    	if (xmlhttp.readyState != 4) 
    		return;
    	if (xmlhttp.status != 200) {
    		alert("Problem retrieving XML data");
    		return;
    	}
    	var oObj = xmlhttp.responseXML;
    	
    	loadTime();
    	if (mday == "sat" || mday == "sun") {
    		document.getElementById('tab').style.display = "none";
    		document.getElementById('tab2').innerHTML = "주말입니다";
    	}
    	else {
    	
    		var Mon = oObj.getElementsByTagName(mday);
    		My = Mon[0].childNodes;
    		
    		document.getElementById('tab').style.display = "none";
    		for (i = 0; i < My.length; i++) {
    			txt = "<div style='width:100% height:300px border:1px solid #ff0000;'>";
    			Mn = My[i].nodeName;
    			Mk = My[i].childNodes.length;
    			for (z = 0; z < Mk; z++) {
    				Ma = "<p>" + My[i].childNodes[z].firstChild.nodeValue + "</p>";
    				txt += Ma;
    			}
    			txt += "</div>";
    			document.getElementById('tab2').innerHTML += txt;
    		}
    	}
    }
    
    function loadXMLDoc()
    {
    xmlhttp=null;
    if (window.XMLHttpRequest)
      {// code for IE7, Firefox, Mozilla, etc.
      xmlhttp=new XMLHttpRequest();
      }
    else if (window.ActiveXObject)
      {// code for IE5, IE6
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    if (xmlhttp!=null)
      {
      url = "cd_catalog.xml";
      xmlhttp.onreadystatechange=onResponse;
      xmlhttp.open("GET",url,true);
      xmlhttp.send(null);
      }
    else
      {
      alert("Your browser does not support XMLHTTP.");
      }
    }
    
    function onResponse()
    {
    if(xmlhttp.readyState!=4) return;
    if(xmlhttp.status!=200)
      {
      alert("Problem retrieving XML data");
      return;
      }
    //document.getElementById('tab').style.display = "";
    var oObj = xmlhttp.responseXML; 
    
    var Wek = oObj.getElementsByTagName('CATALOG');
    We1 = Wek[0].childNodes;
    
    for (y=0;y<We1.length;y++)
    	{
    	Wy = We1[y].childNodes;
    		for (i=0;i<Wy.length;i++)
    		{
    		Wn = Wy[i].nodeName;
    		Wk = Wy[i].childNodes.length;
    			for (z=0;z<Wk;z++) {
    			Wa = Wy[i].childNodes[z].firstChild.nodeValue + "<br>";
    			document.getElementById(Wn).innerHTML += Wa;
    			}
    		}
    	}
    }
    cd_catalog.xml
    Code:
    <?xml version="1.0"?><!--EditedbyXMLSpy®--><CATALOG><mon><A0><room>A1</room><professor>A1</professor></A0><A1><study>A2</study><room>A2</room><professor>A2</professor></A1><A2><study>A3</study><room>A3</room><professor>A3</professor></A2></mon><wed><C3><study>C3</study><room>C3</room><professor>C3</professor></C3></wed><fri><E5><study>E5</study><room>E5</room><professor>E5</professor></E5></fri></CATALOG>
    It works on my PHP server
    but doesn't work on my 5800..

    It says only "Problem retrieving XML data"

    I don't know why...
    anybody help me...!

  2. #2
    Super Contributor
    Join Date
    May 2008
    Location
    Helsinki, Finland
    Posts
    1,100

    Re: help me....

    Hi lulluana,

    I am not sure about your "PHP server", but you could first of all verify that it has been correctly
    set for content-type "text/xml" for all files with an ".xml" extension?

    Then your script seems to contain Chinese characters, yes - well, that might be causing something here
    together with XML parsing...

    Because I do not know if you are still facing this issue, please could you respond back what is your
    current status with this? Also, if you could send me the full widget by e-mail or your server address
    if you have that online and that xml file is located there?

    Best Regards,
    [FONT="Comic Sans MS"][COLOR="Blue"][/COLOR][I]Marko Lumivuori
    Technical Support
    +358 40 8019330
    [email]marko.lumivuori@nokia.com[/email][/I][/FONT]

Posting Permissions

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