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


Please Help Members By Posting Answers For Below Questions

What is the use of javascript?

519


What are the advantages of using JavaScript?

568


What are the five data types?

462


What is hoisting in javascript?

480


What does parse Query String return in javascript?

526






Where javascript variables are stored?

463


What's the purpose of javascript?

442


How to read elements of an array in JavaScript?

522


How do I start a javascript project?

468


What is foreach loop in javascript?

525


Are there any training Institutions on iphone Automation testing?

1789


Why is javascript dangerous?

495


How to handle exceptions in JavaScript?

507


What is an asynchronous programming? Why is it important in javascript?

532


What applications use javascript?

464