473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Making alternative menu if javascript is turned off?

Hi,

I have found some menu functions. It works quite well, but how can I
replace it with a simple <a href> if javascript is turned off?

I reduced my code to:
<script>Include MenuHere()</script>

More, any tips about "fading" the menu item in and out (x-browser)?
Currently it's using DIVs and this.items[i].visibility(fal se);

--
-Gernot

Post here, don't email. If you feel you have to mail, revert my
forename from:
to************* *************** **@invalid.com
_______________ _______________ __________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
Jul 23 '05 #1
10 2140
Gernot Frisch wrote:
I have found some menu functions. It works quite well, but how can I
replace it with a simple <a href> if javascript is turned off?

I reduced my code to:
<script>Include MenuHere()</script>


<script>Include MenuHere()</script>
<noscript><a href="http://www.example.com/menu/">Menu</a></noscript>

--
Klaus Johannes Rusch
Kl********@atme dia.net
http://www.atmedia.net/KlausRusch/
Jul 23 '05 #2
Klaus Johannes Rusch wrote:
I have found some menu functions. It works quite well, but how can I
replace it with a simple <a href> if javascript is turned off?

I reduced my code to:
<script>Include MenuHere()</script>


<script>Include MenuHere()</script>
<noscript><a href="http://www.example.com/menu/">Menu</a></noscript>


Script - Noscript is unlikely to be the true relationship between a
functional DHTML menu and no navigation. True, the browsers that will
not execute scripts at all will use the noscript element, but there is a
big grey aria of javascript capable browsers that are more or less
dynamic and may or may not facilitate the actions required by the
script. Leaving any that don't support the menu but are executing
scripts without any navigation.

Various strategies may be applied to the problem, of which the simplest
is probably just to provide a link to a site map in the HTML and leave
it there regardless of whether the menu works. But a functional dynamic
DHTML menu implies the ability to manipulate HTML page contents so it
would be possible for a menu that has verified that it is supported and
functional to conceal/remove alternative navigation.

Overall, probably the most viable strategy is to have the navigation
menus defined on the page as, say, nested UL lists, and have the menu
script modify those elements into a dynamic menu when possible. Leaving
all browsers that lack support for the menu showing full navigation as
part of the page contents.

Richard.
Jul 23 '05 #3
> Overall, probably the most viable strategy is to have the navigation
menus defined on the page as, say, nested UL lists, and have the menu script modify those elements into a dynamic menu when possible. Leaving all browsers that lack support for the menu showing full navigation as part of the page contents.


That sounds nice, but I don't absolutely know how to do this. It's an
sophisitcated topic, is it?
Here's my menu so far:
http://GLBasic.com

-Gernot
Jul 23 '05 #4
That sounds nice, but I don't absolutely know how to do this. It's an
sophisitcated topic, is it?
Here's my menu so far:
http://GLBasic.com

-Gernot


This might not be what your looking for... but it might help ;) just some
DOM 1 stuff ;) The document elements have alot of properties you can change,
so do some googling ^.^

<script language=javasc ript>
function makeMyMenuStrin gFormMenu(menuN um) {
if (menuNum == 1) {
return '<a href="Not Blah Anymore">Not Blah Anymore</a>';
}
}

function loadMenus() {
// Make menu items color grey
document.getEle mentById('menuI tem1').style.co lor = '#E0E0E0'
// Make background black
document.getEle mentById('menuI tem1').style.ba ckgroundcolor = '#000000'
// Change the actual HTML inbetween the <a id="name"> ... </a>
document.getEle mentById('menuI tem1').innerHTM L =
makeMyMenuStrin gFormMenu(1);
}
</script>

....
....
<body onLoad="loadMen us();">
....
....

<a id="menuItem1"> <!--This is basic, html, without jscript version --><a
href="Blah">Bla h</a></a>
Jul 23 '05 #5
document.getEle mentById('menuI tem1').innerHTM L =
makeMyMenuStrin gFormMenu(1);

Ahhh.. Now, <TABLE ID="MyTable"> ...here go the links...</TABLE>

<SCRIPT>documen t.getElementByI d('MyTable').in nerHTML =
MakeMyMenuRepla ceTheOldTable() ;</SCRIPT>

will work??
Have to try that. Very cool!

BTW. JavaScript looks more and more attractive to me. Is there any
Intelli-sense IDE for it? Or at least an reference where I can read
about all methods and properties available for all object types?

--
-Gernot

Post here, don't email. If you feel you have to mail, revert my
forename from:
to************* *************** **@invalid.com
_______________ _______________ __________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
Jul 23 '05 #6
I just google stuff... but most things in javascript work of two things, A)
DOM and B) Java objects. So if you have:

var myStr = "some string";

or

