Solved

make a radio button go to anchor link on same page

Posted on 2004-04-08
2
2,881 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

919 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

21 Experts available now in Live!

Get 1:1 Help Now