I have a report which has id as hyperlink.when i click the
id it should move to next report which displays the
corresponding details.tell me how to get the value of
hyperlink(which id is clicked) dynamically using javascript?
so that i can make condition on my second report?
Answer Posted / abinash grahacharya
<script>
function show(id)
{
var n_id = id+1;
var div = 'div'+n_id;
for(var i=1;i<3;i++ )
{
var n_div = 'div'+i;
document.getElementById(n_div).style.display='none';
}
document.getElementById(div).style.display='block';
}
</script>
<div id='div1'>
<a href='#' onClick='show(1)'>Click 1</a>
Some description of 1st section
</div>
<div id='div2' style='display:none;'>
<a href='#' onClick='show(2)'>Click 2</a>
Some description of 2nd section
</div>
<div id='div3' style='display:none;'>
<a href='#' onClick='show(3)'>Click 3</a>
Some description of 3rd section
</div>
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
How to change the background color of HTML document using JavaScript?
How do you submit a form using JavaScript?
what are the differences between as2 and as3?
What is decodeuri(), encodeuri() in javascript?
How will you explain closures in javascript? When are they used?
How to remove duplicate values from a javascript array?
How can javascript language be separated from objects?
What is the use of spread operator?
What is a string in javascript?
What is Number object in JavaScript?
What is the function of deferred scripts?
Should I learn java first or javascript?
Is javascript enabled on my computer?
What is "strict mode" and how is it used in JavaScript?
What does the term sticky session mean in a web-farm scenario?