473,796 Members | 2,570 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE gives an error and works anyway

Hi, it's me again!

I have a strange problem with a form I gotta (dynamically) insert in a
site, and copied/pasted the code to a blank page, to make it easier to
try it out. I was using the $ function of script.aculo.us , which is
substituted by the equivalent document.getEle mentById in the code below
(and the problem is still the same).
The "mystery" is that this code WORKS both in FF 2 and IE 6, but IE
gives an error at the moment when the innerHTML is executed (I tried
putting an alert before it)... my only doubt is that trying to validate
it with Dreamweaver it says that the tags in the string are nested, and
shouldn't... but IT'S JUST A STRING!!!!!
Can U help me, please? I beg U! :-)
Thanks in advance!
Massi
P.S.: yes, it's very bad-looking to see the code copied this way, and
the form's string it wouldn't work at all if I tried to "linefeed" the
string... BTW I tried to "decompress " the string, and th XHTML 1.0
Strict (still Dremweaver validator). Copying/pasting it in an editing
environment it should look much better! :-)
P.P.S.: don't take care about the CSS.. it's why I tried this code, but
it doesn't matter on the problem

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Prova</title>
</head>

<body>
<script type="text/javascript">
nome_tipo="Boh" ;
nome="Massi";
n_prog="ennepro g";
data= new Date;
descrizione="st o cazzo";
</script>
<div id="formbox">
</div>

<script type="text/javascript">
document.getEle mentById("formb ox").innerHTML= '<form action=""
method="post">< fieldset><legen d>Parametri
Subscribers</legend><p>Inser ire i nuovi parametri<br/>del subscriber
selezionato:</p><div><label for="tipo">Tipo Dispositivo<inp ut
disabled="disab led" type="text" id="tipo" name="tipo"
value="Subscrib er"/></label></div><div><label
for="ID">Identi ficativo<input type="text" id="ID" name="ID"
value="'+nome+' "/></label></div><div><label for="number">N& deg;
Progressivo<inp ut type="text" id="number" name="number"
value="'+n_prog +'"/></label></div><div><label
for="descrizion e">Descrizione< textarea name="descrizio ne"
id="descrizione " rows="3"
cols="15">'+des crizione+'</textarea></label></div></fieldset><field set><legend>Dat a
odierna</legend><label for="day" class="labelcor ta">GG<input
disabled="disab led" name="day" type="text" id="day" size="2"
maxlength="2" value="'+data.g etDate()+'"/></label><label for="month"
class="labelcor ta">MM<input disabled="disab led" name="month" type="text"
id="month" size="2" maxlength="2"
value="'+(data. getMonth()+1)+' "/></label><label for="year"
class="labelcor ta">AAAA<inpu t disabled="disab led" name="year"
type="text" id="year" size="4" maxlength="4"
value="'+data.g etFullYear()+'"/></label></fieldset><field set><legend>Ora
attuale:</legend><label for="ore" class="labelcor ta">ora<input
disabled="disab led" name="ore" type="text" id="ore" size="2"
maxlength="2" value="'+data.g etHours()+'"/></label><label for="minuti"
class="labelcor ta">min.<inpu t disabled="disab led" name="minuti"
type="text" id="minuti" size="2" maxlength="2"
value="'+data.g etMinutes()+'"/></label><label for="secondi"
class="labelcor ta">sec.<inpu t disabled="disab led" name="secondi"
type="text" id="secondi" size="2" maxlength="2"
value="'+data.g etSeconds()+'"/></label></fieldset><div
id="bottoni"><i nput type="button" value="Annulla"
onclick="toglif orm()"/><input type="submit" class="big"
onclick="wait() ;raccogliDatiUt ente(\"formbox\ ");addeseguito( \"Sono state
modificate le caratteristiche del subscriber selezionato\")"
value="Modifica Dati"/></div></form>';
</script>
</body>
</html>
Feb 3 '07 #1
6 1538
massic80 ha scritto:
P.S.: yes, it's very bad-looking to see the code copied this way, and
the form's string, BUT it wouldn't work at all if I tried to "linefeed" the
string... BTW I tried to "decompress " the string, and IT DOESN'T GIVE ERRORS ON XHTML 1.0
Strict (still Dremweaver validator). Copying/pasting it inTO an editing
environment it should look much better! :-)
Feb 3 '07 #2
massic80 ha scritto:
I also tried with w3c online validator: first, it said the DOCTYPE tag
shouldn't be closed.

In the code, remove "wait();raccogl iDatiUtente(\"f ormbox\");", sorry! :-)

The problem goes on... w3c validator continues saying there R nesting or
overlapping problems
Feb 3 '07 #3
massic80 wrote:
<snip>
The "mystery" is that this code WORKS both in FF 2 and IE 6,
but IE gives an error at the moment when the innerHTML is
executed
But it is too much trouble for you to say what error is produced by IE?
(I tried putting an alert before it)... my only doubt is that
trying to validate it with Dreamweaver
Is that a joke?
it says that the tags in the string are nested, and shouldn't... but
IT'S JUST A STRING!!!!!
It may be a string to javascript but to a validator the whole thing is
(x?)HTML mark-up first, and there the nesting of tags in incorrect (the
consequence of a general failure to escape the '</' sequences in the
stirng).
Can U help me, please? I beg U! :-)
If you cannot be bothered to attempt to construct sentences from words I
am very inclined not to bother.

<snip>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
IE does not support XHTML at all, so there is little point in writing
XHTML mark-up if you are going to serve it IE.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
^^^^^^^^^
This is irrational. If you want the document interpreted as HTML you
should write HTML, and putting /at the end of a META element in the
head of a document that is to be interpreted as HTML is non-valid and may
have directly harmful consequences as its meaning in SGML may be applied
by some browsers.

<snip>
<script type="text/javascript">
document.getEle mentById("formb ox").innerHTML= '<form action=""
The - innerHTML - property is not generally supported in XHTML DOMs (and
probably should not be expected to be supported there). Using this
construct _requires_ that this document must _never_ be interpreted as
XHTML, and so imposing the illusion of XHTML on the mark-up is not
rational.

<snip>
onclick="wait() ;raccogliDatiUt ente(\"formbox\ ");
<snip ^ ^

This - onclick - attribute's value is delimited with double quotes so the
first of the double quotes used in this arguments list will end the
attribute value. So the actual attribute value is
"wait();raccogl iDatiUtente(", and that will result in a syntax error when
the browser attempts to use that value to create an event handling
function. The odds are very good that FireFox is also reporting that
syntax error, though you may just not be looking for it.

Richard.

Feb 3 '07 #4
Richard Cornford ha scritto:
But it is too much trouble for you to say what error is produced by IE?
Here I am (I inserted HTML 4.01 strict DOCTYPE, and it's the same):
Row: 2
Char: 1
Error: syntax error
Code: 0
Try to copy/paste my code!
>(I tried putting an alert before it)... my only doubt is that
trying to validate it with Dreamweaver

Is that a joke?
mmh?
It may be a string to javascript but to a validator the whole thing is
(x?)HTML mark-up first,
Ah... I didn't know it! Thanks!
and there the nesting of tags in incorrect (the
consequence of a general failure to escape the '</' sequences in the
stirng).
what do U mean?
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>

IE does not support XHTML at all, so there is little point in writing
XHTML mark-up if you are going to serve it IE.
Pardon my maybe-fool question: I'm making an HTML interface for a local
server (in which the form would be inserted), and my only job is making
the visual part of it. Another guy is working on the Ajax/XML messages
part... would it still work if I modify the DOCTYPE to HTML 4.01?
><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
^^^^^^^^^
This is irrational.
:-O I'm really "sorry"... it's the standard head put by Dreamweaver! :-)
I trusted it!
If you want the document interpreted as HTML you
should write HTML, and putting /at the end of a META element in the
head of a document that is to be interpreted as HTML is non-valid and
may have directly harmful consequences as its meaning in SGML may be
applied by some browsers.
(sic!)
><script type="text/javascript">
document.getEl ementById("form box").innerHTML ='<form action=""

The - innerHTML - property is not generally supported in XHTML DOMs (and
probably should not be expected to be supported there).
MMHh... OK... but it worked perfectly in the other instructions I wrote
in my site... they R in an external js file, and all work but this -
even if put in the same js
Using this
construct _requires_ that this document must _never_ be interpreted as
XHTML, and so imposing the illusion of XHTML on the mark-up is not
rational.
So, your verdict is "switch to HTML 4.01", huh?
<snip>
>onclick="wait( );raccogliDatiU tente(\"formbox \");
<snip ^ ^

