Phonebuff
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.
This block of code where I hard code a URL also works as I need it to.
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................. ."
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 --
This block of code works -- An displays the proper URL vale.
<script language="JavaScript"> document.write(document.referrer); </script>
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;" >
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; " >
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER