
Originally Posted by
mastergeek70
<script language="JavaScript">
The language attribute has been deprecated for years. Use the type attribute, instead:
HTML Code:
<script type="text/javascript">
<!-- Hide from old browsers
That hasn't been necessary for years, either. No "old browsers" are old enough not to understand a script element, whether they can support client-side scripts or not. The same applied to embedded style sheets.
function toggle(id) {
var b = document.getElementById(id);
No feature detection?
Code:
function toggleDisplay(element) {
var style;
if (typeof element == 'string')
element = document.getElementById ? document.getElementById(element) : null;
if (element && (style = element.style))
style.display = (style.display == 'none') ? 'block' : 'none';
}
<a href="javascript
: toggle('divSearch');">Search</a>
Don't use the javascript pseudo-scheme to do that. It's not only bad form for users that don't have scripting enabled (or script-capable browsers, for that matter), but the pseudo-scheme causes problems in MSIE - and not unreasonably.
If important features are to be hidden and shown using scripting, then scripting should be used to hide them in the first place. Do not use a CSS rule, in-line or in an embedded or linked style sheet.
<div style="position:absolute;left:75;
75 what, exactly?
border-style:solid;border-color:black;border-width:1px;
That's quite a waste:
border: solid 1px black;
250 what? 100 what?
The center element? Good grief...
Pseudo-XHTML markup, coupled with
upper-case tag names. That's really not a good example to set to anyone, let alone someone asking for help.
Mike
Bookmarks