64
rated 0 times
[
70]
[
6]
/ answers: 1 / hits: 15482
/ 9 Years ago, mon, december 7, 2015, 12:00:00
So, Ive read through similar things but I still can't find an answer that applies more closely to what I'm doing. I am attempting to use JS to get the current page URL and append it to a social media sharing link like this:
<a href=http://reddit.com/submit?url=CURRENTPAGE.html; title=This is a post! target=_blank>
Using Javascript, I've managed to assign the current URL to a variable:
<script>
var x = window.location.href;
document.getElementById(smsharing).innerHTML = x;
</script></p>
And I made sure it worked by doing a test display of it. So what exactly is the proper method/syntax for actually putting 'x' in place of CURRENTPAGE.html???
I know this is a STUPID question, but I'm really stumped. Specifics help, because part of the problem is that I have precious little knowledge of JS. Thoughts?
More From » html