This - onclick - attribute's value is delimited with double quotes so
the first of the double quotes used in this arguments list will end the
attribute value.
WHOOPS! Yes, it was 4:30 in the morning, but I've looked at it several
times... but U'RE damn right! :-) I'll look at it again
Hope to hear from U again, U sound much expert on it ;-)
Massi
Feb 3 '07 #5
<snip>
>onclick="wait( );raccogliDatiU tente(\"formbox \");
<snip ^ ^
IT WAS ONLY FOR THIS REASON! I modified the \" with \' and it doesn't
give errors now... FF didn't notice about it! And IE as usual doesn't
give the exact line of the error...
I put those \' cause I had a sentence with a "'", and I even tried
"\\\'" :-)... then I removed the "'" and leaved those wrong \"... but i
was much modified from the previous-my friend-version so I were
confused... BTW, THANKS! :-)
Now: I'm asking again about the HTML thing: do U think Ajax and XML
communications commands would still work if the page was "only" HTML 4.01?
Feb 3 '07 #6
massic80 said the following on 2/3/2007 12:54 PM:
><snip>
>>onclick="wait ();raccogliDati Utente(\"formbo x\");
<snip ^ ^
IT WAS ONLY FOR THIS REASON! I modified the \" with \' and it doesn't
give errors now... FF didn't notice about it! And IE as usual doesn't
give the exact line of the error...
I put those \' cause I had a sentence with a "'", and I even tried
"\\\'" :-)... then I removed the "'" and leaved those wrong \"... but i
was much modified from the previous-my friend-version so I were
confused... BTW, THANKS! :-)
Now: I'm asking again about the HTML thing: do U think Ajax and XML
communications commands would still work if the page was "only" HTML 4.01?
Did you test it? The answer is yes.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2314
by: Dotnetified | last post by:
Reposting after about 2 weeks of no response ... thanks if you can help... ---------------------------------------------------------------------------- -------------- To anyone who thinks they know it all: ;) We recently upgraded our MSDN Version of VS.NET 2002 to VS.NET 2003... Things are all working well, except we've run across a new bug or issue since our adopting of the new package.
9
3217
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network share that happens to be a Network Appliance NAS.
6
1971
by: vips | last post by:
Page_Load datagrid1.datasource=dataset1 //I am filling the datagrid and it works fine when page is displayed end ---------------
4
5569
by: Jatinder | last post by:
Hi, I am trying to grant connect privilege to a user present on my O.S. (Windows) using following statement. GRANT CONNECT ON DATABASE TO user "user1" now when I execute this statemnt from db2 clp(ofcourse prefixing db2) it works fine, but when I put it inside an sql file and then when I try to run the file using db2 -tvf, it gives me following error msg
12
5718
by: arnuld | last post by:
in C++ Primer 4/3 Lippman says in chapter 3, section 3.3.1: vector<stringsvec(10); // 10 elements, each an empty string here is the the code output & output from my Debian box running "gcc 3.3.5": #include <iostream> #include <vector>
6
3351
by: ImageAnalyst | last post by:
Try this: 1) In the code editor, double click some word. 2) Type control-F to bring up the search window. 3) Set the "Look in" drop down box to be "Entire Solution" 4) Click the "Bookmark All" button. 5) Get error message. What we (two different systems) observe is an error message saying "Visual Studio has encountered an unexpected error." I can click OK and then all's well again - Visual Studio does not shutdown.
1
6111
by: loial | last post by:
Trying to use ftplib.FTP.nlst() method to list the files in a directory on a FTP server. It works fine except when there are no files in the directory. Then it gives the error ftplib.error_perm: 550 No files found. How can I handle this cleanly?
2
7396
by: Calvin Cheng | last post by:
Hi, I am attempting to convert a bunch of .txt files into html using the docutils package. It works for most of the txt files except for the index.txt file which gives 2 errors: (1) <Error/3Unknown Directive type "toctree" (2) (ERROR/3) Unknown interpreted text role "ref".
0
749
by: _Who | last post by:
This works. I get colored scrollbars. But why the error message? File ColorScrollbar.js contains: var htmlStyle = document.getElementsByTagName('html').style; htmlStyle.scrollbarShadowColor = "orange";
0
9530
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10459
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.