PDA

View Full Version : String Concatenation



Wiki Skinz
04-17-2007, 01:50 AM
I am trying to concatenate a few strings and variables, but am having trouble because whenever I validate the page, it tells me that the quote after the a href must be literal.


<li><script type="text/javascript">document.write("<a href=\"" + wgServer + wgScriptPath + "/index.php?title=Special:Search\"><img src=\"http://wikiskinz.byethost7.com/forums/images/toplinks/search.gif\" alt=\"\" />Search</a>");</script></li>

http://validator.w3.org/check?uri=http&#37;3A%2F%2Fwikiskinz.byethost7.com%2Fwiki%2Findex.php%2FMain_Page&charset=%28detect+automatically%29&doctype=Inline&ss=1

boogyman
04-17-2007, 02:17 AM
the validator site is currently down, however here is the script



<li>
<script type="text/javascript">
document.write("
<a href=\"" + wgServer + wgScriptPath + "/index.php?title=Special:Search\">
<img src=\"http://wikiskinz.byethost7.com/forums/images/toplinks/search.gif\" alt=\"\" />Search</a>
");
</script>
</li>

codeexploiter
04-17-2007, 04:51 AM
This will also do the job



<li><script type="text/javascript">document.write("<a href='" + wgServer + wgScriptPath + "/index.php?title=Special:Search'><img src='http://wikiskinz.byethost7.com/forums/images/toplinks/search.gif' alt='' />Search</a>");</script></li>

Twey
04-17-2007, 05:16 PM
The preferred method is to make the script external.