PDA

View Full Version : SOLVED can't link to site from banner


Stefan118
03-01-2011, 12:21 AM
Hello,

I want to place 3 banners on my forum.
The banners have to resize depending on the screen resolution of the user.
Choices are 1024x768 and 1280x1024.

This works all well.
But I also want to redirect the member to the website of the banner in an other screen.
I can't figure out how to do this.
I tried the usual <a href="................."> on different places but nothing works.

Who can help me?

I have placed the folowing script in the advertising area.

<script language="javascript" type="text/javascript" src="/templates/high_javascript.js">
<!--
//var iWidth = 0;
//var iHeight = 0;

//-->
</script>

<center>

<script type="text/Javascript">
<!--
/*initialization for IE! Leave this funtion after the body tag */
/*if(!window.Width && document.body && document.body.offsetWidth)
{
//window.onresize = recal;
//alert("line114!");
Width = windowWidth();
Height = windowHeight();
//alert(Width + "<br>" + Height);
//alert("width");
}
*/
//-->
var iWidth, iHeight, sRes;
if (window.innerWidth != null) {
//alert("first");
iWidth = window.innerWidth;
iHeight = window.innerHeight;
}
else if (document.body.clientWidth != null) {
//alert("second");
iWidth = document.body.clientWidth;
iHeight=document.body.clientHeight;
}
else {
//alert("third");
}

var imgPath1 = "left.jpg";
var imgPath2 = "center.jpg";
var imgPath3 = "right.jpg";
var imgAlt = "Click here to go to the website of the sponsor.";


if (iWidth <= 1100) {
document.write("<img src='/images/advertenties/" + imgPath1 + "' vspace='20' alt='" + imgAlt + "' width='190'>");
document.write("&nbsp;&nbsp;");
document.write("<img src='/images/advertenties/" + imgPath2 + "' vspace='20' alt='" + imgAlt + "' width='250'>");
document.write("&nbsp;&nbsp;");
document.write("<img src='/images/advertenties/" + imgPath3 + "' vspace='20' alt='" + imgAlt + "' width='190'>");
}

else {
document.write("<img src='/images/advertenties/" + imgPath1 + "' vspace='20' alt='" + imgAlt + "' width='250'>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;");
document.write("<img src='/images/advertenties/" + imgPath2 + "' vspace='20' alt='" + imgAlt + "' width='400'>");
document.write("&nbsp;&nbsp;&nbsp;&nbsp;");
document.write("<img src='/images/advertenties/" + imgPath3 + "' vspace='20' alt='" + imgAlt + "' width='250'>");
}

</script>
</center>

Lynne
03-01-2011, 01:50 AM
Can you post your code with the URL in it that you tried to add so we can see what was wrong?

Stefan118
03-01-2011, 01:04 PM
I fixed it.

What i did was this:
document.write("<a href="http://www.hondaciviccrewapeldoorn.nl"><img src='/images/advertenties/" + imgPath1 + " alt='" + imgAlt + "' width='250'></a>");

What i had to do was this:
document.write("<a href=http://www.hondaciviccrewapeldoorn.nl><img src='/images/advertenties/" + imgPath1 + "' alt='" + imgAlt + "' width='190'></a>");

The only diffrence between them are the " " infront and after the link.
<a href="http://www.hondaciviccrewapeldoorn.nl">
<a href=http://www.hondaciviccrewapeldoorn.nl>

Took me only more than 2 days!

Lynne
03-01-2011, 03:33 PM
Did you try just escaping the quotes?
document.write("<a href=\"http://www.hondaciviccrewapeldoorn.nl\"><img src='/images/advertenties/" + imgPath1 + " alt='" + imgAlt + "' width='250'></a>");