2009-11-17 59 views

回答

5

不,你不能。你必須使用腳本來連接onlcick的事件處理程序。

<a href="Somepage.html" target="_blank">Click me</a> 

並且用戶代理確定頁面是否應該在新窗口或選項卡中打開。

如果您需要自定義大小的新彈出的窗口中,你必須使用

window.open

,你不能使用,沒有腳本。

+0

然後我們可以使用顯示的東西onhover沒有點擊使用CSS:懸停? – 2009-11-17 11:07:21

+0

我強烈建議你只使用javascript。可能是一個框架。但你在這裏問的是可能的。拿出這個鏈接 http://stackoverflow.com/questions/1266929/showing-floating-div-in-a-gridview/1267290#1267290 它應該提供您尋找的答案。 – Zoidberg 2009-11-17 11:33:54

0

從理論上講,你可以用<button>,:focus和一些討厭的定位代碼來僞造它。

...但這會涉及到極端的醜陋水平。

CSS並非專門用於爲頁面添加交互性。它是一種演示語言。

讓JavaScript處理自定義的交互,就是這樣(但總是務實的 - progressively enhance)。

2

你不能,但你可以使用CSS創建工具提示。 It can do the trick

您可以設置一個適當的標記:

<div id="example"> 
    Result : 
    <a href="#" class="tooltip"> 
     Article 1 
     <span>Article 1's Title, Article 1's description.</span> 
    </a>. 
</div> 

然後用hover樣式是:

#example { 
    float:left; 
    width:400px; 
    padding:15px; 
    background-color:#FFFFFF; 
} 
a { 
    background-color:#FFFFFF; 
    color:#000000; 
    text-decoration:underline; 
} 
a:hover { 
    background-color:#ffffff; 
    text-decoration:none; 
} /* background-color for IE6*/ 

/* hiding the tooltip*/ 
a.tooltip span { 
    display:none; /* if you have accessibility issues, you may choose other hiding tricks*/ 
    padding:2px 3px; 
    margin-left:10px; 
    width:150px; 
} 
/* display on hover*/ 
    a.tooltip:hover span{ 
    display:inline; 
    position:absolute; 
    border:1px solid #cccccc; 
    background:#ffffff; 
    color: #000; 
} 
+0

正如我所說,你不能打開沒有JavaScript或使用_blank彈出。您可以將內容顯示在懸停上。沒有任何東西阻止你使用我在當前彈出窗口中看到的內容使用我提供給你的代碼片段。 – 2009-11-17 15:37:20

相關問題