在列表視圖事件的ListView1_ItemDataBound動態文本,我創建了literal.text是這樣的...創造一個字面控制
<span style="position:relative;">
style="position:relative">
<span id="term1" class="popup">This id="term1" class="popup">This is the answer!</span>
<a href="javascript:void(0);"onMouseover="ShowPop('term1');" onMouseout="HidePop('term1');">Show href="javascript:void(0);"onMouseover="ShowPop('term1')" onMouseout="HidePop('term1')">Show me the answer</a></span>
的問題是,該文本不渲染,因爲它應該。 在鼠標懸停字面控制的URL是
http://localhost:1391/"javascript:void(0);"onMouseover="ShowPop('term1');"
那麼,什麼是怎麼回事?我錯過了什麼?
UPDATE1: 這裏是來自瀏覽器的源
<span style="position:relative;"> <span id="term1" class="popup">This is the answer!</span> <a href="javascript:void(0);" onMouseover="ShowPop('term1');" onMouseout="HidePop('term1');">Show me the answer</a></span>
UPDATE2: 這裏是從屏幕
This is the answer Show me the answer
的輸出,其中...
顯示我的答案是指向http://localhost:1391/"javascript:void(0);"
的超鏈接
你好,問題依然存在。現在url指向http:// localhost:1391 /「javascript:void(0);」 – OrElse 2010-05-26 17:22:50
@strakastroukas - 我將你的代碼粘貼到一個新的HTML文檔中,並在Firefox中打開。它顯示「javascript:void(0);」作爲URL,如預期的那樣。 – Oded 2010-05-26 17:29:39
@Oded - 我也在Visual Studio的設計選項卡中嘗試這一個,它也可以工作。這個問題可能是由於文本文本是在listview的itemdatabound事件中動態創建的。或者至少我想不出別的。 – OrElse 2010-05-26 17:34:21