Logged Out
Create an Account
Login:
Password:

Forgot your password?
Quote and more quotes that conflict with quotes

Quote and more quotes that conflict with quotes
[Back to Index]
Thread Tags
Primary: [Advanced Layout]
Secondary: None

Yes I'm still at it, had to take a couple weeks off. The redesign of this site was just frustrating me beyond comprehention and I didn't think it good to put up another blasting post.


<div id="Raid Progression_standalone" class="hideit"><center class=xsmall>Mouse Over the Zone for Details</center><table cellspacing=0 width='100%'> <tr style="font-size:9pt;" onMouseOver="tt('<table class=ttb><tr><td><tr><td>Gruul</td><td> </td></tr><tr><td><strike><b>High King Maulgar</b></strike></td><td>(Killed)</td></tr></table>')" onMouseOut='ctt()' class=MenuChoice>
<td><img src="images/zones/wow/gruul.gif"></td>
<td>Gruuls lair</td>
<td>(1/2)</td>
</tr> <tr style="font-size:9pt;" onMouseOver="tt('<table class=ttb><tr><td><tr><td><strike><b>Attumen the Huntsman</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Moroes</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Maiden of Virtue</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Opera Event</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>The Curator</b></strike></td><td>(Killed)</td></tr><tr><td>Terestian Illhoof</td><td> </td></tr><tr><td><strike><b>Shade of Aran</b></strike></td><td>(Killed)</td></tr><tr><td>Netherspite</td><td> </td></tr><tr><td>Prince Malchezaar</td><td> </td></tr><tr><td>Nightbane</td><td> </td></tr></table>')" onMouseOut='ctt()' class=MenuChoice>
<td><img src="images/zones/wow/kara.gif"></td>
<td>Karazhan</td>
<td>(6/10)</td>
</tr> <tr style="font-size:9pt;" onMouseOver="tt('<table class=ttb><tr><td><tr><td><strike><b>Huntsman</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Moroes</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Maiden</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Opera Event</b></strike></td><td>(Killed)</td></tr><tr><td><strike><b>Curator</b></strike></td><td>(Killed)</td></tr><tr><td>Terestian Illhoof</td><td> </td></tr><tr><td><strike><b>Shade of Aran</b></strike></td><td>(Killed)</td></tr><tr><td>Prince</td><td> </td></tr><tr><td>Netherspite</td><td> </td></tr><tr><td>Nightbane</td><td> </td></tr></table>')" onMouseOut='ctt()' class=MenuChoice>
<td><img src="images/zones/wow/kara.gif"></td>
<td>Karazhan Two</td>
<td>(6/10)</td>
</tr></table></div>



var GettheSAContent = document.getElementById("<!-- Menu:Title -->_standalone").innerHTML;
var GettheMLContent = document.getElementById("<!-- Menu:Title -->_menulists").innerHTML;

if (GettheSAContent !=""){

var RemoveQuotes = GettheSAContent.replace(/\"/gm, "'");

var NewContent = RemoveQuotes.replace(/\r/gm, " ");
}
else {
var RemoveQuotes = GettheMLContent.replace(/\"/gm, "'");

var NewContent = RemoveQuotes.replace(/\r/gm, " ");
}


As you can guess I am striping out double quotes (") and replacing them with single quotes(')

Problem is that all the onMouseOver functions are in double quotes, with the html that is to be displayed, in sigle quotes this obviously causes major problems.

Anybody have a solution.

PS. I know you don't allow PHP but can we use ASP or CGI. Cause at this point I am willing to get out my old books and relearn it.
Just noticed that my above post has alot of in it makes the post look like I am mad. Just thought someone might want to fix that.
How come you're stripping out the double quotes for single quotes?

That's naturally going to cause problem with javascript containing strings inside the tags.

What are you trying to accomplish, that requires the removal of all double-quotes?

Side: The Solution to getting rid of the smilies is to edit your original post, and check the box for "disable smilies"


--
It's all in the reflexes.
The reason is because I am placing the value of "NewContent" in a function (the function is called in the layout.htm) so that the menupage.htm doesn't end up being 200 plus lines long. And beyond that if I need to diagnos the test page I don't have to look through some 3000 plus lines of code.


menupage.htm

<div id="<!-- Menu:Title -->_menulists" class="hideit">
<!-- Menu:StartItemList -->
<tr>
<td class='MenuChoice' align='left'>
<!-- Menu:StartItem -->

<!-- Menu:EndItem -->
</td>
</tr>
<!-- Menu:EndItemList -->
</div>
<div id="<!-- Menu:Title -->_standalone" class="hideit"><!-- Menu:StartStandAlone --><!-- Menu:StandAloneContent --><!-- Menu:EndStandAlone --></div>
<script type="text/javascript" language="javascript">
var MenusTitle = "<!-- Menu:Title -->";
var change = MenusTitle.split(":");
var loggedin = (change[0]);
var titleup = MenusTitle.toUpperCase();

var GettheSAContent = document.getElementById("<!-- Menu:Title -->_standalone").innerHTML;
var GettheMLContent = document.getElementById("<!-- Menu:Title -->_menulists").innerHTML;

if (GettheSAContent !=""){

var RemoveQuotes = GettheSAContent.replace(/\"/gm, "'");

var NewContent = RemoveQuotes.replace(/\r/gm, " ");
}
else {
var RemoveQuotes = GettheMLContent.replace(/\"/gm, "'");

var NewContent = RemoveQuotes.replace(/\r/gm, " ");
}

if (MenusTitle == "Login"){
var MenusTitle = "Login Here";
LoggedInMenu()
}
else if (loggedin == "Logged In"){
LoggedInMenu()
}
else if (MenusTitle == "Server Status"){
ServerStatusMenu()
}
else {
AllOtherMenus()
}
</script>

funtion in layout.htm

function AllOtherMenus(){
document.write ("<tr>");
document.write ("<td valign='top' align='left'>");
document.write ("<table width='220' border='0'cellpadding='0' cellspacing='0' id='" + abreviate + "2'>");
document.write ("<tr>");
document.write ("<td height='9' style='background: url(http://dkpfiles.com/unknownentity/files/bannertop-lg.gif); background-repeat: no-repeat; font-size: 2px;'>");
document.write ("&nbsp;");
document.write ("</td>");
document.write ("</tr>");
document.write ("<tr>");
document.write ("<td valign="top" align="center">");
document.write ("<table width="200" border="0"cellpadding="0" cellspacing="0" class="miscmenu2">");
document.write ("<tr>");
document.write ("<td width='50' valign='middle' align='center'>");
document.write(titleup);
document.write ("</td>");
document.write ("</tr>");
document.write ("<tr>");
document.write ("<td width='100%' valign='top' align='center' style='padding-right: 10px;'>");
document.write (NewContent);
document.write ("</td>");
document.write ("</tr>");
document.write ("</table>");
document.write ("</td>");
document.write ("</tr>");
document.write ("<tr>");
document.write ("<td>");
document.write ("<img src='http://dkpfiles.com/unknownentity/files/bannerbottom-lg.gif' width='200' height='62' border='0'>");
document.write ("</td>");
document.write ("</tr>");
document.write ("</table>");
document.write ("</td>");
document.write ("</tr>");
}


If you think that is bad I may very well change it all to parse all the tags in each dynamic includes into arrays so I can make adjustments line by line. But that is a thought for another time right now just need a way to fix my previously stated problem.

I am open to a complete revamp of how I am doing it.
If document.write (NewContent); is the only usage of the NewContent variable, there's no need to strip the quotes. It'll just print like it prints on the page.

If the variable contains quotes, that's not going to throw anything off when it's printed, it's just going to write the quotes to the page as if it were being sent from the server.


--
It's all in the reflexes.
Yes, but the "AllOtherMenus()" function is created in the header of the layout.htm page. Calling the "<!-- Menu:StandAloneContent -->" in the header makes it so that it is a blank when the page loads and hence all the menus will be blank also. To over come that I had to have the "NewContent" variable created at the time the menupage.htm is called. And then once the menupage.htm determines which menu it is being called for, it will create the "NewContent" variable to be used by the "AllOtherMenus()" function, which is called further down in the menupage.htm.

Also,

document.write ("<!-- Menu:StandAloneContent -->");

still requires that the quotes be changed for it to work.

Quote by Chops

Side: The Solution to getting rid of the smilies is to edit your original post, and check the box for "disable smilies"


Ok, just assummed that would be the issue as all that code is inside of the [code] tags



Quote
Yes, but the "AllOtherMenus()" function is created in the header of the layout.htm page. Calling the "<!-- Menu:StandAloneContent -->" in the header makes it so that it is a blank when the page loads and hence all the menus will be blank also. To over come that I had to have the "NewContent" variable created at the time the menupage.htm is called. And then once the menupage.htm determines which menu it is being called for, it will create the "NewContent" variable to be used by the "AllOtherMenus()" function, which is called further down in the menupage.htm.


But that doesn't really explain why the quotes need to be stripped.

Notice that there's nothing wrong with the following code:

var some_string_with_quotes = "<b style=\"font-weight:bold\">ain't it swell?</b>";

document.wriote(some_string_with_quotes);


This will simply print:

<b style="font-weight:bold">ain't it swell?</b>


Even THIS works:


<script>
var some_string_with_quotes = "<b style=\"font-weight:bold\">ain't it swell?</b>";
</script>

...

<span onMouseOver="tt(some_string_with_quotes)">Hover over me</span>


That works because the "some_string_with_quotes" doesn't render inside the HTML, but rather is considered a string, and therefore renders only in the javascript engine when prompted to perform the popup (the tt() function is the tooltip function that I use).


The only REAL problem you'll face is trying to do something like this:


var some_string_with_quotes = "<b style=\"font-weight:bold\">ain't it swell?</b>";


document.write("<span onMouseOver=\"tt('" + some_string_with_quotes + "')\">Hover over Me</span>");



That fails because it's concatenating the string, which forces it to be rendered in the page, rather than storing the value in the variable properly.

Generally speaking, once the string is properly stored in the variable, from the innerHTML element, it's safe for javascript usage for calling functions and really anything EXCEPT forcing it to be rendered in the page.

Am I making sense? You are not doing the third example, but are doing more closely the 1st example, which itself should not cause a problem. All you're doing is reprinting the contents of that variable onto the HTML. No formatting is necessary.


--
It's all in the reflexes.

<span onMouseOver="tt(some_string_with_quotes)">Hover over me</span>


Is an example of some of the code that is being dynamically included for menus like the <!-- System:Menu:Recruiting -->.

And as I am using javascript to grap it and place it were I need it, I end up, in essence with:


document.write("<span onMouseOver=\"tt('" + some_string_with_quotes + "')\">Hover over Me</span>");


Now I did try to change my javascript to .replace (/\"/gm, "\\\"")and ran into more errors.

I am guessing you may need the whole picture to see what I am dealing with. The test page is http://unknownentity.dkpsystem.com/test.php I have reverted it back to a point before I started tinkering with this problem so you can see what is happening. Pardon the mess it is very raw and once all the bugs are worked out I will be doing some agressive cleaning and triming. I have tested it to work in both IE and FireFox. If you view the source it is only a little over 1000 lines and you should beable to with relative easy figure out what is what.

You will notice 3 problems:

1. <!-- System:Menu:Raid Progression --> menu is at the top under the header and logo. It should be at the bottom of the menus in the left column.

2. On the calendar when you mouse over scheduled events only a couple of the popup widows appear. I hard coded the calendar as it is not technically a menu (<!-- System:Menu:Xxxxx -->) and wasn't being passed through the menupage.htm code.

3. Several of the menus on the left column are missing there content.

I have a very reliable way to diagnos these problem. When I see an error I usually just pull out segments of any new code till everything is working the way it should. I then narrow in on the problem line(s) by reducing the size of the segment I remove till I see which line(s) need to be analysed. This is how I realized some of the problem was starting at <!-- System:Menu:Recruiting --> or more specifically the "onMouseover" quotes for that menu.
Alrighty, I managed to fix the three things you mentioned. Some were simple oversights (which certainly happen), and some were a little more complicated.

First, the little issues. The menus that weren't working were simply the result of missing information.

<!--System:Menu:XYZ--> assumes XYZ is the exact name of the Menu Category. For example your Shoutbox code was <!--System:Menu:Shout Box--> but the name of your shoutbox was "Shout It Out!!", so I merely changed the name to <!--System:Menu:Shout It Out!!--> and it worked. The Other example was <!--System:Menu:Recruiting--> was changed to <!--System:Menu:Currently Recruiting-->. You can determine the exact names of menus from Admin > Menus > Menu Administration

The "Last Items Received" section DID uncover a bug in my code, which I fixed. This is based on the fact that the system before the Menu Admin overhaul did not support <!--System:MEnu:LAst Items Receivved-->.

The Calendar issue is actually a non-issue. The Calendar is one of those freak occurances where it doesn't use the menupage by design (or by my laziness). In any case, the Calendar not using the menupage is normal.

Finally, here's the beefy one. Your Raid Progression menu. I DID fix it. That said, I don't know EXACTLY what was wrong. Ultimately, I never trust document.write (and in fact, I don't remember the last time I used it). It's ALWAYS safer to just assign the innerHTML of an object just so that you can be SURE that whatever you're printing won't interfere. I don't believe it had anything to do with quotes...it was all in the placement.

I completely rewrote your AllOtherMenus() function and modified how it displays things, and that rewriting ultimately fixed your problem there (and also made it more stable).

While I've fixed these issues on your site (and you'll still have some placement tweeking to do), I'm attaching the files here for academic purposes. (My changes to your code on the layout file start at lines 102 and 604)


--
It's all in the reflexes.
I must say I didn't expect you to do the work. I was more looking for some guildance on a different way to do it with javascript as my knowlegde of java scipt is still a little weak.

You mentioned some mistakes. It is unclear if they were on my part and if so sorry for the inconvienience.

I will be looking at the files and I suspect I may see some new ways of handling the code.

Thanks
I must say I definately like how you got away from the document.write(). I had always liked the ability, using PHP, to put a function anywhere on a page and all the processing of the was handle in (well usually in a different page) at least some other part of the page. But the point is to have one funtion do all the work for multiple parts of the page so as to limit the amount of code that must be handled and hence speed up page loads. It is a slight bit bulkier than if PHP was used but this does seem to do the trick.

I was about to start to finish the lay out of the finall parts of the new design when I noticed that, in the calendar, most of the mouseovers and links are not working. Only the mouseovers and link that are first in the row/line are working. I'm not sure what is causing this.
Quote
I was about to start to finish the lay out of the finall parts of the new design when I noticed that, in the calendar, most of the mouseovers and links are not working. Only the mouseovers and link that are first in the row/line are working. I'm not sure what is causing this.


Oh yeah, I forgot to mention that. I had noticed that too, and it's being caused by the hidden images for the popup menus. I bet if you tweaked some of the show/hide javascript to hide the image (or the whole drop-down div) with

document.getElementById("whatever").style.display="none"


That that would eliminate your problem there.


--
It's all in the reflexes.
This is such a droll geeky dev thread I'll add my nickel of humor.
Chops you need a smiley for those times when people look at something and say "Whoosh that went right over my head".


--
Six Demon BagRefresh This Item
Jack Burton: Hey, what more can a guy ask for?
Egg Shen: Oh, a six-demon bag!
Jack Burton: Terrific, a six-demon bag. Sensational. What's in it, Egg?
Egg Shen: Wind, fire, all that kind of thing!
The results are the same if I do the following


function popUp(obj) {
obj.style.display="block";
}
function popDown(obj) {
obj.style.display="none";
}


and


<div id="Mmenu" onMouseover="popUp(m2)" onMouseout="popDown(m2)">
<a class="menu1" href="#"><b>Menu</b></a>
</div>


Is it my "onMouseover" that is causing the conflict or is it the use of the "visibility" style? I guess it could even be my function names.

Maybe a little more clarity on what is causing the problem might help.

Quote by Saudorun

This is such a droll geeky dev thread I'll add my nickel of humor.
Chops you need a smiley for those times when people look at something and say "Whoosh that went right over my head".


lol

You think this is bad you should see the web design forums that I use regularly. My stength is in PHP and when I find a question the posts can go on into untold length and mostly the discussion is just around theory, not even how to get what I originally asked done. They were all quite blown over when I started asking javascript questions. Unfortunately most of them are PHP wizards.


[Back to Index]