Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

make a radio button go to anchor link on same page

Posted on 2004-04-08
2
Medium Priority
?
2,890 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
jaysolomon earned 1000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

722 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