Nospam wrote on 28 Sep 2006 in comp.lang.javascript
:
or how to property set document.referrer, would something like this
work:
<SCRIPT LANGUAGE="JavaScript">
use:
<script type='text/javascript'>
{
no need for the {
document.referrer == 'http://www.example.com;
You forgot the closing apostrophe of the string:
document.referrer == 'http://www.example.com';
Are you sure document.referrer would not return:
'http://www.example.com/'
or
'http://www.example.com/index.html'
etc?
Or do you want to test true for any referrer from that domain?
The double '==' compares the two strings, but you do not use the result.
Do you mean:
if (document.referrer == 'http://www.example.com')
document.write('...
??
document.write('<img src=http://www.example.com/image1.jpg width="60"
height="60">');
I would enclose the URL string in quotes
scr="http://www.example.com/image1.jpg"
width="60"
height="60"
Use css styles:
style='width:60px;height:60px'
>
}
no need for that }
</SCRIPT>
===============
I would suggest the following:
<script type='text/javascript'>
var url = 'http://www.example.com';
var s = "<img src='"+url+"/image1.jpg'";
s += " style='width:60px;height:60px'>";
if (document.referrer.substr(0,url.length) == url)
document.write(s);
</script>
not tested
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)