2015-09-19 50 views
2

另一個問題,我發佈關於我與PHP頁面的問題我正在對一些人的工作評論告訴我,我正在使用textarea標記作爲自我關閉標記,這是導致我所有的問題。我知道比這樣做更好,所以它讓我雙重和三重檢查我的編碼,正如我已經預料的那樣,標籤已關閉。下面是它在Dreamweaver中的圖片瀏覽器如何將我的textarea標籤變成自閉標籤?

enter image description here

所以剛開始我沒有線索,他們在談論,但在在開發的Chrome瀏覽器工具檢查它,我看到了這一點

enter image description here

因此,瀏覽器以某種方式將自己的textarea標籤更改爲自閉標籤。它是如何做到這一點,我該如何阻止它?到目前爲止,據我所知,它只對這裏列出的textarea有效。我的調查問卷的完整版本中有更多,據我所知,他們都表現良好。這是什麼引發了這種事情發生?

///////////////////////////////////// UPDATE //////// //////////////////////////

確定我右點擊並選擇「查看源」和「檢查元件」和它的確示出textarea標籤被渲染成一個自閉標籤。我發佈的第一張照片是「檢查元素」選項,這裏是「查看源」選項。

enter image description here

所以是.....莫名其妙它越來越交換了我和它吃的PHP文件的其餘部分一路走過來關閉HTML標記。感謝所有yoru幫助到目前爲止,希望我們可以得出這個想法,我花了3天的時間才發現這是問題,我最初從我的.js文件中得到一個錯誤,說onclick函數不能爲null,我的語法很完美。它是這樣回來的,因爲它吞噬了它試圖提及的因素,所以沒有什麼東西可以適用於它。

/////////////////////////////// UPDATE 2 ///////////// ////////////////////////

OK我曾經在W3.org的驗證的建議,這就是它掀開

enter image description here

我拿出PHP數據,以防止它來了作爲一個錯誤。但這是我在Dreamweaver中的。

<?php ini_set('display_errors','on'); ?><?php include('extlib/vdaemon/vdaemon.php'); ?><!doctype html> 
<html> 
<head> 
<link href='https://fonts.googleapis.com/css?family=Roboto|Oswald|Poiret+One&subset=latin,latin-ext,greek-ext' rel='stylesheet' type='text/css'> 
<link rel="stylesheet" type="text/css" href="http://www.optiqvision.x10host.com/Files/css/Corp_ID_and_Branding_Questionnaire_2.css"> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
<meta charset="utf-8"> 
<title>Untitled Document</title> 
</head> 

<body> 
<header> 
</header> 

<form action="core/process.php" method="post" id="CorpID" runat="vdaemon"> 

