TigaFan09 Posted April 10, 2006 Share Posted April 10, 2006 I am trying to make it easier to comment people on Myspace. The way I'm trying to set it up, selecting a name from a drop down menu will determine who I am sending the comment to. I'm having trouble setting the javascript up to change a value in the html when I select a different name in the drop-down menu.This is my html: <html><body><script type="text/javascript" src="who.js"></script><form name="whoform"><select name="whodd" onchange="ChangeFriend()"><option value="me">me<option value="lucas">Lucas<option value="emily">Emily<option value="madeline">Madeline<option value="sydney">Sydney</select></form><br><br><br><form name="commentbox" method="post" action="http://comments.myspace.com/index.cfm?fuseaction=user.ConfirmComment"><input name="friendID" id="friendID" value="" type="hidden"><textarea name="f_comments" style="width: 250px; height: 150px; background-color: 000000; color: FFFFFF; font-family: comic sans ms; font-size: 12px; border: 2px dashed 2288EE; "></textarea><br /><input type="submit" value="Comment" /></form></body></html>The bit that needs to be changed is underlined.This is my java script:function ChangeFriend(){ if (document.whoform.whodd.value == "me") { changePropById('friendID','value','50874315'); } if (document.whoform.whodd.value == "lucas") { changePropById('friendID','value','61124154'); } if (document.whoform.whodd.value == "emily") { changePropById('friendID','value','46932298'); } if (document.whoform.whodd.value == "madeline") { changePropById('friendID','value','32584992'); } if (document.whoform.whodd.value == "sydney") { changePropById('friendID','value','47541037'); }}I hope I explained what I am trying to do well enough, if not just ask.THANKS! Link to comment Share on other sites More sharing options...
Little Goat Posted April 10, 2006 Share Posted April 10, 2006 why don't you just put the select inside the second form, and use the dropdown's value?LG Link to comment Share on other sites More sharing options...
TigaFan09 Posted April 11, 2006 Author Share Posted April 11, 2006 hahaha sometimes i overlook the easy method... thanks! worked like a charm of course Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now