Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to modify this code to allow multiple call? 1

Status
Not open for further replies.

IEAN

Programmer
Sep 13, 2003
122
US
How do I modify this code so that there can be mutiple call of the function "Display" to display different sections?

<script type="text/javascript">
function display(obj,id1) {
txt = obj.options[obj.selectedIndex].value;
document.getElementById(id1).style.display = 'none';
if ( txt.match(id1) ) {
document.getElementById(id1).style.display = 'block';
}
}

</script>
 
Since the section to show/hide is determined by the second parameter, you would simply pass in a different value for the second parameter when you are calling the function.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi Dan, thank you for your response. I tried, no error in the code but the second call does absolutely nothing, don't know why. I am very new to Javascript, could I be doing something wrong?
 
Wait, its fixed, I forgot to rename a field. Thanks Dan!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top