1
我有2個域名前往我的網站,但我想更改ID爲#logo的div的類別。如果域名更改爲div的類別=
我曾嘗試以下,但沒有運氣...
<script type="text/javascript">
var hasChar1 = window.location.href.indexOf('domain01') != -1;
var hasChar2 = window.location.href.indexOf('domain') != -1;
if (hasChar1)
{
if (hasChar1)
{document.getElementById("logo").className = "logoNZ";}
else
{document.getElementById("logo").className = "";}
}
else if (hasChar2)
{document.getElementById("logo").className = "";}
</script>