User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,995 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,233 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 7523 | Replies: 9
Join Date: Mar 2006
Posts: 5
Reputation: davidpitts is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
davidpitts davidpitts is offline Offline
Newbie Poster

Help javascript radio buttons and insanity

  #1  
Mar 20th, 2006
I am (as you will quickly discover) a novice javascript coder. Here is my issue. I am using a radio button, and it works fine. Then when I change some other element on the page, or hit refresh, the radio button does not remain set. You can see it in action here:

http://claytargetsonline.com/radio2.php?type=line

I have tried check to see which one is checked and every other solution I can think of. I have asked experienced programmers, and didn't want to waste more than 10 minutes of their time, but it was not obvious to them either.

I have spent about 5 hours searching the web. No avail. Help!

I did search this forum also but did not find a similar problem.

Any help woule be appreciated.

David

<script type="text/javascript">

function check(charttype)
	{
		document.getElementById("chartType").value=charttype
	}

function refresh_window()
	{	
	
	var type = document.getElementById("chartType").value
	window.location=("radio2.php?type=" + type)
	
	}
	
	
</script>


<form id="form1" action="(EmptyReference!)" method="put" name="form1">

<table width="415" border="0" cellspacing="2" cellpadding="0">
	<tr>
			<td width="297"><strong>Chart Type:</strong></td>
			<td valign="bottom" width="112">&nbsp;</td>
	</tr>
	<tr>
			<td width="297">
			<input type="radio" name="chartType" id="chartType" value="line" 	onclick="check(this.value)" <?php if ($type == "line") echo "CHECKED" ?> > line &nbsp;
			<input type="radio" name="chartType" id="chartType" value="column" 	onclick="check(this.value)" <?php if ($type == "column") echo "CHECKED"?> > column  <input type="radio" name="chartType" id="chartType" value="3dcolumn" onclick="check(this.value)" <?php if ($type == "3dcolumn") echo "CHECKED"?> > 3d column
			</td>
			<td align="right" rowspan="2" valign="bottom" width="112">
			<button name="refresh" type="button" onclick="refresh_window()">Refresh Chart </button>
		</td>
	</tr>
	<tr>
			<td width="297"></td>
		</tr>
</table>

</form>
<p>The problems is this. </p>
<p>Set the chart type to column and hit refresh. Everything works.</p>
<p>Now hit refresh again. Chart type changes to line.</p>
<p>I hope someone can help me with this. I am losing my mind.</p>
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 9:58 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC