USing a Variable with == javascript:window.location.href

I first need to say my skills in this area are vary basic and I often have to code Javascript with the help of Google..

This block of code works --  An displays the proper URL vale.
<script language="JavaScript">  document.write(document.referrer); </script>

Open in new window


This block of code where I hard code a URL also works as I need it to.
<INPUT TYPE="button" class="largeButton"  VALUE="Back" onclick="javascript:window.location.href='http://xxxxxx.xxxxxxxxx.net'; return false;" >

Open in new window


But when I try and combine the two functions into one so that the code can be reused with out being updated each time, it breaks.   Everything to the right of  <script language="javascript">   appears as text on the page -- "document.................."
<INPUT TYPE="button" class="largeButton"  VALUE="Back" onclick="javascript:window.location.href=<script language="JavaScript"> document.write(document.referrer) </script> ; return false; " >

Open in new window


So I must not be building the string incorrectly, but I am not sure what I am missing and while Google has found some examples, all are back a few years and so far nothing has helped..

TIA --
LVL 15
PhonebuffAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PhonebuffAuthor Commented:
Never Mind Found the Answer --

<script language="JavaScript"> var $link; $link = document.referrer; </script> 
<INPUT TYPE="button" class="largeButton"  VALUE="Back" onclick="javascript:window.location.href=$link; return false;" >

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PhonebuffAuthor Commented:
Found my own answer --
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.