Question about Document Write

by 3 replies
4
For some reason, the following code:

document.write('<a href="'+link+'" target="_blank"><img src="'+adBanner+'" width="125" height="125" alt="'+alt+'" title="'+title+'" /></a>');

Is causing the following error:

Not sure what to make of it? Can my document write code be written differently? Thanks.
#programming #document #question #write
  • Hello,
    In case you haven't been able to resolve this yet...
    You're closing the 'a' tag twice. A "self-closing" tag is when an element ends with a forward slash & greater than symbols () and no ending tag. When an element ends with the tag, like ending with the '', then it is not. The above code has both.

    Try removing the second forward slash before the end and see if that clears it up for you.
    would then look like:
    Hope it helps.
    • [ 1 ] Thanks
    • [1] reply
    • I just double checked, removing the second forward slash actually created another error message in the following:

      That's why I added the second forward slash in there in the first place. But thanks anyway.
  • [DELETED]
  • [DELETED]
  • Try removing the > so it looks like this

    Code:
    document.write('<a href="'+link+'" rel="nofollow" target="_blank"><img src="'+adBanner+'" width="125" height="125" alt="'+alt+'" title="'+title+'" </a>');
    • [ 1 ] Thanks

Next Topics on Trending Feed