[英]How to hide the hyperlink underline and maintain the origin font color in javascripts?
如何通過避免在JavaScript中更改為藍色字體來隱藏超鏈接下划線並保持原點。 我的JavaScript代碼:
<a href="javascript:window.open('selectprofiletype.php','Crm.com - Create',
'width=700,height=350' ) "> User Profile</a>
為什么要使用JavaScript? 使用CSS。
a {
text-decoration: none;
color: black;
}
希望這可以幫助:
a {
color: #0060B6;
text-decoration: none;
}
a:hover
{
text-decoration:none;
color: #0060B6;
cursor:pointer;
}
這似乎更像一個css
問題
a{
text-decoration: none;
color: your colour here;
}
請將JavaScript更改為以下內容(並為CSS使用其他任何答案,而不要使用內聯樣式)
<a href="selectprofiletype.php" target="crm_create" style="text-decoration:none"
onclick="var w = window.open(this.href,this.target,'width=700,height=350');
return w?false:true;"> User Profile</a>
因為您的代碼將在多個瀏覽器中出現問題-例如,窗口名稱可能沒有空格
如果不引人注意,該代碼會更好:
window.onload=function() {
document.getElementById("crm").onclick=function() {
var w = window.open(this.href,this.target,'width=700,height=350');
return w?false:true;
}
}
僅使用
<a id="crm" href="selectprofiletype.php" target="crm_create">User Profile</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.