<input type="hidden" name="formID" value="Questionnaire" /> 
<input type="hidden" name="redirect_to" value="http://optiqvision.x10host.com/Corp_ID_and_Branding_Questionnaire.html" /> 

    <div id="page01"> 
     <div id="p_content"> 
     <div class="title02"> 
       Contact and Location 
      </div><br /><br /><br /><!--Contact and Location--> 

      <div class="texfrm_o" style="height:66px;"> 
       <div class="texfrm_i" style="float:left; width:44%; height:66px;"> 
        <label for="fname" class="label_01">First Name</label> 
        <input type="text" id="fname" name="First_Name" class="tex_inp01" style="font-size:16pt;" /> 

       </div> 

       <div class="texfrm_i" style="float:right; width:44%; height:66px;"> 
        <label for="lname" class="label_01">Last Name</label> 
        <input type="text" id="lname" name="Last_Name" class="tex_inp01" style="font-size:16pt;" /> 

       </div> 
      </div><!--texfrm--><br /><br /> 

      <div class="texfrm_o" style="height:66px;"> 
       <div class="texfrm_i" style="margin:auto; width:66; height:66px;%"> 
        <label for="email" class="label_01">E-Mail</label> 
        <input type="text" id="email" name="E_Mail" class="tex_inp01" style="font-size:16pt;" /> 
       </div> 
      </div><!--texfrm--><br /><br /> 

      <div class="texfrm_o" style="height:66px;"> 
       <div class="texfrm_i" style="margin:auto; width:66%; height:66px;"> 
        <label for="fbnam" class="label_01">Facebook Name...(optional)</label> 
        <input type="text" id="fbnam" name="FB_Name" class="tex_inp01" style="font-size:16pt;" /> 
       </div> 
      </div><!--texfrm--><br /><br /> 

      <div class="texfrm_o" style="height:66px;"> 
       <div class="texfrm_i" style="margin:auto; width:66%; height:66px;"> 
        <label for="twnam" class="label_01">Twitter Name...(optional)</label> 
        <input type="text" id="twnam" name="Twitter_Name" class="tex_inp01" style="font-size:16pt;" /> 
       </div> 
      </div><!--texfrm--><br /><br /> 

      <div class="texfrm_o" style="height:66px;"> 
       <div class="texfrm_i" style="width:33%; float:left; height:66px;"> 
        <label for="country_sel" class="label_01">Country</label> 
        <select id="country_sel" class="tex_inp01" name="Country" style="width:88%; font-size:12pt;"> 
         <option selected value="Please select a Country">Please select a Country</option> 
         <option value="Afghanistan">Afghanistan</option> 
         <option value="Albania">Albania</option> 
         <option value="Algeria">Algeria</option> 
         <option value="Andorra">Andorra</option> 
         <option value="Angola">Angola</option> 
         <option value="Antigua and Barbuda">Antigua and Barbuda</option> 
         <option value="Argentina">Argentina</option> 
         <option value="Armenia">Armenia</option> 
         <option value="Aruba">Aruba</option> 
         <option value="Australia">Australia</option> 
         <option value="Austria">Austria</option> 
         <option value="Azerbaijan">Azerbaijan</option> 
         <option value="Bahamas, The">Bahamas, The</option> 
         <option value="Bahrain">Bahrain</option> 
         <option value="Bangladesh">Bangladesh</option> 
         <option value="Barbados">Barbados</option> 
         <option value="Belarus">Belarus</option> 
         <option value="Belgium">Belgium</option> 
         <option value="Belize">Belize</option> 
         <option value="Benin">Benin</option> 
         <option value="Bhutan">Bhutan</option> 
         <option value="Bolivia">Bolivia</option> 
         <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option> 
         <option value="Botswana">Botswana</option> 
         <option value="Brazil">Brazil</option> 
         <option value="Brunei">Brunei</option> 
         <option value="Bulgaria">Bulgaria</option> 
         <option value="Burkina Faso">Burkina Faso</option> 
         <option value="Burma">Burma</option> 
         <option value="Burundi">Burundi</option> 
         <option value="Cambodia">Cambodia</option> 
         <option value="Cameroon">Cameroon</option> 
         <option value="Canada">Canada</option> 
         <option value="Cape Verde">Cape Verde</option> 
         <option value="Central African Republic">Central African Republic</option> 
         <option value="Chad">Chad</option> 
         <option value="Chile">Chile</option> 
         <option value="China">China</option> 
         <option value="Colombia">Colombia</option> 
         <option value="Comoros">Comoros</option> 
         <option value="Congo, Democratic Republic of the">Congo, Democratic Republic of the</option> 
         <option value="Congo, Republic of the">Congo, Republic of the</option> 
         <option value="Costa Rica">Costa Rica</option> 
         <option value="Cote d'Ivoire">Cote d'Ivoire</option> 
         <option value="Croatia">Croatia</option> 
         <option value="Cuba">Cuba</option> 
         <option value="Curacao">Curacao</option> 
         <option value="Cyprus">Cyprus</option> 
         <option value="Czech Republic">Czech Republic</option> 
         <option value="Denmark">Denmark</option> 
         <option value="Djibouti">Djibouti</option> 
         <option value="Dominica">Dominica</option> 
         <option value="Dominican Republic">Dominican Republic</option> 
         <option value="Ecuador">Ecuador</option> 
         <option value="Egypt">Egypt</option> 
         <option value="El Salvador">El Salvador</option> 
         <option value="Equatorial Guinea">Equatorial Guinea</option> 
         <option value="Eritrea">Eritrea</option> 
         <option value="Estonia">Estonia</option> 
         <option value="Ethiopia">Ethiopia</option> 
         <option value="Fiji">Fiji</option> 
         <option value="Finland">Finland</option> 
         <option value="France">France</option> 
         <option value="Gabon">Gabon</option> 
         <option value="Gambia, The">Gambia, The</option> 
         <option value="Georgia">Georgia</option> 
         <option value="Germany">Germany</option> 
         <option value="Ghana">Ghana</option> 
         <option value="Greece">Greece</option> 
         <option value="Grenada">Grenada</option> 
         <option value="Guatemala">Guatemala</option> 
         <option value="Guinea">Guinea</option> 
         <option value="Guinea-Bissau">Guinea-Bissau</option> 
         <option value="Guyana">Guyana</option> 
         <option value="Haiti">Haiti</option> 
         <option value="Holy See">Holy See</option> 
         <option value="Honduras">Honduras</option> 
         <option value="Hong Kong">Hong Kong</option> 
         <option value="Hungary">Hungary</option> 
         <option value="Iceland">Iceland</option> 
         <option value="India">India</option> 
         <option value="Indonesia">Indonesia</option> 
         <option value="Iran">Iran</option> 
         <option value="Iraq">Iraq</option> 
         <option value="Ireland">Ireland</option> 
         <option value="Israel">Israel</option> 
         <option value="Italy">Italy</option> 
         <option value="Jamaica">Jamaica</option> 
         <option value="Japan">Japan</option> 
         <option value="Jordan">Jordan</option> 
         <option value="Kazakhstan">Kazakhstan</option> 
         <option value="Kenya">Kenya</option> 
         <option value="Kiribati">Kiribati</option> 
         <option value="Korea, North">Korea, North</option> 
         <option value="Korea, South">Korea, South</option> 
         <option value="Kosovo">Kosovo</option> 
         <option value="Kuwait">Kuwait</option> 
         <option value="Kyrgyzstan">Kyrgyzstan</option> 
         <option value="Laos">Laos</option> 
         <option value="Latvia">Latvia</option> 
         <option value="Lebanon">Lebanon</option> 
         <option value="Lesotho">Lesotho</option> 
         <option value="Liberia">Liberia</option> 
         <option value="Libya">Libya</option> 
         <option value="Liechtenstein">Liechtenstein</option> 
         <option value="Lithuania">Lithuania</option> 
         <option value="Luxembourg">Luxembourg</option> 
         <option value="Macau">Macau</option> 
         <option value="Macedonia">Macedonia</option> 
         <option value="Madagascar">Madagascar</option> 
         <option value="Malawi">Malawi</option> 
         <option value="Malaysia">Malaysia</option> 
         <option value="Maldives">Maldives</option> 
         <option value="Mali">Mali</option> 
         <option value="Malta">Malta</option> 
         <option value="Marshall Islands">Marshall Islands</option> 
         <option value="Mauritania">Mauritania</option> 
         <option value="Mauritius">Mauritius</option> 
         <option value="Mexico">Mexico</option> 
         <option value="Micronesia">Micronesia</option> 
         <option value="Moldova">Moldova</option> 
         <option value="Monaco">Monaco</option> 
         <option value="Mongolia">Mongolia</option> 
         <option value="Montenegro">Montenegro</option> 
         <option value="Morocco">Morocco</option> 
         <option value="Mozambique">Mozambique</option> 
         <option value="Namibia">Namibia</option> 
         <option value="Nauru">Nauru</option> 
         <option value="Nepal">Nepal</option> 
         <option value="Netherlands">Netherlands</option> 
         <option value="Netherlands Antilles">Netherlands Antilles</option> 
         <option value="New Zealand">New Zealand</option> 
         <option value="Nicaragua">Nicaragua</option> 
         <option value="Niger">Niger</option> 
         <option value="Nigeria">Nigeria</option> 
         <option value="Norway">Norway</option> 
         <option value="Oman">Oman</option> 
         <option value="Pakistan">Pakistan</option> 
         <option value="Palau">Palau</option> 
         <option value="Palestinian Territories">Palestinian Territories</option> 
         <option value="Panama">Panama</option> 
         <option value="Papua New Guinea">Papua New Guinea</option> 
         <option value="Paraguay">Paraguay</option> 
         <option value="Peru">Peru</option> 
         <option value="Philippines">Philippines</option> 
         <option value="Poland">Poland</option> 
         <option value="Portugal">Portugal</option> 
         <option value="Qatar">Qatar</option> 
         <option value="Romania">Romania</option> 
         <option value="Russia">Russia</option> 
         <option value="Rwanda">Rwanda</option> 
         <option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> 
         <option value="Saint Lucia">Saint Lucia</option> 
         <option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> 
         <option value="Samoa ">Samoa </option> 
         <option value="San Marino">San Marino</option> 
         <option value="Sao Tome and Principe">Sao Tome and Principe</option> 
         <option value="Saudi Arabia">Saudi Arabia</option> 
         <option value="Senegal">Senegal</option> 
         <option value="Serbia">Serbia</option> 
         <option value="Seychelles">Seychelles</option> 
         <option value="Sierra Leone">Sierra Leone</option> 
         <option value="Singapore">Singapore</option> 
         <option value="Sint Maarten">Sint Maarten</option> 
         <option value="Slovakia">Slovakia</option> 
         <option value="Slovenia">Slovenia</option> 
         <option value="Solomon Islands">Solomon Islands</option> 
         <option value="Somalia">Somalia</option> 
         <option value="South Africa">South Africa</option> 
         <option value="South Korea">South Korea</option> 
         <option value="South Sudan">South Sudan</option> 
         <option value="Spain">Spain</option> 
         <option value="Sri Lanka">Sri Lanka</option> 
         <option value="Sudan">Sudan</option> 
         <option value="Suriname">Suriname</option> 
         <option value="Swaziland ">Swaziland </option> 
         <option value="Sweden">Sweden</option> 
         <option value="Switzerland">Switzerland</option> 
         <option value="Syria">Syria</option> 
         <option value="Taiwan">Taiwan</option> 
         <option value="Tajikistan">Tajikistan</option> 
         <option value="Tanzania">Tanzania</option> 
         <option value="Thailand">Thailand</option> 
         <option value="Timor-Leste">Timor-Leste</option> 
         <option value="Togo">Togo</option> 
         <option value="Tonga">Tonga</option> 
         <option value="Trinidad and Tobago">Trinidad and Tobago</option> 
         <option value="Tunisia">Tunisia</option> 
         <option value="Turkey">Turkey</option> 
         <option value="Turkmenistan">Turkmenistan</option> 
         <option value="Tuvalu">Tuvalu</option> 
         <option value="Uganda">Uganda</option> 
         <option value="Ukraine">Ukraine</option> 
         <option value="United Arab Emirates">United Arab Emirates</option> 
         <option value="United Kingdom">United Kingdom</option> 
         <option value="United States of America">United States of America</option> 
         <option value="Uruguay">Uruguay</option> 
         <option value="Uzbekistan">Uzbekistan</option> 
         <option value="Vanuatu">Vanuatu</option> 
         <option value="Venezuela">Venezuela</option> 
         <option value="Vietnam">Vietnam</option> 
         <option value="Yemen">Yemen</option> 
         <option value="Zambia">Zambia</option> 
         <option value="Zimbabwe">Zimbabwe</option> 
        </select><!--countries--> 
       </div><!--texfrm_i--> 

       <div class="texfrm_i" style="width:33%; float:left; margin-left:3.3px; height:66px;"> 
        <label for="st_prov" class="label_01">State/Province</label> 
        <input type="text" id="st_prov" class="tex_inp01" name="State/Province" style="width:88%; font-size:12pt;" /> 
       </div><!--texfrm_i--> 

       <div class="texfrm_i" style="width:33%; float:right; height:66px;"> 
        <label for="city" class="label_01">City</label> 
        <input type="text" id="city" class="tex_inp01" name="City" style="width:88%; font-size:12pt;" /> 
       </div><!--texfrm_i--> 

      </div><!--texfrm_o--><br /><br /> 

      <div class="texfrm_o" style="height:66px;"> 
       <div class="texfrm_i" style="width:33%; margin:auto; height:66px;"> 
        <label class="label_01">Phone Number</label> 
        <input type="text" maxlength="3" style="width:22%; float:left; margin-left:11px; font-size:16pt;" class="tex_inp01" /> 
        <input type="text" maxlength="3" style="width:22%; float:left; margin-left:9px; font-size:16pt;" class="tex_inp01" /> 
        <input type="text" maxlength="4" style="width:33%; float:right; margin-right:11px; font-size:16pt;" class="tex_inp01" /> 
       </div><!--texfrm_i--> 
      </div><!--texfrm_o--><br /><br /> 

      <div class="texfrm_o" style="height:160px"> 
       <div class="texfrm_i" style="width:66%; margin:auto; height:146px;"> 
        <label for="my_comp" class="label_01">How did you hear about my Company?</label> 
        <textarea id="my_comp" class="tex_inp01" style="width:88%; height:100px; font-size:14pt;"></textarea> 

       </div> 
      </div><br /><br /><br /> 

      <div class="texfrm_o"> 
       <div class="button" id="p1_next" style="width:22%; height:40px; margin:auto;"> 
        <div class="sub_title02">Next</div> 
       </div> 
      </div> 
     </div><!--p_content--> 

     <div id="background"></div> 
    </div><!--page01--> 

