dansbanners Posted September 4, 2019 Share Posted September 4, 2019 The following codes Quote: document.write('<a'+link+'" target="_blank"><img src="'+adBanner+'" width="125" height="125" alt="'+alt+'" title="'+title+'" /></a>'); Is causing this error message: Quote: document type does not allow element "a" here The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements Does anyone have any suggestion on how to fix the above dilemma? Thanks. Can the document write be written in a different way other than the one shown above in this thread? Thanks in advance! Link to comment Share on other sites More sharing options...
justsomeguy Posted September 5, 2019 Share Posted September 5, 2019 It sounds like you have something that is confused about your code and thinks that the string inside your Javascript code is actually HTML code instead of a Javascript string. The bug is in whatever is giving you that message, assuming the rest of your HTML code is structured correctly (e.g., that Javascript code is inside a script element). Link to comment Share on other sites More sharing options...
Ingolme Posted September 5, 2019 Share Posted September 5, 2019 You can replace the < with <. The message you're showing looks like it's from an HTML validator, not a browser. Link to comment Share on other sites More sharing options...
iwato Posted September 7, 2019 Share Posted September 7, 2019 You appear to have left out the href attribute. Try the following: document.write('<a href="' + link + '" target="_blank"><img src="' + adBanner + '" width="125" height="125" alt="' + alt + '" title="' + title + '" /></a>'); Roddy p.s. If it helps, hover over the heart and click on the trophy that results. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now