Hi eragon,
The main problem is that your form definition is done across several different lines of code. That's OK in html, but the trick here is that you're defining the form inside of a javascript literal string (the double-quoted string passed to aI() ). By breaking it into multiple lines, the string ends prematurely, generating an "unterminated string literal" error. There are several solutions to this problem, as shown in the examples below (using your exact form code).
There's another small issue too: Sometimes, html code embedded in a menu item can confuse the system, where html attributes have the same names as menu properties. To avoid that, you can enclose the entire html string in backward single quotes (`html code goes here`). I've done that in the appropriate places in the examples below.
So, how do you get around the unterminated string problem? Three approaches I can think of (you may want to maximize your browser window
):
(1) Define the entire aI() on one line of code. That's easy to start, but it makes it pretty difficult to edit the form code later. In any case, your Search menu would look like this (with appropriate use of the ` ). And yes, the aI() below really is all on one line (it wraps here). Copy the code from here and paste it into your menu_data.js, you'll see:
Code: Select all
with(milonic=new menuname("Search")){
style=dropStyle;
aI("text=`<FORM method=GET action=http://www.google.com/custom><TABLE bgcolor=#FFFFFF cellspacing=0 border=0><tr valign=top><td><A href="http://websites.milonic.com/google.com/search><IMG SRC=http://www.google.com/logos/Logo_40wht.gif border=0 ALT=Google align=middle></A></td></tr><tr><td><INPUT TYPE=text name=q size=15 maxlength=255 value=><INPUT type=submit name=sa VALUE='Google Search'><INPUT type=hidden name=cof VALUE=S:http://www.familywebwatch.com;GL:0;AH:left;LH:60;L:http://www.familywebwatch.com/fww_banner.jpg;LW:201;AWFID:433b3358113fb253;><input type=hidden name=domains value='familywebwatch.com'><br><input type=radio name=sitesearch value=''> Search WWW <br /><input type=radio name=sitesearch value='familywebwatch.com' checked> Search fww.com</td></tr></TABLE></FORM>`;type=html;");
}
(2) You
can continue a string across multiple lines in javascript, by string concatenation (adding one piece to another), but you have to be careful. In general, it works like this:
Code: Select all
var stringName = "this is a "
+ "string literal that "
+ "spans multiple lines of code.";
The following example shows your Search menu, where aI() contains a long string literal defined across multiple lines.
Code: Select all
with(milonic=new menuname("Search")){
style=dropStyle;
aI("text=`"
+ "<FORM method=GET action=http://www.google.com/custom>"
+ "<TABLE bgcolor=#FFFFFF cellspacing=0 border=0>"
+ "<tr valign=top><td>"
+ "<A href="http://websites.milonic.com/google.com/search>"
+ "<IMG SRC=http://www.google.com/logos/Logo_40wht.gif border=0 ALT=Google align=middle></A>"
+ "</td></tr>"
+ "<tr>"
+ "<td>"
+ "<INPUT TYPE=text name=q size=15 maxlength=255 value=>"
+ "<INPUT type=submit name=sa VALUE='Google Search'>"
+ "<INPUT type=hidden name=cof VALUE=S:http://www.familywebwatch.com;GL:0;AH:left;LH:60;L:http://www.familywebwatch.com/fww_banner.jpg;LW:201;AWFID:433b3358113fb253;>"
+ "<input type=hidden name=domains value='familywebwatch.com'><br><input type=radio name=sitesearch value=''> Search WWW <br />"
+ "<input type=radio name=sitesearch value='familywebwatch.com' checked> Search fww.com"
+ "</td></tr></TABLE>"
+ "</FORM>"
+ "`;type=html;");
}
(3) Finally, you can combine the multiple-line approach above with the use of a string variable. Define the html code in a string variable across multiple lines, then use the variable in the call to aI(). This is how it would work with your code.
First, define a global variable to hold the html code for the search form. Here, I call the variable
mm_searchForm. This would normally be done at the top of your menu_data code, where the other globals are defined.
Code: Select all
var mm_searchForm =
"<FORM method=GET action=http://www.google.com/custom>"
+ "<TABLE bgcolor=#FFFFFF cellspacing=0 border=0>"
+ "<tr valign=top><td>"
+ "<A href="http://websites.milonic.com/google.com/search>"
+ "<IMG SRC=http://www.google.com/logos/Logo_40wht.gif border=0 ALT=Google align=middle></A>"
+ "</td></tr>"
+ "<tr>"
+ "<td>"
+ "<INPUT TYPE=text name=q size=15 maxlength=255 value=>"
+ "<INPUT type=submit name=sa VALUE='Google Search'>"
+ "<INPUT type=hidden name=cof VALUE=S:http://www.familywebwatch.com;GL:0;AH:left;LH:60;L:http://www.familywebwatch.com/fww_banner.jpg;LW:201;AWFID:433b3358113fb253;>"
+ "<input type=hidden name=domains value='familywebwatch.com'><br><input type=radio name=sitesearch value=''> Search WWW <br />"
+ "<input type=radio name=sitesearch value='familywebwatch.com' checked> Search fww.com"
+ "</td></tr></TABLE>"
+ "</FORM>";
Now use the mm_searchForm variable in the call to aI(), to build the item in the Search menu. You would do this in the same place that you normally define menus:
Code: Select all
with(milonic=new menuname("Search")){
style=dropStyle;
aI("text=`" + mm_searchForm + "`;type=html;");
}
You should be able to use any one of these examples in your code ereagon.
Sorry for the long-winded explanation. It's my hope that someone in a similar circumstance down the road might come across this thread and find it useful.
Hope that helps,
Kevin