|
Hey all,
I am very new to javascript and have a really quick, simple script I need help writing.
I want to have a link on my page that when clicked, it will choose one of two radio buttons, and fill in a text field.
So, here is what I want:
[CODE]
<input name="page_width" type="text"><br>
<input name="page_width_type" type="radio" value="percent">
<input name="page_width_type" type="radio" value="pixels"><br><br>
<a href="#" onClick="WHAT GOES HERE">full screen</a>
[/CODE]
I want to add a link right below it that sets the textbox (page_width) to '100' and selects the first radio button (percent).
Thanks,
-influxer
|
|
|
Hi
Check this code. It may give you an idea
john
http://www.programminghelp4u.com/ ( Assignment / Project ) Help
<!--
<script language="javascript">
function setWidth(){
var widthText ="";
var widthValue=document.form1.page_width.value;
if(document.form1.page_width_type[0].checked){
widthText =widthValue+"%";
}else{
widthText =widthValue;
}
table1.style.width=widthText;
}
</script>
<body>
<form name="form1">
<table width="50%" id="table1" border="1">
<tr>
<td>
<input name="page_width" type="text" value="30"><br>
</td>
</tr>
<tr>
<td>
<input name="page_width_type" type="radio" value="percent" checked>Percent
<input name="page_width_type" type="radio" value="pixels">Pixels<br><br>
<a href="javascript:setWidth()">set width</a>
</td>
</tr>
</table>
</form>
</body>
</html>
-->
|
|
|
|
|
|
|
|