473,473 Members | 2,163 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Style

Lots of people say that

a link (ie href="") should only ever point to another web page, not a
javascript.
a form button should only ever point to a server executable or a post
method

So what is a mutually acceptable trigger for something to activate a
javascript? Or should we just ignore all those people trying to impose
their own style on things?
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #1
5 1556
In article <bo*************@ID-174912.news.uni-berlin.de>,
la****@hotmail.com says...
Lots of people say that

a link (ie href="") should only ever point to another web page, not a
javascript.
a form button should only ever point to a server executable or a post
method

So what is a mutually acceptable trigger for something to activate a
javascript? Or should we just ignore all those people trying to impose
their own style on things?


What's wrong with the JavaScript events (on*)?

--
Hywel I do not eat quiche
http://hyweljenkins.co.uk/
http://hyweljenkins.co.uk/mfaq.php
Jul 20 '05 #2
"Fabian" <la****@hotmail.com> writes:
Lots of people say that

a link (ie href="") should only ever point to another web page, not a
javascript.
I concur. The typical behavior associated to a link is fetching the
resource that the link points to. Typical labels of links are nouns
or descriptions: "Cats", "Movies", "My links", "Rocket Science".
a form button should only ever point to a server executable or a post
method
I disagree. Form controls can exist without a form, e.g., in DHTML
applications. The behavior associated with a button is that clicking
it makes something happen. Typical labels on buttons are verbs or
actions: "Go!" "Activate", "Close window", "Energize".

A good sign that using a link is misuse is that you don't know what
to write in the href. Without a href, an <a>-element is no more special
than a <span>. Adding, e.g., href="#" (a href that is never used anyway)
is only to change how the element *looks*, which is really something one
should do with CSS, not HTML.
So what is a mutually acceptable trigger for something to activate a
javascript?
Unless the Javascript fetches a resource (you can write javascript
that emulates a link perfectly), probably a button. Consider what
you would write in the link/on the button.
Or should we just ignore all those people trying to impose
their own style on things?


At your own peril. These rules describe what usability experts have
found that people typically expect. Going against the users'
expectations is rarely a smart move. It just makes the vote with their
feet^H^H^H^Hback button.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3
Lee
Fabian said:

Lots of people say that

a link (ie href="") should only ever point to another web page, not a
javascript.
a form button should only ever point to a server executable or a post
method


I don't believe you've heard lots of people say that second line.

The "submit" type of button should only be used to hit the server,
but other buttons were intended to invoke local code, via the
onClick attribute.


Jul 20 '05 #4
In article <bo*************@ID-174912.news.uni-berlin.de>,
la****@hotmail.com enlightened us with...
Lots of people say that

a link (ie href="") should only ever point to another web page, not a
javascript.
Generally a good practice for browser compatibility. I've seen
exceptions, but they're rare and usually involve non-internet
applications.
a form button should only ever point to a server executable or a post
method
I don't know that I would agree with that. For internet applications,
maybe...but for everything else one can use HTML for, no way.
So what is a mutually acceptable trigger for something to activate a
javascript?
An event (i.e. onClick) of any block element (i.e. table cells, divs,
anchors...).

<a href="SomeNonJSpage.html" onClick="doSomething();return false;">link
text</a>

This allows browsers that have script disabled to still have a
functioning link. Use the link to point to a page that tells them they
need script enabled. This does not work in NN4, which doesn't support
onClick for A.

<div onClick="whatever()">Whatever</div>
This works in most browsers, but not old ones. I *think* it doesn't work
in NN4. 95% of people use IE5 and up. However, you should try to know
your users. You might find out a lot of people come in with Opera or
netscape 4. Site stats are a nice thing.
Or should we just ignore all those people trying to impose
their own style on things?


There's a reason they say stuff - look into the reason and judge for
yourself.
-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #5
Hywel Jenkins wrote:
la****@hotmail.com says...
So what is a mutually acceptable trigger for something to activate a
javascript? Or should we just ignore all those people trying to impose
their own style on things?


What's wrong with the JavaScript events (on*)?


Events and event handlers are not restricted to
JavaScript or other implementations of ECMAScript.
They are part of (X)HTML and the DOM of the UA.
PointedEars
Jul 20 '05 #6

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

Similar topics

4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
1
by: Roy | last post by:
Hey all. All I'm trying to do is get a darn double solid bar in my datagrid footer. Doesn't seem to work. Any tips? The weird thing is all the other stylesheet attributes work. If I increase the...
0
by: cedoucette | last post by:
I just wrote code to support sortable columns in a datagrid. It seems to work fine; but, it doesn't look right. The problem is that I have a generic style for links and a different style for the...
1
by: RonY | last post by:
I have a dropdown which calls SetTimePeriod method on change the selection. In the JS function, I reset the field style.display based on what the selection is. This works fine with IE but not working...
8
by: JT | last post by:
Hi, I have done a fair amount of style editing inline in ASP. I'm now using VS 2005 with a standard web project (not Web Application Project). This is my first foray into CSS in a style sheet...
6
by: rongchaua | last post by:
Hi all, I want to change the style of a button. But I don't know how to do it. For example, I have already a button OK on form. I want to add these styles to this button (WS_CHILD || WS_VISIBLE ||...
1
by: Armin Gajda | last post by:
Hi, I have the following problem: An input field get a border assigned by a style class (e.g. 2px solid red). When the field gets the focus, we set the border to green. element.style.border...
0
by: =?Utf-8?B?QXR1bA==?= | last post by:
When .Net 1.0 webservice (VS2003) generates a wsdl - <wsdl:binding name="TestSoap" type="tns:TestSoap"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/(note:...
3
by: Michellevt | last post by:
Hi I am working on a project (for college) and wondered if anyone can help me with my problem. In the project we are not allowed to make use of any "style" attributes but "class" attributes...
3
Claus Mygind
by: Claus Mygind | last post by:
I want to move some style setting into a javaScript function so I can make them variable but I get "invalid assignment left-hand side" error? see my question at the bottom of this message. It...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.