在html元素中锚定 [英] anchor in html element
问题描述
大家好
每当我单击链接时,单击一次都没有显示时,我将面临一个问题.我需要双击链接,然后在显示答案的
处显示.
当我再次单击(单击)在同一链接上时,答案消失了.
所以为什么在单击链接后它不显示答案.我需要在链接上单击两次,然后出现以下
Hello everyone
I am facing a problem whenever I click on link doesn''t show on single click. I need to do double click on link then it display the
where an answer is written.
and as i again click(single click) on the same link it answer get disappear.
so why it doesn''t show answer on single click of the link. I need to click twice on the link then it appear the following
.head
{
font-size:16px;
font-weight:bold;
text-decoration:underline;
}
.quest
{
padding-left:15px;
cursor:pointer;
}
.answer
{
padding-left:12px;
display:none;
}
我在.aspx
中使用以下代码
I am using the following code in .aspx
<fieldset>
<ul id="odUL">
<li id="Order"><span class="head">Order:</span>
<ul><br />
<li class="quest" onclick="showAnswer('od1')">
<u><span style="cursor:hand;">What does an order mean?</span></u>
<p id="od1" class="answer">
<b>Ans.</b> An order is a quantity of goods or items purchased.
</p>
</li>
<li class="quest">
<a href="javascript:showAnswer('od2')">
How can i check my current order status?
</a>
<p id="od2" class="answer">
<b>Ans.</b> You can check current order statur in MyOrders section.
</p>
</li>
</ul>
</fieldset>
我正在使用以下javascript代码
</ul>
</fieldset>
I am using the following javascript code
function showAnswer(element)
{
if(document.getElementById(element).style.display=="none")
{
document.getElementById(element).style.display="block";
}
else
{
document.getElementById(element).style.display="none";
}
}
推荐答案
请尝试以下操作:
< pre> document.getElementById(element).style.display =";</pre>
please try this for show:
<pre>document.getElementById(element).style.display="";</pre>
这篇关于在html元素中锚定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!