Solved

make a radio button go to anchor link on same page

Posted on 2004-04-08
2
2,879 Views
Last Modified: 2012-06-21
Hi,
  I was wondering if anyone could help me with my script.

I currently have a layer(stage2) appear when you select a radio button:

<input type="radio" name="radio1" value="One Time" onclick="expandcontent('stage2');" />


What I need is to somehow make the browser scroll down to the anchor link <a name="two"></a>
which is where the layer appears (which is at bottom of page).  But i want to insert something into this radio button tag....I just can't figure out how to do this...

Thanks for any help on this!
-Ron.


0
Comment
Question by:ron4721
2 Comments
 
LVL 16

Accepted Solution

by:
jaysolomon earned 250 total points
ID: 10786227
<input type="radio" name="radio1" value="One Time" onclick="expandcontent('stage2');window.location='#two';" />
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 10786425
Or like this:

<html>
<head>
<script>
function expandcontent(divId){
  theDiv = document.getElementById(divId);
  theDiv.style.display='block';
  window.scrollTo(0,theDiv.offsetTop)
}
</script>
</head>
<body>
<form>
<input type="radio" name="radio1" value="One Time" onclick="expandcontent('stage2');" />
</form>
<div style="height:2000px"></div>
<div id=stage2 style="display:block">stage2</div>
<div style="height:2000px"></div>
</body>
</html>

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now