invalid location of tag 解決辦法

轉自:https://blog.csdn.net/tanzuai/article/details/41896579html

在jsp頁面使用標籤過程當中有時候不注意規則的話,eclipse會提示一些錯誤,下面針對這些錯誤提出相應的解決辦法:瀏覽器

<form></form>標籤eclipse

1. Invalid location of tag (form)jsp

  form 應該寫到table外面去,而且form標籤裏面也不能套form標籤。
<style></style>
2. Invalid location of tag (style)
  style應該寫在head裏面。
<script></script>
3. Invalid location of tag (script)
  script應該寫到body,head裏面。

4.Attribute name(Name) uses wrong case character

  雖然說HTML不區分大小寫,可是在eclipse裏面,大寫的話就報錯,因此要改爲小寫吧。spa

 

5.JSP文件中的html標籤以下,在eclipse環境下提示:Invalid location of tag (div)。.net

<a id="test1" class="mitem" href="#">
           <img src="../m1.jpg" width="60"></img>
            <div id="a-in-1" class="a-in"><div class="a-in-m"></div><div class="a-in-r"></div></div>
</a>firefox

現象: 在 firefox3.6 下進入頁面,或者進入頁面有時界面顯示亂套。但在 ie,firefox3.0下都顯示正常。orm

解決辦法: 將<a></a>標籤下的<div></div>標籤替換爲<span></span>,以下:htm

<a id="test1" class="mitem" href="#">
      <img src="../m1.jpg" width="60"></img>
       <span id="a-in-1" class="a-in"><span class="a-in-m"></span><span class="a-in-r"></span></span>
</a>blog

緣由應該是<a></a>與<div></div>標籤的組合致使瀏覽器解析出錯。

6.Invalid location of tag (table)

table應該寫到textarea外面。

相關文章
相關標籤/搜索