我想在HTML頁面上用法語寫一個文本,並在同一個地方用英文隱藏翻譯。單擊JavaScript按鈕將顯示英文文本而不是法文文本,方法是更改包含文本的每個標記的Visibility
屬性。將兩個不同的文本放在HTML頁面的同一個地方
也許這不是做這種事情的最好方法,但我必須這樣做。
我試過以下的HTML和CSS代碼:
.presentationField {
vertical-align: text-top;
margin-left: auto;
margin-right: auto;
width: 500px;
border: 2px dashed blue;
}
<div id="frenchField" class="presentationField">
<h1>Les villes du Québec</h1>
<form>
Veuillez saisir le nom d'une ville au Québec<br>
<input type="text" id="recherche">
</form>
</div>
<div id="englishField" class="presentationField">
<h1>Cities of Québec</h1>
<form>
Please type the name of a town located in the province of Québec<br>
<input type="text" id="recherche">
</form>
</div>
但它不工作:以英文文本低於法國之一,我想不通爲什麼。
你能發佈一些你的javascript代碼嗎? – Khalid 2015-03-30 21:44:02