PDA

View Full Version : Some JavaScript with CSS push, please


Joel
15th June 2004, 22:36
I having problems with this escenario....

1.- What is WTF?
<radiobutton1>A) Don't know.
<radiobutton2>B) Not yet.

of course, radiobuttonx is the real radio button by <form>.

now, I need to change the text color of the "A)" if the user selects "B)", otherwise "A)" will be changed.... :igor:

Any ideas? :)

Thanks

griffinn
16th June 2004, 01:06
Did this sort of stuff with an online survey a few weeks ago, so I'll just customise it a bit:<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Survey</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="description" content="Survey" />
<style type="text/css"><!--
--></style>
<script language="JavaScript" type="text/javascript"><!--
function toggle(me,target) {
if (document.getElementById) {
document.getElementById(me).style.color="red";
document.getElementById(target).style.color="green";
}
}
// --></script>
</head>
<body>
<h1>Who is a terrorist?</h1>
<form id="frm" name="frm" action="" method="get"
onsubmit="return false;">
<input type="radio" name="rdo"
onclick="toggle('rdo1','rdo2');" /><span id="rdo1">Bin Laden</span>
<input type="radio" name="rdo"
onclick="toggle('rdo2','rdo1');" /><span id="rdo2">Bush</span>
</form>
</body>
</html>

Joel
16th June 2004, 14:00
Thanks griffinn :D

That did the trick ;)

eleet-2k2
16th June 2004, 20:18
And to answer you're first question, I'll refer you to bash.org

#6460
<studdud> what the fuck is wtf;)