Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:37
& entity and the url
Poster: webdevil
Dated: Wednesday April 11 2007 - 3:04:08 BST
Ok... here is the dilemma.
my url : http://www.somewhere.com?v1=a&v2=b (not real of course)
I need to use "&" in my url... for the variable parameters etc.
If I use a normal '&' it works fine parameters pass etc.
But... w3c.org yells at me for having an &v2 that is not a valid entity.
So on to the entity itself... replace that pesky & with &
And of course i need the backticks (`) to insure the semi-colon doesnt mess up.
w3c validator loves me and I am fully XHTML compliant... but...
No go on passing the variables correctly. When I click that item it sends me to the page "http://www.somewhere.com?v1=a&v2=b"... basically the literal interpretation of the url, not the translated entity &.
This causes the variables after the & to fail to interpret by the parsing language (in my case php). So i know this is probably from some BS javascript limitation on the way it handles URLs, assignments, and redirects, but what can i do to use & in the url and maintain w3c valid XHTML. (i do not want the menu definition in its own js file, i need it embedded in the script tag as i have it)
This is only for the & entity as it is the only thing that the URL 'must' interpret correctly or you lose all your variables.
My idea was simply a .replace(/&/, '&') at the point where the URL is used by the menu builder. That way in the HTML output it can stay w3c friendly and the app can interpret it back to a normal '&' before use inside of itself. This would only have to be done on the URL parameter.
Anyone??? I am really really stuck... i need both w3c and '&'.
Uggggggggh.
Signed,
The Webdevil
Poster: Andy
Dated: Wednesday April 11 2007 - 10:24:21 BST
Hi,
For starters, the W3C validator does not parse JavaScript so should be ignoring it.
Whatever you specify as the URL will be the URL so if you add a & it will be interpreted as that.
What you need to do is force the validator to not look at the JavaScript.
You should be able to do this by adding a CDATA clause to your script tags, like this:
Code:
<script type="text/javascript">
// <![cdata[
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;
with(menuStyle=new mm_style()){
bordercolor="#999999";
borderstyle="solid";
borderwidth=1;
fontfamily="Verdana, Tahoma, Arial";
fontsize="75%";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#000000";
offbgcolor="#eeeeee";
offcolor="#000000";
onbgcolor="#ddffdd";
oncolor="#000099";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=3)";
padding=4;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#999999";
separatorsize=1;
subimage="/menuimages/arrow.gif";
subimagepadding=2;
}
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
left=170;
orientation="horizontal";
style=menuStyle;
top=196;
aI("text=Home;url=http://www.milonic.com/;");
aI("showmenu=Samples;text=Menu Samples;");
aI("showmenu=Milonic;text=Milonic;");
aI("showmenu=Partners;text=Partners;");
aI("showmenu=Links;text=Links;");
aI("showmenu=MyMilonic;text=My Milonic;");
}
// ]]>
</script>
// <![cdata[
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;
with(menuStyle=new mm_style()){
bordercolor="#999999";
borderstyle="solid";
borderwidth=1;
fontfamily="Verdana, Tahoma, Arial";
fontsize="75%";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#000000";
offbgcolor="#eeeeee";
offcolor="#000000";
onbgcolor="#ddffdd";
oncolor="#000099";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=3)";
padding=4;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#999999";
separatorsize=1;
subimage="/menuimages/arrow.gif";
subimagepadding=2;
}
with(milonic=new menuname("Main Menu")){
alwaysvisible=1;
left=170;
orientation="horizontal";
style=menuStyle;
top=196;
aI("text=Home;url=http://www.milonic.com/;");
aI("showmenu=Samples;text=Menu Samples;");
aI("showmenu=Milonic;text=Milonic;");
aI("showmenu=Partners;text=Partners;");
aI("showmenu=Links;text=Links;");
aI("showmenu=MyMilonic;text=My Milonic;");
}
// ]]>
</script>
That should stop the validator from looking at your code.
HTH,
Andy