Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    4,244
    Tokens
    0

    Latest Awards:

    Default Text Switch Menu

    Is is possible to use a switch menu, but instead of using images, you can use text?

    Edited by Lµke (Forum Moderator): Thread Moved from Website Designing. Please post in the correct section next time, Thanks .
    Last edited by Lµke; 18-01-2007 at 10:21 PM.

  2. #2
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Yes. Just change the image tags into text tags...
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  3. #3
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    Dont all switch menu's use text anyway o.0

  4. #4
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    4,244
    Tokens
    0

    Latest Awards:

    Default

    I don't get what you're saying.

    Code:
    <img src="img.PNG" onclick="SwitchMenu('sub1')" width="129" height="17">
        <span class="submenu" id="sub1"><font size="1" face="Verdana">
    Change to what?

  5. #5
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    Take out the image code and add a text tag (i dunno???) instead...

    If that isnt right i cannot remember but i did it once in dreamweaver using the one of DD, there is a text based one on there somewhere?
    Last edited by Recursion; 18-01-2007 at 09:29 PM.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  6. #6
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    4,244
    Tokens
    0

    Latest Awards:

    Default

    Dreamweavers Auto-Coding sucks.

  7. #7
    Join Date
    Sep 2006
    Posts
    2,114
    Tokens
    0

    Latest Awards:

    Default

    Use this code:

    Code:
    <head>
    <style type="text/css">
    .menutitle{
    cursor:pointer;
    margin-bottom: 5px;
    background-color:#ffffff;
    color:#000000;
    width:140px;
    padding:2px;
    font-style:verdana;
    text-align:left;
    font-weight:bold;
    /*/*/border:0px solid #000000;/* */
    }
    
    .submenu{
    margin-bottom: 0.5em;
    }
    </style>
    
    <script type="text/javascript">
    
    var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
    var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
    
    if (document.getElementById){
    document.write('<style type="text/css">\n')
    document.write('.submenu{display: none;}\n')
    document.write('</style>\n')
    }
    
    function SwitchMenu(obj){
    	if(document.getElementById){
    	var el = document.getElementById(obj);
    	var ar = document.getElementById("masterdiv").getElementsByTagName("span");
    		if(el.style.display != "block"){
    			for (var i=0; i<ar.length; i++){
    				if (ar[i].className=="submenu")
    				ar[i].style.display = "none";
    			}
    			el.style.display = "block";
    		}else{
    			el.style.display = "none";
    		}
    	}
    }
    
    function get_cookie(Name) { 
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) { 
    offset += search.length
    end = document.cookie.indexOf(";", offset);
    if (end == -1) end = document.cookie.length;
    returnvalue=unescape(document.cookie.substring(offset, end))
    }
    }
    return returnvalue;
    }
    
    function onloadfunction(){
    if (persistmenu=="yes"){
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=get_cookie(cookiename)
    if (cookievalue!="")
    document.getElementById(cookievalue).style.display="block"
    }
    }
    
    function savemenustate(){
    var inc=1, blockid=""
    while (document.getElementById("sub"+inc)){
    if (document.getElementById("sub"+inc).style.display=="block"){
    blockid="sub"+inc
    break
    }
    inc++
    }
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
    document.cookie=cookiename+"="+cookievalue
    }
    
    if (window.addEventListener)
    window.addEventListener("load", onloadfunction, false)
    else if (window.attachEvent)
    window.attachEvent("onload", onloadfunction)
    else if (document.getElementById)
    window.onload=onloadfunction
    
    if (persistmenu=="yes" && document.getElementById)
    window.onunload=savemenustate
    
    </script>
    </head>
    <body>
    <font face="Verdana" size="1" color="000000">
    <!-- Keep all menus within masterdiv-->
    </font>
    <div id="masterdiv">
    
    	<div class="menutitle" onclick="SwitchMenu('sub1')">
    		<font face="Verdana" size="1">Link</font></div>
    	<font face="Verdana" size="1">
    	<span class="submenu" id="sub1">
    		- <a href="#"><span style="text-decoration: none">1</span></a><br>
    		- <a href="#"><span style="text-decoration: none">2</span></a><br>
    		- <a href="#"><span style="text-decoration: none">3</span></a><br>
    		- <a href="#"><span style="text-decoration: none">4</span></a>
    	</span>
    
    	</font>
    
    	<div class="menutitle" onclick="SwitchMenu('sub2')">
    		<font face="Verdana" size="1">Link</font></div>
    	<font face="Verdana" size="1">
    	<span class="submenu" id="sub2">
    		- <a href="#"><span style="text-decoration: none">1</span></a><br>
    		- <a href="#"><span style="text-decoration: none">2</span></a><br>
    		- <a href="#"><span style="text-decoration: none">3</span></a><br>
    		- <a href="#"><span style="text-decoration: none">4</span></a>
    	</span>
    
    	</font>
    
    	<div class="menutitle" onclick="SwitchMenu('sub3')">
    		<font face="Verdana" size="1">Link</font></div>
    	<font face="Verdana" size="1">
    	<span class="submenu" id="sub3">
    		- <a href="#"><span style="text-decoration: none">1</span></a><br>
    		- <a href="#"><span style="text-decoration: none">2</span></a><br>
    		- <a href="#"><span style="text-decoration: none">3</span></a><br>
    		- <a href="#"><span style="text-decoration: none">4</span></a>
    	</span>
    	
    	</font>
    	
    	<div class="menutitle" onclick="SwitchMenu('sub4')">
    		<font face="Verdana" size="1">Link</font></div>
    	<font face="Verdana" size="1">
    	<span class="submenu" id="sub4">
    		- <a href="#"><span style="text-decoration: none">1</span></a><br>
    		- <a href="#"><span style="text-decoration: none">2</span></a><br>
    		- <a href="#"><span style="text-decoration: none">3</span></a><br>
    		- <a href="#"><span style="text-decoration: none">4</span></a>
    	</span>
    	</font>
    </div>
    </body>
    Looking for a good desiner to design a social networking template.

    PM me.

  8. #8
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default

    What script are you useing? (post the whole lot)

    It would make it signifcantly easyer to tell you what needs to be changed o.0

  9. #9
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    I think Cняιѕ was right...

    It looks familiar.
    Last edited by Recursion; 18-01-2007 at 09:43 PM.
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  10. #10
    Join Date
    Dec 2006
    Location
    Doncaster, UK
    Posts
    4,244
    Tokens
    0

    Latest Awards:

    Default

    Ahhh,

    I'll try that, that's just taken out the image and inserted font tags.

    Worked a treat, thanks Chris.

    Common Sense really.
    Last edited by F32; 18-01-2007 at 09:51 PM.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •