jtjohnston
-
Posts
7 -
Joined
-
Last visited
Posts posted by jtjohnston
-
-
Might be useful to place totalNumberOfPages outside the function. Then again, I'm about to use totalNumberOfPages in another function. I'll post that after.
var totalNumberOfPages = 3;
function showPage(id)
{
for( i = 1; i <= totalNumberOfPages; i++)
{
// if(document.getElementById('page'+i))
// document.getElementById('page'+1).style.display='none';
// previous two lines do not work.
document.getElementById('page'+i).style.display='none';
}
if(document.getElementById('page'+id))
document.getElementById('page'+id).style.display='block';
}
-
Does it work?
I don't have much more knowledge. But you need to do this, IF you totalNumberOfPages is more than 2!
var totalNumberOfPages = 3;
for( i = 1; i <= totalNumberOfPages; i++)
{
// if(document.getElementById('page'+i))
// document.getElementById('page'+1).style.display='none';
// previous two lines do not work.
document.getElementById('page'+i).style.display='none';
}
These emoticons are making me much more nasty than I really am. It's a useful piece of JS, with a few repairs. I'm working on a tabbed menu page. I'll post an URL later.
John
-
Error: document.getElementByID is not a function
if(document.getElementByID('page'+i))
Should be spelled: Id as in
if(document.getElementById('page'+i))
not ID
:P
-
Any suggestions for parts by using an infrared LED instead of the laser?
John
-
http://www.hak5.org/wiki/index.php?title=E...with_Javascript
See " Div Tag Tricks with Javascript"
fuction should be spelled function.
Also, in Mozilla 1.7.13 I still get this error:
Error: document.getElementByID is not a function
Source File: file:///C:/WINDOWS/Bureau/Nouveau%20HTML%20Document.htm
Line: 9
Did I miss something in the episode?
John
<HTML>
<body><script language="javascript">
function showPage(id)
{
var totalNumberOfPages = 2;
for( i = 1; i <= totalNumberOfPages; i++)
{
if(document.getElementByID('page'+i))
document.getElementById('page'+1).style.display='none';
}
if(document.getElementById('page'+id))
document.getElementById('page'+id).style.display='block';
}
</script>
<div id="navigation">
<a href="java script:onClick=showPage('1')">page 1</a>
<a href="java script:onClick=showPage('2')">page 2</a>
</div>
<div id="page1" style="display: none;">aa
</div>
<div id="page2" style="display: none;">bb
</div>
</body>
</HTML>
-
Hi,
I caught your episode on CFH2. Where can I find a parts list for the laser AM transmitter?
What I was thinking about is doing something similar, but with infrared leds. My crappy BellExpressvu remote that I'm about to pitch has nice, strong leds for example.
I did not see much in the way of a parts list or instructions here:
or here:
http://hak5.podzinger.com/results.jsp?col=...k.5&q=laser
It's been years since I have done any serious playing with my soldering iron :twisted: :twisted:
Error: Div Tag Tricks with Javascript
in Questions
Posted
Working on this for right now:
http://jtjohnston.ca/test/tabbedmenu.html
I have the Hak5 errors fixed for now.