/    Sign up×
Community /Pin to ProfileBookmark

Javascript with Radio Buttons

Hello,
I have 2 radio buttons. When the user picks one option, I want my website to be saved as a bookmark. If the user picks the other radio button, i want my website to become their new homepage. How can I do this using javascript with my radio buttons? This is the code I have thus far:

[CODE]<form>
<p>
<label>
<input name=”RadioGroup1″ type=”radio” onClick=”MM_callJS(‘this.style.behavior=’url(#default#homepage)’)” >
<a href=”this.style.behavior=’url(#default#homepage)”>Make this your homepage!</a></label>
<br>
<br>
<label>
<input name=”RadioGroup1″ type=”radio” onClick=”MM_callJS(‘javascript:addbookmark()’)”>
<a href=”javascript:addbookmark()”>Make this your favorite!</a></label><br>
<br>
</p>
</form>[/CODE]

Please help! ?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@iGirlMay 03.2008 — Hi latoyale

I'm trying to do something similar so maybe we can help each other. I'm not sure if this is what you're looking for but try this:

[CODE]<script type="text/javascript">
function setHome()
{if(document.all.style.behavior='url(#default#homepage)';
document.all.setHomePage('http://www.yoursite.com');}
</script>

<script type="text/javascript">
var url = "http://www.yoursite.com";
var title = "Your Site";
function bookMark()
{if(document.all)window.external.AddFavorite(url,title);}
</script>

<form name="yourform">
<input type="radio" onclick="setHome()" name="sthm" value="sethome" />
<label>Make this your homepage</label>
<input type="radio" onclick="bookMark()" name="bmrk" value="bookmark" />
<label>Make this your favorite</label>
</form>[/CODE]


Now the bookmark script works but the set homepage script doesn't and this is what I'm having trouble with. As I'm sure you're aware these scripts only work in IE. What I'm trying to do is have a link that sets homepage in IE but links to a url in other browsers. The url will be an info page on how to set homepage in Firefox, Safari, Opera etc.


I hope this helps (the bookmark script at least :o ). If you find a solution for the set homepage script please reply and post it. I'm really stuck.
×

Success!

Help @latoyale 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.18,
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,
)...