back quotes and style="prop:val"

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
MTD
Beginner
Beginner
Posts: 6
Joined: Mon Aug 09, 2004 8:58 pm
Location: Quebec, Canada
Contact:

back quotes and style="prop:val"

Post by MTD »

Hi,

I would like to have more information about what mean:

Code: Select all

style="prop:val"
which seems to be absolutely needed
then where are using back quotes and HTML on a main menu.

I use often the menu to place objects (like floating search form) in the page. It took me a while to understand why it was not apearing, and I found out it was that part missing. I have to put it on the FORM tag or a DIV tag, but I don't understand what it does.


And by the way, do you think it could be possible to make the parser accept line feed when using back quotes? To accept everything until the closing back quote.


Thank you very much.
MTD
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Re: back quotes and style="prop:val"

Post by John »

MTD wrote:I would like to have more information about what mean:

Code: Select all

style="prop:val"
which seems to be absolutely needed
then where are using back quotes and HTML on a main menu.
Where exactly did you see that? I need to know the context to give a reasonable answer.
MTD wrote:I use often the menu to place objects (like floating search form) in the page. It took me a while to understand why it was not apearing, and I found out it was that part missing. I have to put it on the FORM tag or a DIV tag, but I don't understand what it does.
type=form;, in addition to <form>...</form> - not div.
John
MTD
Beginner
Beginner
Posts: 6
Joined: Mon Aug 09, 2004 8:58 pm
Location: Quebec, Canada
Contact:

Post by MTD »

In those exact 2 cases, if I remove the code, I don't see the menu.

Code: Select all

with(milonic=new menuname("search")){
top=235;
screenposition="center"
left="offset=-220";
style=StyleSimple;
alwaysvisible = 1;
position="absolute";
aI("type=form;text=`<form style=\"prop:val;\"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td colspan=\"2\"><img src=\"imgSite/TitreRech.gif\" width=\"209\" height=\"28\" alt=\"\" /></td></tr><tr><td valign=\"middle\" align=\"left\" style=\"padding-left:9px;padding-right:2px;\"><input type=\"text\" style=\"border: 1px solid #ACACAC; width: 172px; height: 18px;\" /></td><td valign=\"middle\" align=\"right\"><a href=\"\"><img src=\"imgSite/BtnGoRech.gif\" width=\"22\" height=\"22\" alt=\"GO\" border=\"0\" /></a></td></tr></table></form>`;");
}
and

Code: Select all

with(milonic=new menuname("flash")){
top=298;
screenposition="center"
left="offset=-141";
style=StyleSimple;
alwaysvisible = 1;
position="absolute";
aI("text=`<div style=\"prop:val;\"><object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0\" width=\"375\" height=\"22\" id=\"bande_laurendeau\" align=\"middle\"><param name=\"allowScriptAccess\" value=\"sameDomain\" /><param name=\"movie\" value=\"bande_laurendeau.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\"bande_laurendeau.swf\" quality=\"high\" bgcolor=\"#ffffff\" width=\"375\" height=\"22\" name=\"bande_laurendeau\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /></object></div>`;");
}

But I did it with a very much simple line of HTML like:

Code: Select all

<div>hello</div>
and It did not appeared until i did:

Code: Select all

<div style=\"prop:val;\">hello</div>
For the flash example, it would not appear until I added a DIV tag.
MTD
MTD
Beginner
Beginner
Posts: 6
Joined: Mon Aug 09, 2004 8:58 pm
Location: Quebec, Canada
Contact:

Post by MTD »

Still no clue?
MTD
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

It is not necessary to quote (or backquote) items in the aI statements. Therefore, no backslash, either.

Still would like to know what style=\"prop:val;\" is.
John
MTD
Beginner
Beginner
Posts: 6
Joined: Mon Aug 09, 2004 8:58 pm
Location: Quebec, Canada
Contact:

Post by MTD »

It comes for the howtobuild.txt manual with in the zip file we download.
MTD
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

That's just an example of how to code. There is no such thing as prop:value. Rather, Andy was just showing how to code an inline style if you decided to use one. An example would be...

Code: Select all

style=border:1px solid #990033;
In this case, 'prop' (css property) is 'border', and value is '1px solid #990033'. Note you already have a proper style item included. Remove style=\"prop:val;\" from your aI.

Try this...

Code: Select all

aI("type=form;text=<form><table cellspacing=0 cellpadding=0 border=0><tr><td colspan=2><img src=imgSite/TitreRech.gif width=209 height=28 alt= /></td></tr><tr><td valign=middle align=left style=padding-left:9px;padding-right:2px;><input type=text style=border: 1px solid #ACACAC; width: 172px; height: 18px; /></td><td valign=middle align=right><a href=#><img src=imgSite/BtnGoRech.gif width=22 height=22 alt=GO border=0 /></a></td></tr></table></form>;");
John
MTD
Beginner
Beginner
Posts: 6
Joined: Mon Aug 09, 2004 8:58 pm
Location: Quebec, Canada
Contact:

