如何在Javascript输出中添加锚链接?

时间:2019-01-03 20:50:07

标签: javascript

我正在尝试仅使用javascript在页面上调用一条消息,然后使用div ID进行显示。我已经显示了消息,但是我想在消息中添加一个锚链接,但是我想做的没有用。

该怎么做?

_mm_mullo_epi16
window.onload = function() {
  var el = document.getElementById('head-msg');
  el.textContent = 'Our payment processor is currently having an issue processing payments. Please come back to make your purchase. For additional assistance, contact Customer Service' + ' <a class="btn btn-sm btn-danger" href="#">Contact Us</a>';
}
#head-msg {
  background-color: orange;
  padding: 5px;
  color: #ffffff;
}

1 个答案:

答案 0 :(得分:0)

尝试这个:

data<-read.table(text="X0      X1      X2       X3       X4       X5       X6        X7        X8        X9
 NM_001001144 6.52334 9.75243 5.62914 6.833650 6.789850 7.421440 8.675330 12.117600 11.551500  7.676900
 NM_001001327 1.89826 3.74708 1.48213 0.590923 2.915120 4.052600 0.758997  3.653680  1.931400  2.487570
 NM_001002267 1.70346 2.72858 2.10879 1.898050 3.063480 4.435810 7.499640  5.038870 11.128700 22.016500
 NM_001003717 6.02279 7.46547 7.39593 7.344080 4.568470 3.347250 2.230450  3.598560  2.470390  4.184450
 NM_001003920 1.06842 1.11961 1.38981 1.054000 0.833823 0.866511 0.795384  0.980946  0.731532  0.949049
 NM_001003953 7.50832 7.13316 4.10741 5.327390 2.311230 1.023050 2.573220  1.883740  3.215150  2.483410", header = TRUE, stringsAsFactors = FALSE)
data <- scale(t(data))
ord <- hclust( dist(data, method = "euclidean"), method = "ward.D" )$order
pd <- as.data.frame( data )
pd$Time <- sub("_.*", "", rownames(pd))
pd.m <- melt( pd, id.vars = "Time", variable.name = "Gene" )
ggplot( pd.m, aes(Time, Gene) ) +
  geom_tile(aes(fill = value)) +
  scale_x_discrete(limits=pd.m$Time[ord], labels = c("0h", "0.25h", "0.5h","1h","2h","3h","6h","12h","24h","48h"))+
  scale_y_discrete(limits=colnames(data), labels = seq_along(colnames(data)))+
  scale_fill_gradient2(low=muted("blue"), high=muted("red"))