Wednesday, March 28, 2012

substitute for <span>

asp.net 1.1

for my .aspx web-form , if i set Target Schema = Internet Explorer 5.0 ,
then this line

<span id="NameFirst" name="NameFirst" runat=server></span
causes the error

"the active schema does not support the element 'span'."

what should i use as a substitute for <span> ?That's weird -- span sure is supported by IE5. I can repro your problem only if I switch the schema to IE 3.2/Netscape 3.02 -- in other words, using a schema for a browser before IE4.

For what it's worth, the schema is used for validation in HTML view, but it does not prevent the page from compiling and rendering to the browser. At least, that's my experience while testing this.
Unless you have a good reason for specifying the Target Schema, it would bemuch easier to simply remove that specification. The <span> tag is a very fundamental part of both HTML and ASP.NET, so trying to remove every instance of it would bevery problematic.

However, to answer your question ... you could use a <div> instead.

A <div> is called a "block" element in that each <div> tends to appear "under" the last <div>. (HTML tables are block elements too, as they each generally appear below one another.)

A <span>, on the other hand, is called an "inline" element as each <span> appears "next" to the last <span>. (HTML hyperlinks <a href="http://links.10026.com/?link=..."> are inline elements, as they appear next to the words preceding the hyperlink.)

So, to use a <div> instead of a <span>, you'd need to change it from a "block" element to an "inline" element:

<div id="one" style="display:inline;">...</div>
is pretty much the same as
<span id="two">...</span>

Still, I'd caution again that it would be much easier to remove the Target Schema specification than to try to remove all instances of <span> tags.

0 comments:

Post a Comment