</form> 


<footer> 
</footer> 
<?php VDEnd(); ?> 
<script type="text/javascript" src="http://www.optiqvision.x10host.com/Files/Javascript/Corp_ID_and_Branding_Questionnaire.js"></script> 
</body> 
</html> 

我也通過PHP驗證器運行它,並得到0錯誤。我嘗試在textarea標籤之間放置文本,似乎阻止了它的發生,但是我在textarea裏面找到了信息,我在這裏發現了另一個帖子,他們說這裏放置了>,但我也能看到,而且我不認爲任何事情都適用於我正在做的任何事情。

是否錯誤,並在任何這種編碼的幫助棚子光?

+1

嘗試通過w3c驗證程序運行整個頁面。作爲結果,textarea有什麼問題? – charlietfl

+3

如果您在標籤之間放置文本,開發工具會顯示什麼內容? –

+1

看着張貼在之前的問題頁面有身體和頭部之間的無效的標記 – charlietfl

回答

1

這是完全正常的行爲。

開發人員工具向您展示了「已處理」的HTML頁面,例如,一些JavaScript腳本可能會對DOM進行的所有更改以及您的瀏覽器附加到頁面的更改(表單自動完成等)

因此,您在開發者工具中看到的代碼可能會在您嘗試的每個瀏覽器/插件上有所不同。你只能看到DOM的表示,因爲瀏覽器已經對它進行了處理:你的textarea是空的,它的解釋方式與自動關閉textarea相同。

嘗試一個簡單的CTRL+U,你會看到瀏覽器解析的真實源代碼沒有任何改變。你會看到你的textarea不是自動關閉的。

無論如何,這不是一個問題,你的代碼的行爲應該和它應該的一樣,因爲它是你的代碼被瀏覽器解析。

+0

如果HTML源代碼是'',那麼這實際上是一個問題。由於瀏覽器忽略了這個斜線,並且僅僅將一個'