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

Is null in javascript?

473


Why jquery is used instead of javascript?

431


What are the main functions performed by javascript statements?

506


How can a page be forced to load another page in javascript?

645


In Javascript are calculations with fractional numbers guaranteed to be precise?

531






Can I learn javascript without html?

501


What are the main features of javascript?

481


Why do we use javascript?

448


Why do we need javascript?

466


What are undefined and undeclared variables?

489


How to set the cursor to wait?

487


how can we retrieve value from one database server and store them another database server using sql server code

1549


What does break and continue statements do in javascript?

520


What is an ECMAScript?

550


If we want to return the character from a specific index which method is used?

618