var myStr = String("some string");

it same thing... but the cool thing is both are "String Objects" so straight
our of the Java API (and not javascript) someone could...

myStr.substring (start, end);

and DOM is a W3C standard, DOM 0 was Netscape, but the new DOM 1 is
standard, so read up on DOM (the id="something" stuff, and the
document.domThi ngy (stuff under the document variable (or, at least
functionally, object) is all DOM as far as i know)... But i'm new to
jscript... only been playing with it about a week or so... I'd say read the
base object types (ie string, char, boolean, integer) in the java API to get
a feel for what your variables can do... and read up on DOM...

"Gernot Frisch" <Me@Privacy.net > wrote in message
news:c6******** ****@ID-37212.news.uni-berlin.de...
document.getEle mentById('menuI tem1').innerHTM L =
makeMyMenuStrin gFormMenu(1);

Ahhh.. Now, <TABLE ID="MyTable"> ...here go the links...</TABLE>

<SCRIPT>documen t.getElementByI d('MyTable').in nerHTML =
MakeMyMenuRepla ceTheOldTable() ;</SCRIPT>

will work??
Have to try that. Very cool!

BTW. JavaScript looks more and more attractive to me. Is there any
Intelli-sense IDE for it? Or at least an reference where I can read
about all methods and properties available for all object types?

--
-Gernot

Post here, don't email. If you feel you have to mail, revert my
forename from:
to************* *************** **@invalid.com
_______________ _______________ __________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com

Jul 23 '05 #7
On Wed, 21 Apr 2004 10:48:44 +0200, Gernot Frisch <Me@Privacy.net > wrote:
document.getEle mentById('menuI tem1').innerHTM L =
makeMyMenuStrin gFormMenu(1);

Ahhh.. Now, <TABLE ID="MyTable"> ...here go the links...</TABLE>

<SCRIPT>documen t.getElementByI d('MyTable').in nerHTML =
MakeMyMenuRepla ceTheOldTable() ;</SCRIPT>

will work??
Have to try that. Very cool!


I can't say I like that approach. I imagine that it will still provide
poor support for some browsers. Richard's suggestion of a list modified by
CSS and scripting is the best. Though many people implement menus along
this line, the only one that I've found to be well implemented to date is
this one:

<URL:http://www.gazingus.or g/html/Using_Lists_for _DHTML_Menus.ht ml>

It is a little different in that you must click on the items to open the
menu (just like an application menu bar), but at least this means that the
menu won't disappear whilst you're trying to make a selection.

Be aware that this style of menu will mean you must provide valid pages
for the first level of links, as well as for the sub-menus. However, this
will have been a consideration with any well implemented menu.
BTW. JavaScript looks more and more attractive to me. Is there any
Intelli-sense IDE for it?
Unfortunately, it's not practical (though some vendors have implemented
them anyway). There isn't really any guaranteed set of properties and
methods that are supported by all browsers, especially with regard to
newer technologies. You could list every single known member for an
object, but that wouldn't be very helpful to the developer.
Or at least an reference where I can read about all methods and
properties available for all object types?


The group's FAQ contains some:

<URL:http://jibbering.com/faq/>

A shorter list would contain (watch for wrap)

Netscape's JavaScript references:
<URL:http://devedge.netscap e.com/central/javascript/>

Note that the more recent version strip out the older host objects
(document, window, location, history, etc). I presume that this is because
they wish to focus around the World Wide Web Consortium (W3C) Document
Object Model (DOM). However, the host objects are still implemented in
browsers, and are described in v1.3 of the references.

Microsoft's DHTML reference:
<URL:http://msdn.microsoft. com/workshop/author/dhtml/reference/dhtml_reference _entry.asp>

A lot of the features described are implemented only by IE, so you should
be careful what you use. The documentation is also incorrect in places.

W3C DOM technical reports:
<URL:http://www.w3.org/DOM/DOMTR>

The Level 1 specifications are fairly well supported by recent browsers,
and the more compliant browsers (Mozilla and Opera) do well with Level 2.
Level 3 has only recently reached Recommendation status, so support will
be poor.

ECMAScript specification:
<URL:http://www.ecma-international.o rg/publications/standards/Ecma-262.htm>

This particular piece of documentation can be very difficult to
understand, but it does specify exactly what JavaScript should support, as
well as it's syntax and features. The Netscape references give a much more
understandable, though simplified, description of most of the contents.

I'd recommend that you also read the group FAQ (link already given above),
particularly item 4.26 - How do I detect Opera/Netscape/IE? That article
contains links on how to perform feature detection - vital when using
objects that aren't always supported.

Good luck,
Mike

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #8
To get things right:

