clonetrooper9494 Posted January 23, 2008 Share Posted January 23, 2008 I have a page that has some javascript that is document.writing a whole bunch of HTML... but it is not working! can anybody see any errors? <html><head><title></title></head><body><textarea id="extra2"></textarea><script>var abc = "<scri" + "pt type=\"text/javascript\">var x = '0';var y = '0';function show_coords(e){ e = (e) ? e : window.event; x = e.clientX; y = e.clientY;}document.onmousemove = show_coords;function movemenu(){document.getElementById('menu').style.left = x + 'px';document.getElementById('menu').style.top = y + 'px';return false}function movemenuback(){document.getElementById('menu').style.left = '-100px';document.getElementById('menu').style.top = '-100px';return false}</sc" + "ript><body oncontextmenu=\"return movemenu()\" onclick='movemenuback()'><div id=\"menu\" style=\"position:absolute;top:-100;left:-100;display:block;\"><table border='1' bgcolor='EEEEEE' bordercolor='BBBBBB' style=\"border-collapse: collapse;\"><tr><td><table border='0' bgcolor='EEEEEE' bordercolor='BBBBBB'><tr><td onmouseover=\"this.style.backgroundColor = '#BBBBBB'\" onmouseout=\"this.style.backgroundColor = '#EEEEEE'\" style='background-color:EEEEEE;' onclick=\" window.location='http://clone-drone.net'\">Home</tr></td><tr><td onmouseover=\"this.style.backgroundColor = '#BBBBBB'\" onmouseout=\"this.style.backgroundColor = '#EEEEEE'\" style='background-color:EEEEEE;' onclick=\" window.location='http://clone-drone.net'\">Games</tr></td><tr><td onmouseover=\"this.style.backgroundColor = '#BBBBBB'\" onmouseout=\"this.style.backgroundColor = '#EEEEEE'\" style='background-color:EEEEEE;' onclick=\" window.location='http://cmail.clone-drone.net'\">Clone-Mail<textarea style=\"display:none\" id=\"addon\"></tr></td><tr><td><hr width=\"90%\"></td></tr><tr></textarea><textarea style=\"display:none\" id=\"extra\"></textarea><scr" + "ipt type=\"text/javascript\">var t = document.getElementById('extra').value;var p = document.getElementById('addon').value;if(t == ''){document.write('')}else{document.write(p + t)}</sc" + "ript></tr></td></table></tr></td></table></div>";document.write(abc)</script></body></html> Link to comment Share on other sites More sharing options...
Ingolme Posted January 23, 2008 Share Posted January 23, 2008 But why on earth are you trying to write all that mark-up? Can't you just write that HTML itself? Especially since it contains another script tag.Other than that, you can't put line breaks within Javascript instructions, so you'd have to substitute all those for \n and put it all in one lineLike this:var abc="<scri" + "pt type=\"text/javascript\">\n\nvar x = '0';\nvar y = '0';\n\nfunction sh... ... ... Link to comment Share on other sites More sharing options...
Synook Posted January 23, 2008 Share Posted January 23, 2008 He could also escape the line breaks like so var abc = "\\<scri" + "pt type=\"text/javascript\">\var x = '0';\var y = '0';\function show_coords(e)\{\//... ... Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted January 23, 2008 Share Posted January 23, 2008 Jesus christ that is such an over-complication of the way the code can be written. Use HTML. Higher P.R.'s. JavaScript lowers P.R. from what I've heard. This is a text-book example I believe. Link to comment Share on other sites More sharing options...
clonetrooper9494 Posted January 23, 2008 Author Share Posted January 23, 2008 I guess that the script(the one inside of the other script) could be fused with the main script(the script that writes all of the HTML)... and I need all of that because it is my navigation for my site. is there an easier way to do this(other than AJAX)?Here just let me rewrite it: <textarea style="display:none" id="addon"></tr></td><tr><td><hr width="90%"></td></tr><tr></textarea><textarea style="display:none" id="extra"></textarea><script>var abc = "<body oncontextmenu=\"return movemenu()\" onclick='movemenuback()'><div id=\"menu\" style=\"position:absolute;top:-100;left:-100;display:block;\"><table border='1' bgcolor='EEEEEE' bordercolor='BBBBBB' style=\"border-collapse: collapse;\"><tr><td><table border='0' bgcolor='EEEEEE' bordercolor='BBBBBB'><tr><td onmouseover=\"this.style.backgroundColor = '#BBBBBB'\" onmouseout=\"this.style.backgroundColor = '#EEEEEE'\" style='background-color:EEEEEE;' onclick=\" window.location='http://clone-drone.net'\">Home</tr></td><tr><td onmouseover=\"this.style.backgroundColor = '#BBBBBB'\" onmouseout=\"this.style.backgroundColor = '#EEEEEE'\" style='background-color:EEEEEE;' onclick=\" window.location='http://clone-drone.net'\">Games</tr></td><tr><td onmouseover=\"this.style.backgroundColor = '#BBBBBB'\" onmouseout=\"this.style.backgroundColor = '#EEEEEE'\" style='background-color:EEEEEE;' onclick=\" window.location='http://cmail.clone-drone.net'\">Clone-Mail" + abc2 + "<scr" + "ipt type=\"text/javascript\">var t = document.getElementById('extra').value;var p = document.getElementById('addon').value;if(t == ''){document.write('')}else{document.write(p + t)}</sc" + "ript></tr></td></table></tr></td></table></div>";document.write(abc)var x = '0';var y = '0';function show_coords(e){ e = (e) ? e : window.event; x = e.clientX; y = e.clientY;}document.onmousemove = show_coords;function movemenu(){document.getElementById('menu').style.left = x + 'px';document.getElementById('menu').style.top = y + 'px';return false}function movemenuback(){document.getElementById('menu').style.left = '-100px';document.getElementById('menu').style.top = '-100px';return false}</script> I still need to ediot tghis Link to comment Share on other sites More sharing options...
Synook Posted January 24, 2008 Share Posted January 24, 2008 JavaScript lowers P.R. from what I've heard.Having JavaScript in itself won't lower PR, however since most search engine robots can't run JavaScript any content that is written to the page through JavaScript won't get considered in the PR. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted January 24, 2008 Share Posted January 24, 2008 Yea that's what I meant. You just basically helped me say what I tried. HTML will get considered and thus helping your P.R. Link to comment Share on other sites More sharing options...
clonetrooper9494 Posted January 25, 2008 Author Share Posted January 25, 2008 Alright, thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.