I'm a php person not JS so I'm a little slow with JS. I have a php page that is in a for loop and will pass the javascript function a variable like "uniquename1" or "uniquename2"
My JS function looks like this, not pretty but works for me with a single variable (not with the .d parts). How can I get the function to accept a dynamic variable like the two above?
My JS function looks like this, not pretty but works for me with a single variable (not with the .d parts). How can I get the function to accept a dynamic variable like the two above?
Code:
function ShowContent(d) {
if(d.length < 1) { return; }
if(d == "uniquename".d){
document.getElementById('empty'.d).style.display = "none";
document.getElementById('hi5'.d).style.display = "none";
document.getElementById('uniquename'.d).style.display = "block";
}
if(d == "hi5".d){
document.getElementById('empty'.d).style.display = "none";
document.getElementById('uniquename'.d).style.display = "none";
document.getElementById('hi5'.d).style.display = "block";
}
}