I don't want to support browsers older than the IE4.x, I only want my
menu to be displayed, if someone disables Javascript - will the
<noscript> work then??
-Gernot
Jul 23 '05 #9
On Wed, 21 Apr 2004 11:14:00 GMT, Robert Diamond <-r***@anti.spam. com>
wrote:
I just google stuff... but most things in javascript work of two things,
A) DOM and B) Java objects. So if you have:

var myStr = "some string";

or

var myStr = String("some string");

it same thing...
Though the latter isn't very practical. You only need to use the String()
constructor as a function when you want to convert another type to a
string. For example,

var myStr = String( 7 );

will produce "7", as will

var myStr = '' + 7;

The conversion in the latter example is performed automatically.
but the cool thing is both are "String Objects"
Actually, they are both string values. However, you can still use String
object methods and properties. For example,

var myStr = "some string";
myStr.charAt( 6 ) // 't'
'7'.length // 1

To create a String object, you would use "new String(...)". However, I
don't think there's much need for you to ever do that.
so straight our of the Java API (and not javascript) someone could...
I don't see what the Java API has to do with it...
myStr.substring (start, end);
....but you can certainly do that in JavaScript.
and DOM is a W3C standard, DOM 0 was Netscape,
I believe that "DOM 0" refers to a combination of Netscape's and
Microsoft's object models during the time before DOM 1.
but the new DOM 1 is standard, so read up on DOM (the id="something"
stuff, and the document.domThi ngy (stuff under the document variable
(or, at least functionally, object) is all DOM as far as i know)... But
i'm new to jscript... only been playing with it about a week or so...
I'd say read the base object types (ie string, char, boolean, integer)
in the java API to get a feel for what your variables can do... and read
up on DOM...


I'd suggest reading Netscape's JavaScript Guide would be a better
start[1]. Links are in my other post.

[snip]

Mike
Please don't top-post.

[1] Skip v1.3. Though that version of the reference is good for host
objects, the guide contains information that is obsolete and should be
avoided, particularly with regard to including scripts in HTML.

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1892
by: relaxedrob | last post by:
Howdy All! I have just finished developing a menu template for easy use in an any web page! The example uses CSS and JavaScript. The url is: http://phd.netcomp.monash.edu.au/RobertMarkBram/menu/
5
3339
by: Papa.Legba.666 | last post by:
I am a total lamer clueless stupid newbie (so please flame me). Honestly, I know nothing of CSS, although I tend to pick things up quickly... A friend pointed out that my JavaScript menu prevents Google from crawling my site and told me that I need a CSS menu. Ok, I'm willing. So I looked at a bunch of examples and one thing bothers me ...
2
1897
by: Simon Wigzell | last post by:
Is it possible within javascript to stop the little pulldown menu (with the values that the browser remembers have previously been entered into the field) from appearing? I have one very dense form where the pulldown menu appears on top of the push button that causes an action when the field content is changed. It is unnescessary and causes an extra click in a very click intensive form. Can it be turned off for the entire page as well? That...
7
2999
by: johkar | last post by:
I am confused on childNodes or children. When you have nested lists, I would think it would all be one list in the Dom, this doesn't seem to be the case. So how do you traverse an unordered list? Any help appreciated. John In the below script, I can expand and contract the nodes when clicked on, but I want the menu to close all other siblings to the node clicked so that only one sub menu option is expanded at one time. If the node...
18
3537
by: Andromeda | last post by:
I've been trying to add a tree menu to my website with some luck (more or less). I came across a script on simplythebest.net, but I seem to be having a problem with it... and since they have no help section, this has brought me here. The script can be found at http://simplythebest.net/scripts/DHTML_scripts/dhtml_script_100.html (no login or anything required... I just thought the script might be too long to repost here)
7
21314
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a question about PHP, perl, VBScript, Java(.class), or ActiveX. Let us _only_ deal with JavaScript for...
21
30139
by: abctech | last post by:
Hi all, I am working on a web application using JSP and Javascript. I have attached a snapshot of my form here, I have 2 different Jsps here, viz Jsp1 and Jsp2. On hitting the 'Show' button on Jsp1 I make another Jsp(Jsp2) pop up as a subwindow containing a Table T1. But many users have popup blockers turned on and in that case Jsp2 doesnot even show up,so is there any alternative such that I can show Table T1 as a part of Jsp1...
1
1845
by: HACKhalo2 | last post by:
Hi. I'm helping a friend of mine develop an online game, which is currently outdated. The person making skins for the site came up with a cool looking NavBar (found at http://www.thejackofclubs.net/images/soc_concept4.png ) and I want to change the current navbar (which is right now generated via PHP using tables and outdated expressions). The code is <script language="javascript" type="text/javascript"> <!-- Modified menu code --> <!-- /*...
0
10163
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9957
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9835
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5276
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.