• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

Simple Javascript help

Status
Not open for further replies.
Joined
May 23, 2005
Posts
2,036
Reaction score
50
Hiya I have

PHP:
<script>
document.write(window.location.hostname)
</script>

Which would display www.domain.com

but I would like to strip out the www. bit so it only displays domain.com

How would I do that.

Thanks
 
You should be able to use the replace function,

something like

document.write(window.location.hostname.replace(/www./i,''))
 
Status
Not open for further replies.
Top Bottom