[SOLVED] Javascript - Find all matching ID's starting with..
Posted: Tue Jun 28, 2005 1:11 am
I have a list of id's that all start with "list_" and a given number.
I want to create a function in javascript that will find all of those elements and reverse the value of .style.display (from none to block, and vice versa). I currently have a function that will set all elements that are from id="list_1" to id="list_100" but I don't want to limit it to 100 and I dont want it to freeze the browser for x amount of seconds during this call.
Any suggestions are welcome.
Code: Select all
<div id="e;list_1"e;>jkfd</div>
<div id="e;list_2"e;>jkfd</div>
<div id="e;list_3"e;>jkfd</div>
<div id="e;list_4"e;>jkfd</div>
<div id="e;list_5"e;>jkfd</div>
<div id="e;list_6"e;>jkfd</div>
<div id="e;list_7"e;>jkfd</div>
<a href="e;#"e; onclick="e;javascript:togglesweep( 'list_' );"e;>Toggle display</a>Any suggestions are welcome.