Post by MTD »

If I change this :

Code: Select all

with(milonic=new menuname("flash")){
top=298;
screenposition="center"
left="offset=-141";
style=StyleSimple;
alwaysvisible = 1;
position="absolute";
aI("type=form;text=`<div style=prop:val;><object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 width=375 height=22 id=bande_laurendeau align=middle><param name=wmode value=transparent /><param name=allowScriptAccess value=sameDomain /><param name=movie value=/bande_laurendeau.swf /><param name=quality value=high /><param name=bgcolor value=#ffffff /><embed src=/bande_laurendeau.swf quality=high bgcolor=#ffffff width=375 height=22 name=bande_laurendeau align=middle allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer /></object></div>`;");
}
for this (removing "style=prop:val;") :

Code: Select all

with(milonic=new menuname("flash")){
top=298;
screenposition="center"
left="offset=-141";
style=StyleSimple;
alwaysvisible = 1;
position="absolute";
aI("type=form;text=`<div><object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 width=375 height=22 id=bande_laurendeau align=middle><param name=wmode value=transparent /><param name=allowScriptAccess value=sameDomain /><param name=movie value=/bande_laurendeau.swf /><param name=quality value=high /><param name=bgcolor value=#ffffff /><embed src=/bande_laurendeau.swf quality=high bgcolor=#ffffff width=375 height=22 name=bande_laurendeau align=middle allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer /></object></div>`;");
}
then I get an undefined error in line 24 in the "milonic_src.js" file.

So style=\"prop:val;\" is mandatory or else it's not working.
If it's there in the sample and it causes an error, it must has something to do with the menu.

And if I don't do a DIV tag, the <Object> does not appear at all.

Maybe it's not the right way, but when the style is there it's working just fine. I would love to know why I put this code which I don't understand what it's for.

And also, you are forced to backquote when many symbols in the text can conflict with the parser. In this case exactly, in either way, it does not work without the backquotes.
MTD
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

What I posted had nothing to do with Flash (which I didn't see). It was just a plain form.

Speaking of which, why is your Flash item type=form?
John
MTD
Beginner
Beginner
Posts: 6
Joined: Mon Aug 09, 2004 8:58 pm
Location: Quebec, Canada
Contact:

Post by MTD »

I was just because I tried to see if it makes a change. type=form does not change the results of all the tests. I tried with and without it and have not seen any diffrence at all.
MTD
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi MTD,

I'm going to have to disagree with your diagnosis.
MTD wrote:...then I get an undefined error in line 24 in the "milonic_src.js" file. So style="prop:val;" is mandatory or else it's not working.
As John says, the following line from the howtobuild.txt file
aI("text=`<form style="prop:val;"><input name=txt></form>`;");
Is meant as a sort of example template... the format you should follow, not the exact code to put in. Just as the following code from the same .txt file:
with(milonic=new menuname("mainmenu")){
PARAMETERS. . . .
PARAMETERS. . . .
}

is meant as a format to follow, not actual code to use to define a menu.

There is nothing in the menu system that requires or even recognizes

Code: Select all

style="prop:val;">
as part of the code used to build a menu item. It's simply the format you follow when applying a style (in the menu or in any otehr html).
MTD wrote:If it's there in the sample and it causes an error, it must has something to do with the menu.
It's an unfortunate fact of javascript that the error codes and locations you get often have very little to do with the actual nature and location of the error. In this case, there's something else wrong in the menu code, but it has nothing to do with style=prop:val. I'm thinking that you might want to try not using the back quotes, remove the <div></div>, change all of the /> to >, and specify type=html in your aI() definition. I tried the following modification of the aI() code you posted, and it worked just fine (all on one line in your .js file, no line breaks):

Code: Select all

aI("type=html;text=<object classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 codebase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0 width=375 height=22 id=bande_laurendeau align=middle><param name=wmode value=transparent><param name=allowScriptAccess value=sameDomain><param name=movie value=bande_laurendeau.swf><param name=quality value=high><param name=bgcolor value=#ffffff><embed src=bande_laurendeau.swf quality=high bgcolor=#ffffff width=375 height=22 name=bande_laurendeau align=middle allowScriptAccess=sameDomain type=application/x-shockwave-flash pluginspage=http://www.macromedia.com/go/getflashplayer></object>;");
Give that a shot and see if it works for you. Come on back if it doesn't and we'll figure it out.

Cheers,

Kevin
Post Reply