on 04-21-2011 11:15 AM
Within my BSP code I have an OnClientClick event against the Radio button tag.
What I need to do is to have some kind of Javascript that changes the context (text) or colour of a button if the Radio button is clicked.
I know very little of how to achieve this and would relish any guidance about how I can get this to work.
I understand that I need to use a reference/handle to the button and change it's values via javascript, but how can I embed this code into my BSP code, what code do I use, and more importantly how can I obtain this reference/handle on the buttion?.
Jon
check
htmlb_samples/radiobuttongroupSample.htm
also familiarize yourself with javascript .
i used
http://www.w3schools.com/js/default.asp
Edited by: Durairaj Athavan Raja on Apr 23, 2011 8:43 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jon,
below an Example to do this
(due to security forum restriction replace scrip t with script and o nclick with onclick)
<html>
<head>
<scrip t>
function change_button_text(v_object){
var button = document.getElementById("id_button");
var new_text = v_object.value + ' Clicked!';
if (button.childNodes[0])
{
button.childNodes[0].nodeValue=new_text;
}
else if (button.value)
{
button.value=new_text;
}
}
</scrip t>
</head>
<body>
<form>
<input type="radio" name="sex" value="male" o nclick="change_button_text(this)"/> Male<br />
<input type="radio" name="sex" value="female" o nclick="change_button_text(this)"/> Female
</form>
<button id="id_button">Button Text</button>
</body>
</html>
Edited by: alessandro spadoni on Apr 28, 2011 9:56 AM
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.