Carl
11-11-2002, 06:31 AM
How do I go about printing one section here and the other section there. Its hard to explain, but if I want the code to print out everything in chunks, if they match. So if array1 has the following values.
menu1
menu1
menu2
It would print it out like this.
menu1 menu1
menu2.
My problem though is the values in array1 could be anything. Follow me? I could change the values of array1 to
booboobahbah
hehehe
joe
hi
hehehe
hi
booboobahbah
booboobahbah
Then it would print it out like this.
booboobahbah booboobahbah booboobahbah
hehehe hehehe
joe
hi hi.
See the picture?
Its hard to explain.
My code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CMenu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script>
/////////////////////////////////////////
// Copywrited 2002 By Carl Vondrick. //
// //
// You may use this script as long as //
// this copywrite notice is here. //
// //
// All rights reserved. //
// //
// Please report all bugs to //
// carl@carlsoft.net //
/////////////////////////////////////////
var ctop=88; // How many pixils from the top margin.
var cleft=96; // How many pixils from the left margin.
var height=22; // The height of the menu.
var bgcolor="blue"; // The background of your menu.
var bordercolor="black"; // The border color of your menu.
var borderwidth=1; // The width of the border.
var textcolor="white"; // The font color.
var mainmenu=new Array();
mainmenu[0]="Home | getURL=http://www.carlsoft.net"
mainmenu[1]="WebXpertz | getURL=http://www.webxpertz.net/forums/index.php3?s="
mainmenu[2]="Google! | getURL=http://www.google.com"
mainmenu[3]="Scripts | showMenu=scripts"
mainmenu[4]="Fun and Games | showMenu=games"
submenus=new Array();
submenus[0]="Javascript Kit | getURL=http://www.javascriptkit.com | fromMenu=scripts"
submenus[1]="Dynamic Drive | getURL=http://dynamicdrive.com | fromMenu=scripts"
submenus[2]="MSN Zone | getURL=http://www.zone.com | fromMenu=games"
//////////////////////////////////////////
//// NO NEED TO EDIT BELOW THIS LINE /////
//////////////////////////////////////////
// Print Main Menu \\
var thref,tmouseover,text,action;
document.write('<div id="menu" style="position: absolute; top:'+ctop+'; left:'+cleft+'; height:'+height+';">');
document.write('<table cellspacing=0 cellpadding=4 border='+borderwidth+' bordercolor='+bordercolor+'><tr>');
for (i=0; i<mainmenu.length; i++) {
menuarray=mainmenu[i].split(" | ");
if (menuarray[1].substr(0,6)=="getURL") {
action=menuarray[1].replace("getURL=","");
thref=action;
tmouseover="return false;";
}
else if (menuarray[1].substr(0,8)=="showMenu") {
action=menuarray[1].replace("showMenu=","");
tmouseover="showMenu('"+action+"');";
thref="javascript:void(0);";
}
text=menuarray[0];
document.write("<td bgcolor="+bgcolor+" onmouseover="+tmouseover+" onmouseout=hidemenu();><div id=menu"+i+"><b><a href='"+thref+"' style='color:"+textcolor+"; text-decoration:none;'>"+text+"</a></b></div></td>");
}
document.write('</tr></table>');
document.write('</div>');
// Print Sub-Menus \\
subtext=new Array(submenus.length);
subthref=new Array(submenus.length);
subfromMenu=new Array(submenus.length);
for (j=0;j<submenus.length;j++) {
submenuarray=submenus[j].split(" | ");
subtext[j]=submenuarray[0];
subthref[j]=submenuarray[1].replace("getURL=","");
subfromMenu[j]=submenuarray[2].replace("fromMenu=","");
}
place=height+5;
document.write("<div id=submenus style='top:"+place+";'>");
// this part there, that part here, the other part over there.
document.write("</div>");
function showMenu(which) {
}
function hidemenu() {
}
</script>
</body>
</html>
Let me know if you need if I didn't explain it well.
menu1
menu1
menu2
It would print it out like this.
menu1 menu1
menu2.
My problem though is the values in array1 could be anything. Follow me? I could change the values of array1 to
booboobahbah
hehehe
joe
hi
hehehe
hi
booboobahbah
booboobahbah
Then it would print it out like this.
booboobahbah booboobahbah booboobahbah
hehehe hehehe
joe
hi hi.
See the picture?
Its hard to explain.
My code.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>CMenu</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<script>
/////////////////////////////////////////
// Copywrited 2002 By Carl Vondrick. //
// //
// You may use this script as long as //
// this copywrite notice is here. //
// //
// All rights reserved. //
// //
// Please report all bugs to //
// carl@carlsoft.net //
/////////////////////////////////////////
var ctop=88; // How many pixils from the top margin.
var cleft=96; // How many pixils from the left margin.
var height=22; // The height of the menu.
var bgcolor="blue"; // The background of your menu.
var bordercolor="black"; // The border color of your menu.
var borderwidth=1; // The width of the border.
var textcolor="white"; // The font color.
var mainmenu=new Array();
mainmenu[0]="Home | getURL=http://www.carlsoft.net"
mainmenu[1]="WebXpertz | getURL=http://www.webxpertz.net/forums/index.php3?s="
mainmenu[2]="Google! | getURL=http://www.google.com"
mainmenu[3]="Scripts | showMenu=scripts"
mainmenu[4]="Fun and Games | showMenu=games"
submenus=new Array();
submenus[0]="Javascript Kit | getURL=http://www.javascriptkit.com | fromMenu=scripts"
submenus[1]="Dynamic Drive | getURL=http://dynamicdrive.com | fromMenu=scripts"
submenus[2]="MSN Zone | getURL=http://www.zone.com | fromMenu=games"
//////////////////////////////////////////
//// NO NEED TO EDIT BELOW THIS LINE /////
//////////////////////////////////////////
// Print Main Menu \\
var thref,tmouseover,text,action;
document.write('<div id="menu" style="position: absolute; top:'+ctop+'; left:'+cleft+'; height:'+height+';">');
document.write('<table cellspacing=0 cellpadding=4 border='+borderwidth+' bordercolor='+bordercolor+'><tr>');
for (i=0; i<mainmenu.length; i++) {
menuarray=mainmenu[i].split(" | ");
if (menuarray[1].substr(0,6)=="getURL") {
action=menuarray[1].replace("getURL=","");
thref=action;
tmouseover="return false;";
}
else if (menuarray[1].substr(0,8)=="showMenu") {
action=menuarray[1].replace("showMenu=","");
tmouseover="showMenu('"+action+"');";
thref="javascript:void(0);";
}
text=menuarray[0];
document.write("<td bgcolor="+bgcolor+" onmouseover="+tmouseover+" onmouseout=hidemenu();><div id=menu"+i+"><b><a href='"+thref+"' style='color:"+textcolor+"; text-decoration:none;'>"+text+"</a></b></div></td>");
}
document.write('</tr></table>');
document.write('</div>');
// Print Sub-Menus \\
subtext=new Array(submenus.length);
subthref=new Array(submenus.length);
subfromMenu=new Array(submenus.length);
for (j=0;j<submenus.length;j++) {
submenuarray=submenus[j].split(" | ");
subtext[j]=submenuarray[0];
subthref[j]=submenuarray[1].replace("getURL=","");
subfromMenu[j]=submenuarray[2].replace("fromMenu=","");
}
place=height+5;
document.write("<div id=submenus style='top:"+place+";'>");
// this part there, that part here, the other part over there.
document.write("</div>");
function showMenu(which) {
}
function hidemenu() {
}
</script>
</body>
</html>
Let me know if you need if I didn't explain it well.