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 427,095 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 2,311 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

javascript radio buttons and insanity

Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation: Comatose is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 108
Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Moderator

Re: javascript radio buttons and insanity

  #5  
Mar 20th, 2006
Yeah, I said cookies....

But beyond, the code that you have in both what you posted, and the site in the link..... when you click the radio button, it executes an onclick event.... right? That function is called "check", and it gets called when you click an option button. The check box's don't call any kind of function at all, but the option buttons do. Why the checkbox's retain their value, and the option buttons do not, is beyond me.... but I'll bet if you call the check function within the refresh_window function, it should work just fine.... Look carefully at this line:
<input type="radio" name="chartType" id="chartType" value="column" 	onclick="check(this.value)"  > column
onclick, it calls check(this.value), when you hit refresh, the first time, it works if you change the option button, because you clicked the option button, and it called this function... when you click it the second time, it never calls "check".... ever. Not once... it needs to. So, somewhere in the refresh_window function, you need to have it call the check function.

function refresh_window()
	{	
	var type = document.getElementById("chartType").value
        check(type);
	window.location=("radio2.php?type=" + type)
	}

Or something along those lines...
Reply With Quote  
All times are GMT -4. The time now is 5:24 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC