Nospam wrote on 28 Sep 2006 in comp.lang.javas cript:
or how to property set document.referr er, would something like this
work:
<SCRIPT LANGUAGE="JavaS cript">
use:
<script type='text/javascript'>
{
no need for the {
document.referr er == 'http://www.example.com ;
You forgot the closing apostrophe of the string:
document.referr er == 'http://www.example.com ';
Are you sure document.referr er 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.refer rer == '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:60 px;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:60 px;height:60px' >";
if (document.refer rer.substr(0,ur l.length) == url)
document.write( s);
</script>
not tested
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)