Linking within the same document/page

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
TaughneeS
Beginner
Beginner
Posts: 2
Joined: Tue Nov 25, 2003 9:22 pm

Linking within the same document/page

Post by TaughneeS »

Hi. For some ridiculous reason my client wants to use this menu so he can link to various paragraphs within just ONE web page. I know that is not really the purpose for why this menu was written, but is there ANY way I can use an anchor tag within the submenus so that I can do an internal anchor link on this page? THANK YOU IN ADVANCE!!

:) TaughneeS
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Re: Linking within the same document/page

Post by kevin3442 »

TaughneeS wrote:Hi. For some ridiculous reason my client wants to use this menu so he can link to various paragraphs within just ONE web page...
Not necessarily unreasonable, especialy for a paying client! ;)

You should be able to set up anchors at the intended target locations within the page, as you normally would, then specify the anchor destinations in each menu item's url property, using the the href syntax you would normally use in an <a> link. For example, suppose you set an anchor named "jump01" at a paragraph, like so:

Code: Select all

<a name="jump01"></a>
You could have a menu item jump to that anchor like this:

Code: Select all

aI("text=Goto Jump01;url=thePageFileName.htm#jump01;");
If the anchor is always on the current page (and your submenus are unique to each page), then you could shorten it by leaving the .htm file name out of the url, like so:

Code: Select all

aI("text=Goto Jump01;url=#jump01;");
Hope that helps,

Kevin
TaughneeS
Beginner
Beginner
Posts: 2
Joined: Tue Nov 25, 2003 9:22 pm

Thanks

Post by TaughneeS »

Thanks Kevin, that did the trick ... I was so close. (And thus, so FRUSTRATED!) Thanks for helping a girl out in her time of need. :)

-TaughneeS :P
User avatar
cubefree
Super Advanced
Super Advanced
Posts: 82
Joined: Fri Aug 01, 2003 3:16 am
Location: Seattle, WA
Contact:

clickfunction and anchor names

Post by cubefree »

Forgive me for piggy-backing onto your topic, as mine is slightly different... but my clickfunction does not seem to be firing. I've added an alert, but nada. I'm doing this only to show state on my sub-navigation that uses anchor names. Pagematch does not seem to work if you click on link using an anchor name tag. After the page loads, try 'online invoicing' or 'data conversions'. The page should reload.

Some info:

http://www.cubefree.com/dev/services/pr ... helftalker



Code: Select all


function resize() { 
  alert('reloaded'); 
  document.location.href = history.go(0); 
} 

var wm = 'services/webmarketing'; 
var ts = 'services/techservices'; 
var pc = 'services/printcmu'; 
var pm = 'services/projectmanagement'; 

// bullet graphic (pi ~ pageimage) 
var pi = ''; //'<img src='+DOM+'images/graphics/v_bullet.gif hspace=3 border=0>'; 

with(leftStyle=new mm_style()){ 
padding=0; 
menuwidth=150; 

//separatorsize=1; 
//separatorimage = domlav+"dashedline.gif"; 
//separatorpadding=5; 

align="right"; 
oncolor="#D3714E"; 
offcolor="#999999"; 
pagecolor="#C94522"; 
fontsize="10px"; 
fontstyle="normal"; 
fontfamily="Verdana, sans-serif;"; 
onbold=0; 

if (ie) { 
   overfilter="Fade(duration=2.0);Alpha(opacity=100)"; 
   outfilter="randomdissolve(duration=0.3)"; 
   } 
} 

var menu_top  = "text=<img src="+DOM+"images/spacer.gif width=150 height=18 border=0>;" 
var sub_top   = "text=<img src="+DOM+"images/spacer.gif width=150 height=10 border=0>;" 
var dasher    = "text=<img src="+domlav+"dashedline.gif width=150 height=1 vspace=5 border=0>;" 
var sepp      = 'separatorsize=1;separatorpadding=5;'; 



with(milonic=new menuname("services")){ 
style=leftStyle; 
top=158; 
left=leftnav_left; 
menuwidth=150; 
alwaysvisible=1; 
orientation="vertical"; 
followscroll = "55,50,15"; 

aI("image="+domlav+"services.gif;url="+DOM+"services/index.php;separatorsize=0;"); 
aI(menu_top); 

aI("image="+domlav+"webmarketing.gif;overimage="+domlav+"webmarketing_f2.gif;url="+DOM+"services/webmarketing.php;pageimage="+domlav+"webmarketing_f3.gif;pagematch="+DOM+"services/webmarketing;"); 

if (url.indexOf(wm) != -1) { 
   aI(sub_top); 
   aI("text="+pi+"design \& development;"+sepp); 
   aI("text="+pi+"online marketing;"+sepp); 
   aI("text="+pi+"online advertising;"+sepp); 
   aI("text="+pi+"search engine rankings;"+sepp); 
} 
aI(dasher); 

aI("image="+domlav+"techservices.gif;overimage="+domlav+"techservices_f2.gif;url="+DOM+"services/techservices.php;pageimage="+domlav+"techservices_f3.gif;pagematch="+DOM+"services/techservices;"); 

if (url.indexOf(ts) != -1) { 
   aI(sub_top); 
   aI("text="+pi+"database / web applications;"+sepp); 
   aI("text="+pi+"e-commerce;"+sepp); 
   aI("text="+pi+"content management systems;"+sepp); 
} 
aI(dasher); 

aI("image="+domlav+"printcmu.gif;overimage="+domlav+"printcmu_f2.gif;url="+DOM+pc+".php;pageimage="+domlav+"printcmu_f3.gif;pagematch="+DOM+pc+";"); 

if (url.indexOf(pc) != -1) { 
   aI(sub_top);    
   aI("text="+pi+"shelf talkers;url="+DOM+pc+".php#shelftalker;"+sepp+"clickfunction=alert('reloaded');"); 
   aI("text="+pi+"data conversions;url="+DOM+pc+".php#data;"+sepp+"clickfunction=resize();"); 
   aI("text="+pi+"online invoicing;url="+DOM+pc+".php#invoicing;"+sepp+"clickfunction=resize();"); 
} 
aI(dasher); 

aI("image="+domlav+"projectmanagement.gif;overimage="+domlav+"projectmanagement_f2.gif;url="+DOM+"services/projectmanagement.php;pageimage="+domlav+"projectmanagement_f3.gif;pagematch="+DOM+"services/projectmanagement;"); 

if (url.indexOf(pm) != -1) { 
   aI(sub_top); 
   aI("text="+pi+"strategy;url="+DOM+pm+"_strategy.php;"+sepp); 
   aI("text="+pi+"development;url="+DOM+pm+"_development.php;"+sepp); 
   aI("text="+pi+"management;url="+DOM+pm+"_management.php;"+sepp); 
   aI("text="+pi+"promotion;url="+DOM+pm+"_promotion.php;"+sepp); 
} 

}
Post Reply