Link to home
Start Free TrialLog in
Avatar of Phonebuff
PhonebuffFlag for United States of America

asked on

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 --
ASKER CERTIFIED SOLUTION
Avatar of Phonebuff
Phonebuff
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Phonebuff

ASKER

Found my own answer --