Menu
See the relevant sticky:
[url]https://webdeveloper.com/forum/showthread.php?t=62111
What do you think? Got anything to add?
[i][b]Shrek[/b]: - For your information, there's a lot more to ogres than people think.
[b]Donkey[/b]: - Example?
[b]Shrek[/b]: - Example? Okay. Uh... ogres are like onions.
[b]Donkey[/b]: - They stink?
[b]Shrek[/b]: - Yes. No!
[b]Donkey[/b]: - Oh, they make you cry?
[b]Shrek[/b]: - No!
[b]Donkey[/b]: - Oh, you leave them out in the sun, they get all brown and start sprouting little white hairs.
[b]Shrek[/b]: - No! Layers! Onions have layers. Ogres have layers. Onions have layers. You get it? We both have layers. [/i][/QUOTE]
<i>
</i><div id="banners">
<h4>Affiliate Links</h4>
<ul>
<li><a href="www.google.com"><img alt="Search Web with Google" src="googlelogo.png"></a></li>
<li><a href="www.yahoo.com"><img alt="Search Web with Yahoo" src="yahoologo.png"></a></li>
<li><a href="www.msn.com"><img alt="Search Web with MSN" src="msnlogo.png"></a></li>
</ul>
</div>
<i>
</i>#banners
{ position: absolute;
top: 10px; /* top coordinate */
right: 10px; /* puts banners in the top right corner */
}
<i>
</i>#banners h4
{ display: none;
}
#banners img
{ border: none;
}
#banners ul, #banners li, #banners a, #banners img
{ margin: 0;
padding: 0;
}
<i>
</i>#banners ul
{ display: block;
height: 80px;
overflow: hidden;
}
#banners li
{ display: block;
list-item-style: none;
}
<i>
</i>function lIterator(listElement,delay)
{ /* Constructor */
<i> </i>/* Dynamic Methods */
}
/* Static Properties */
/* Static Methods */
<i>
</i> for(var i=listElement.childNodes.length-1; i>=0; i--)
if(!/li/i.test(listElement.childNodes[i].nodeName))
listElement.removeChild(listElement.childNodes[i]);
<i>
</i> for(var i=1; i<listElement.childNodes.length; i++)
listElement.childNodes[i].style.display = 'none';
<i>
</i> this.currentLI = listElement.firstChild;
<i>
</i>/* Static Properties */
lIterator.instances = new Array();
<i>
</i> this.id = lIterator.instances.length;
lIterator.instances.push(this);
<i>
</i>setInterval('lIterator.instances['+this.id+'].showNext()',delay);
<i>
</i>/* Dynamic Methods */
this.showNext = function()
{ this.currentLI.style.display = 'none';
/* Following line is broken for readability */
this.currentLI =
this.currentLI.nextSibling ?
this.currentLI.nextSibling :
this.currentLI.parentNode.firstChild;
<i> </i> this.currentLI.style.display = 'block';
<i> </i> }
<i>
</i>onload="new lIterator((document.getElementById('banners')).getElementsByTagName('ul')[0],1000);"
To make a script for this, can I just make an accessible script? Or do I have to go through it with detailed notes the way Vladdy has?[/QUOTE]
[i]Originally posted by fredmv[/i]
[b]If you feel you have a worthy addition (i.e., an accessible script), feel free to PM me. What you should first do, however, is create a thread here in the JavaScript section explaining what it does, an example of how it use it, etc. which will be left open for discussion among the other members (e.g., if they need help setting it up on their site).[/b][/quote]
Welcome to the "Accessible Scripting 101" thread. This thread will feature JavaScript scripts developed with accessibility in mind. In other words, these are[color=royalblue]scripts[/color] in which will degrade properly in the case that JavaScript isn't available to your end-user (which it isn't always, believe it or not).
[/QUOTE]
<i>
</i><p id="myPara"></p>
<script type="text/javascript"><!--
if(document.getElementsByTagName) onload = function(){
var t = setTimeout("document.getElementById('myPara').innerHTML = 'Some text.'; clearTimeout(t)", 10000);
}
//--></script>
<i>
</i><p id="myPara">Some text.</p>
<script type="text/javascript"><!--
if(document.getElementById) document.getElementById("myPara").style.display = 'none';
if(document.getElementById) onload = function(){
var t = setTimeout('document.getElementById("myPara").style.display = "block"; clearTimeout(t)', 10000);
}
//--></script>
<i>
</i><p id="myPara">Some text.</p>
<script type="text/javascript"><!--
if(document.getElementsByTagName) onload = function(){
var t = setTimeout("document.getElementById('myPara').innerHTML = 'Some text.'; clearTimeout(t)", 10000);
}
//--></script>
<i>
</i><SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT"><!--
document.write("<font color=royalblue>JavaScript is enabled</font>")
//--></SCRIPT>
<NOSCRIPT>
<font color=red>JavaScript is disabled</font>
</NOSCRIPT>
<SPAN style="color: red;" id="JSenabled">JavaScript is disabled</SPAN>
<SCRIPT LANGUAGE="javascript" TYPE="text/javascript">
<!--
var subject=document.getElementById("JSenabled");
subject.style.color="royalblue";
subject.firstChild.nodeValue="JavaScript is enabled";
//-->
</SCRIPT>
<script type="text/javascript">
function exp(theId) {
var elem=document.getElementById(theId);
if(elem.style.display=="none") elem.style.display="block";
else elem.style.display="none";
}
</script>
<a href="#" onclick="exp('sec1');return false">Open/Close</a>
<div id="sec1" style="display:none">
Expanding / collapsing content goes here...
</div>
This creates a section that is initially hidden, but the user can show/hide the contents by clicking the link. Unfortunately, in the above, anyone without javascript will not be able to expand the hidden section.<script type="text/javascript">
function exp(theId) {
var elem=document.getElementById(theId);
if(elem.style.display=="none") elem.style.display="block";
else elem.style.display="none";
}
</script>
<a href="#" onclick="exp('sec1');return false">Open/Close</a>
<div id="sec1" style="display:[color=red]block[/color]">
Expanding / collapsing content goes here...
</div>
[color=red]<script type="text/javascript">
document.getElementById("sec1").style.display="none";
</script>[/color]
so that the section will be visible for those without javascript.What about when javascript is a necesary part on a web application?[/QUOTE]
...in the same way the GMail does[/QUOTE]you mean by having an address for web public, and the other one for mobile phone puplic?
0.1.9 — BETA 5.19