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
What is undefined value means in javascript?
Is client side front end?
What is output of “20” + 20? In javascript?
Why is javascript dangerous?
What is a nan value?
How do I run javascript in chrome?
What are the types of data types?
How to count the number of element in an array using javascript?
Is javascript enabled on chrome?
How do you submit a form using JavaScript?
What is nodetype in javascript?
What is Javascript namespacing? How and where is it used?
How to call a function inside a function in javascript?
How would you check if a variable is null/undefined?
Is javascript multi-threaded or single-threaded?