...

View Full Version : Linking to pages using javascript



Sarah McFarlane
03-21-2004, 12:02 AM
I have so many htm pages that I want to place them in separate folders. How do I point the javascript file to other folders.

Menu2_1_2=new Array("Auction Training","auctrain.htm","",1,18,140)
Menu2_1_2_1=new Array("Course Providers","auctfee.htm","",0,18,140);

I have the js file in a folder called templates and then

Redco web site (folder holds index and other general files)
Templates (folder holds javascript file)
Training (folder holding the auctrain.htm and the auctfee.htm files)

I have tried the following but it doesn't work so I suspect that you cannot use relative url's. I have many different folders what is the best solution?

Menu2_1_2=new Array("Auction Training","../training/auctrain.htm","",1,18,140)
Menu2_1_2_1=new Array("Course Providers","../training/auctfee.htm","",0,18,140);

Roy Sinclair
03-22-2004, 04:32 PM
Without seeing the rest of the menu code any answer you get is just a stab in the dark but sometimes we get lucky with those.

Make sure that when you use a relative address that it's based on the location of the "calling page" and not the location of the menu code. If the menu is called from many different locations make sure your relative addresses are based on the server root locatation so they'll allways be right.

Sarah McFarlane
03-26-2004, 11:36 PM
Hi Roy,

Thank you for your reply. I have had no luck in linking to these pages from the menu code without them all being in the one folder. There are too many files so I need to create folders for the groups of pages.

I cannot then get the menu see those pages. Below is all of the code. Any help would be appreciated.

Regards Sarah

var NoOffFirstLineMenus=14;
var LowBgColor='white';
var LowSubBgColor='white';
var HighBgColor='#FFFF00';
var HighSubBgColor='#FFFFA4';
var FontLowColor='black';
var FontSubLowColor='black';
var FontHighColor='navy';
var FontSubHighColor='navy';
var BorderColor='navy';
var BorderSubColor='navy';
var BorderWidth=1;
var BorderBtwnElmnts=1;
var FontFamily="arial,"
var FontSize=9;
var FontBold=0;
var FontItalic=0;
var MenuTextCentered='left';
var MenuCentered='left';
var MenuVerticalCentered='static';
var ChildOverlap=.12;
var ChildVerticalOverlap=.35;
var StartTop=58;
var StartLeft=10;
var VerCorrect=0;
var HorCorrect=0;
var LeftPaddng=6;
var TopPaddng=2;
var FirstLineHorizontal=0;
var MenuFramesVertical=0;
var DissapearDelay=600;
var TakeOverBgColor=1;
var FirstLineFrame='navig';
var SecLineFrame='space';
var DocTargetFrame='space';
var TargetLoc='';
var HideTop=0;
var MenuWrap=1;
var RightToLeft=0;
var UnfoldsOnClick=0;
var WebMasterCheck=0;
var ShowArrow=1;
var KeepHilite=1;
var Arrws=['tri.gif',5,10,'tridown.gif',10,5,'trileft.gif',5,10];

function BeforeStart(){return}
function AfterBuild(){return}
function BeforeFirstOpen(){return}
function AfterCloseAll(){return}


Menu1=new Array("&nbsp;<b> Home</b>","index.html","",0,18,110);

Menu2=new Array("<b>&nbsp; Training</b>","","",2);

Menu2_1=new Array("Agents","","",6,18,102);
Menu2_1_1=new Array("Agents Representative","","",3,18,140);
Menu2_1_1_1=new Array("Legal Requirements","trnagtrep.htm","",0,18,140);
Menu2_1_1_2=new Array("Course Providers","trnarcp.htm","",0)
Menu2_1_1_3=new Array("Assignment Tips","asigntip.htm","",0)

Menu2_1_2=new Array("Auction Training","auctrain.htm","",1,18,140)
Menu2_1_2_1=new Array("Course Providers","auctfee.htm","",0,18,140);

Menu2_1_3=new Array("Computer","","",1,18,140)
Menu2_1_3_1=new Array("Course Providers","computer.htm","",0,18,140)

Menu2_1_4=new Array("Licensing","","",2,18,140);
Menu2_1_4_1=new Array("Legal Requirements","licfull.htm","",0,18,140);
Menu2_1_4_2=new Array("Course Providers","lictrain.htm","",0)

Menu2_1_5=new Array("Sales","","",1,18,140);
Menu2_1_5_1=new Array("Course Providers","salestrn.htm","",0,18,140);

Menu2_1_6=new Array("Other Training","other.htm","",0,18,140);

Menu2_2=new Array("Public","","",4,18,102);
Menu2_2_1=new Array("Buying","blank1.htm","",0,18,90)
Menu2_2_2=new Array("Selling","blank1.htm","",0);
Menu2_2_3=new Array("Investing","blank1.htm","",0);
Menu2_2_4=new Array("Renting","blank1.htm","",0);

Menu3=new Array("&nbsp;<b> Careers</b>","","",4);
Menu3_1=new Array("Resumes","","",2,18,130);
Menu3_1_1=new Array("Tips","cartips.htm","",0,18,100);
Menu3_1_2=new Array("Resume Writing","blank1.htm","",0);

Menu3_2=new Array("Training","","",3);
Menu3_2_1=new Array("Entry Level","trnagtrep.htm","",0,18,75);
Menu3_2_2=new Array("Full Licence","licfull.htm","",0);
Menu3_2_3=new Array("Other","blank1.htm","",0);

Menu3_3=new Array("Wages/Salary","","",1);
Menu3_3_1=new Array("Resources","carres.htm","",0,18,70);

Menu3_4=new Array("Tips","cartips.htm","",0);

Menu4=new Array("&nbsp&nbsp<b>Products</b>","products.htm","",0);

Menu5=new Array("&nbsp&nbsp<b>Services</b>","services.htm","",0);

Menu6=new Array("&nbsp&nbsp<b>Buying</b>","buying.htm","",13);

Menu6_1=new Array("Needs Analysis","../buying/buy-ana.htm","",0,18,152);

Menu6_2=new Array("Market Trends","buy-trnd.htm","",0);

Menu6_3=new Array("Research","buy-res.htm","",0)

Menu6_4=new Array("Where & What to Buy","buy-what.htm","",0);

Menu6_5=new Array("Financing","buy-fin.htm","",0);

Menu6_6=new Array("How Do I Buy","buy-how.htm","",0);

Menu6_7=new Array("Who Do I Buy From","buy-who.htm","",0);

Menu6_8=new Array("Documentation","buy-doc.htm","",0);

Menu6_9=new Array("Negotiation Process","buy-neg.htm","",0);
Menu6_10=new Array("Rights & Responsibilities","buy-resp.htm","",0);
Menu6_11=new Array("Risk Management","buy-risk.htm","",0);
Menu6_12=new Array("Moving House","buy-move.htm","",0);
Menu6_13=new Array("Resources","buy-list.htm","",0);

Menu7=new Array("<b>&nbsp; Selling</b>","","",7);

Menu7_1=new Array("Methods of Selling","blank1.htm","",4,18,152);
Menu7_1_1=new Array("Auction","blank1.htm","",5,18,140);
Menu7_1_1_1=new Array("Auction History","aucthist.htm","",0,18,158);
Menu7_1_1_2=new Array("Benefits & Disadvantages","auctdis.htm","",0)
Menu7_1_1_3=new Array("Rules of Conduct - Victoria","auctrule.htm","",0)
Menu7_1_1_4=new Array("Fee Auctioneers","auctfee.htm","",0);
Menu7_1_1_5=new Array("Auction Training","auctrain.htm","",0);

Menu7_1_2=new Array("Private Treaty","blank1.htm","",0)
Menu7_1_3=new Array("Tender","blank1.htm","",0)
Menu7_1_4=new Array("Expressions of Interest","blank1.htm","",0);

Menu7_2=new Array("Selecting an Agent","select.htm","",0);

Menu7_3=new Array("Vendor/Sellers Advocates","vendadv.htm","",0)

Menu7_4=new Array("Presenting your Property","present.htm","",0);

Menu7_5=new Array("Documentation","blank1.htm","",0);

Menu7_6=new Array("Helpful Selling Tips","blank1.htm","",0);

Menu7_7=new Array("Useful Defininitions","blank1.htm","",0);

Menu8=new Array("<b>&nbsp; Auction</b>","","",5);
Menu8_1=new Array("Auction History","aucthist.htm","",0,18,170);
Menu8_2=new Array("Advantages & Disadvantages","auctadis.htm","",0)
Menu8_3=new Array("Rules of Conduct (Vic)","auctrule.htm","",0)
Menu8_4=new Array("Fee Auctioneers","auctfee.htm","",0);
Menu8_5=new Array("Auction Training","auctrain.htm","",0);

Menu9=new Array("<b>&nbsp; Building</b>","","",4);
Menu9_1=new Array("Building A New Home","bldnewh.htm","",0,18,150);
Menu9_2=new Array("Building Styles","blank1.htm","",0)
Menu9_3=new Array("Common Building Faults","blank1.htm","",0)
Menu9_4=new Array("Resources","bldres.htm","",0);

Menu10=new Array("<b>&nbsp; Renting</b>","","",3);
Menu10_1=new Array("Resources","rentres.htm","",0,18,140);
Menu10_2=new Array("Publications","rentpub.htm","",0);
Menu10_3=new Array("Useful Definitions","rentdef.htm","",0);
Menu10_4=new Array("Websites","blank1.htm","",0);

Menu11=new Array("<b>&nbsp; Useful Links</b>","usfulnks.htm","",0);

Menu12=new Array("<b>&nbsp; About Us</b>","aboutus.htm","",0);

Menu13=new Array("<b>&nbsp; Agents Tips</b>","","",11);
Menu13_1=new Array("Starting Out in Sales","strtsales.htm","",0,18,140);
Menu13_2=new Array("Time Management","timemgmt.htm","",0);
Menu13_3=new Array("Motivation","motivate.htm","",0);
Menu13_4=new Array("Goal Setting","goalset.htm","",0);
Menu13_5=new Array("Marketing Yourself","market.htm","",0);
Menu13_6=new Array("Vendor Communication","vendcom.htm","",0);
Menu13_7=new Array("Customer Loyalty","custloy.htm","",0);
Menu13_8=new Array("Prospecting","prospect.htm","",0);
Menu13_9=new Array("Attitude","attitude.htm","",0);
Menu13_10=new Array("After Sales Service","aftsale.htm","",0);
Menu13_11=new Array("Sales Management","meetings.htm","",0);


Menu14=new Array("<b>&nbsp; Email Us</b>","emailus.htm","",0);

Roy Sinclair
03-27-2004, 04:30 PM
Let's look at just one:

Menu2_1_1_1=new Array("Legal Requirements","trnagtrep.htm","",0,18,140);


If I were to create directory named "agents" and move the "trnagtrep.htm" file to it, I'd change the menu item to this:

Menu2_1_1_1=new Array("Legal Requirements","agents/trnagtrep.htm","",0,18,140);

Try doing that and tell me what happens.

Sarah McFarlane
03-28-2004, 01:19 AM
Unfortunately Roy, it does not work, but thankyou for your suggestion!

glenngv
03-29-2004, 06:08 AM
Let's review.
This is the structure of your pages:

Redco web site (folder holds index and other general files)
Templates (folder holds javascript file)
Training (folder holding the auctrain.htm and the auctfee.htm files)

IF the code you posted is in the js file that is located in "Templates" folder, then your trial should be correct.

Menu2_1_2=new Array("Auction Training","../training/auctrain.htm","",1,18,140)
Menu2_1_2_1=new Array("Course Providers","../training/auctfee.htm","",0,18,140);

Sarah McFarlane
03-29-2004, 09:37 AM
Yes unfortuanately I have tried even moving the .js file back into the root directory of the web site and it still doesn't work.

I thought that maybe there was something more complicated about the way javascript used a relative url address but based on both of the previous recommendations, it should work the same way that html does!

Thank you all the same for your assistance.

If you can think of anything else let me know.

Regards
Sarah:confused:

glenngv
03-29-2004, 10:01 AM
It's hard without seeing the page online.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum