简体   繁体   English

javascript警报框显示html货币符号

[英]javascript alert box show html currency symbol

How to show html currency symbol in javascript alert box. 如何在javascript警报框中显示html货币符号。 I am showing the message where currency and price both are dynamic so i need to get currency from html codes. 我正在显示消息,其中货币和价格都是动态的,因此我需要从html代码中获取货币。 Please provide me a solution. 请给我一个解决方案。

<p id="eu">&euro;</p>

<script type="text/javascript">
var txt = document.getElementById("eu").textContent || document.getElementById("eu").innerText;

alert(txt);
</script>

NOTE: HERE you can find html entities 注意:在 这里您可以找到html实体

It all depends on which currency sign you want. 这完全取决于您想要哪种货币符号。 The generic ¤ CURRENCY SIGN is \\xA4 ... 通用¤货币\\xA4\\xA4 ...

Use \\xA3 to represent £ , \€ to represent , and for more just use the handy tool called Character Map. 使用\\xA3表示£\€表示 ,并为更多的只是使用名为字符映射表的方便工具。

字符表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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