🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #51028

Re: Walidacja skryput w3c

#51028
From: porneL
Date: Fri, 17 Feb 2012 21:38
48 lines
2196 bytes
On Fri, 17 Feb 2012 13:49:23 -0000, <narskitom@yahoo.pl> wrote:

> Mam w sekcji <head> wstawiony taki oto skrypt:
>
> <script type="text/javascript">
>  function getAjaX(func,str)
>  {
>  if (str=="")
>    {
>    document.getElementById("txtHint").innerHTML="";
>    return;
>    }
>  if (window.XMLHttpRequest)
>    {// code for IE7+, Firefox, Chrome, Opera, Safari
>    xmlhttp=new XMLHttpRequest();
>    }
>  else
>    {// code for IE6, IE5
>    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
>    }
>  xmlhttp.onreadystatechange=function()
>    {
>    if (xmlhttp.readyState==4 && xmlhttp.status==200)
>      {
> document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
>      }
>    }
>  xmlhttp.open("GET","ajax.php?f="+func+"&q="+str,true);
>  xmlhttp.send();
>  }
>  </script>
>
> o problem z walidatorem w3c, który wyświetla błędy:
>
> Line 59, Column 42: cannot generate system identifier for general
> entity "q"
>  xmlhttp.open("GET","ajax.php?f="+func+"&q="+str,true);
>

1. Skrypt jest w porządku, to DOCTYPE masz zły. Nie zawracaj sobie głowy  
XHTML, bo i tak ci nie działa: http://pornel.net/xhtml . Użyj walidatora  
HTML5, to dostaniesz informacje o błędach, które mają większe znaczenie.

2. Użyj jakiejś biblioteki, bo to obciach po raz milionowy pisać "na  
piechotę" wszystkie obejścia do AJAX-a.

-- 
regards, porneL
Technical Details
Message-ID: <op.v9uednquvq69rq@aimac.local>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <664e756b-dc0d-4a1d-a80c-555c1e9039d7@do4g2000vbb.googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: porneL <niusy5@pornel.net>
Newsgroups: pl.comp.lang.javascript
Subject: Re: Walidacja skryput w3c
Date: Fri, 17 Feb 2012 21:38:01 -0000
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 48
Message-ID: <op.v9uednquvq69rq@aimac.local>
References: <664e756b-dc0d-4a1d-a80c-555c1e9039d7@do4g2000vbb.googlegroups.com>
NNTP-Posting-Host: 96.95.187.81.in-addr.arpa
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1329514682 17908 81.187.95.96 (17 Feb 2012 21:38:02 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Fri, 17 Feb 2012 21:38:02 +0000 (UTC)
X-User: pornelspam
User-Agent: Opera Mail/11.62 (MacIntel)
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit