You can use window.location
to get several different parts of the current website url.
For full url
window.location.href
"https://stackoverflow.com/questions/33484823/chaning-html-link-based-upon-different-parked-domains"
For domain only
window.location.hostname
"stackoverflow.com"
You could then use this window.location.hostname
in the link you provide to your sales page (lets say www.sales.com), and pass it as a query parameter in the url.
// Navigate to sales page with domain as query parameter.
function goToSales() {
location.href = "http://www.sales.com/?domain=" + window.location.hostname;
}
<a onclick="goToSales()">Buy domain!</a>
On the sales page you could then use javascript again and read the domain from window.location.search
or any other prefered way to get query params in your server language.
For more examples of the attributes in window.location
you can check this interactive site as referenced from here location.host vs location.hostname and cross-browser compatibility?