/    Sign up×
Community /Pin to ProfileBookmark

javascript:use radio button

i hav created a group of radio button..let say button A n B.

now i choose button A, n when i click button submit….this will make me to page A,

or when i choose button B, i will go to page B…how to do tis?
i need the coding to do the condition….any1, pls help me…!

n this is my radio button:

<input type=”radio” name=”rbqty” id=”rbqty” value=”Same”>Same Quantity
<input type=”radio” name=”rbqty” id=”rbqty” value=”Different>DifferentQuantity

i hav tried for 2 days….pls help me….

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@ShadoefaxJul 22.2005 — Try something like this:

[CODE]<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>linktest</title>
<script>
function LinkToPage(){
var LinkPage = "PageB.html";
if(document.getElementById("rbqty").checked){
LinkPage = "PageA.html";
}
//alert(LinkPage);
document.location = LinkPage;
}
</script>
</head>
<body>
<form onsubmit="LinkToPage()">
<input name="rbqty" id="rbqty" value="Same" checked="checked" type="radio">Same Quantity
<input name="rbqty" id="rbqty" value="Different" type="radio">Different Quantity
<input value="Click me" type="submit"></form>
</body>
</html>

[/CODE]
Copy linkTweet thisAlerts:
@wayne_kwauthorJul 22.2005 — thank you, Shadoefax!

i found something...it is better if i use frmselect.action to replace LinkPage....cos LinkPage not functioning...is it because i am using asp? or wat?

i hope i can find something in javascript to replace "response.redirect" in asp....can some1 help me?

meaning tat i will open a new window after i click ok button....

thanks!
Copy linkTweet thisAlerts:
@ShadoefaxJul 22.2005 — Wayne, I don't know asp that well. Maybe you should post your question in the [URL=http://www.webdeveloper.com/forum/forumdisplay.php?f=9]ASP[/URL] forum. They may be able to help you better.
×

Success!

Help @wayne_kw spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...