繁体   English   中英

如何隐藏超链接下划线并在javascript中保持原字体颜色?

[英]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' ) ">&nbsp;&nbsp;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;">&nbsp;&nbsp;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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM