Location: PHPKode > projects > Decider > decider/Questionaire/questionaire.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head><link rel="stylesheet" type="text/css" href="../common/styles.css" />
<script language="javascript">
//Ajax stuff here 

var toGetHint;

function getXmlHttpRequestObject() {
	if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	} else if(window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		alert("Your Browser Sucks!\nIt's about time to upgrade don't you think?");
	}
}

var select_clientkp_req = getXmlHttpRequestObject();

function select_client_kp(txt) {
		
if (select_clientkp_req.readyState == 4 ||select_clientkp_req.readyState == 0) {
		var str = escape(txt);
						
		select_clientkp_req.open("GET",'selectkp.php?client=' + str, true);
		select_clientkp_req.onreadystatechange = handleselect_clientkp; 
		select_clientkp_req.send(null);		
	}		
}

function stateChanged() { 

	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("questions").innerHTML=xmlHttp.responseText; 
	} 
} 

function handleselect_clientkp() {

	if (select_clientkp_req.readyState == 4) {
		str=select_clientkp_req.responseText;
		//alert(str);
		document.getElementById("kpName").innerHTML=str;	 
	}
}

//end of key person name
var select_clientdesig_req = getXmlHttpRequestObject();
function select_designation(txt){
	if (select_clientdesig_req.readyState == 4 ||select_clientdesig_req.readyState == 0) {
		var str1 = escape(txt);
		
		toGetHint = escape(txt);
		//alert(txt);
		select_clientdesig_req.open("GET",'selectkpdesi.php?kp=' + str1, true);
		select_clientdesig_req.onreadystatechange = handleselect_kpdesig; 
		select_clientdesig_req.send(null);
		
	}		
}

function handleselect_kpdesig() {

	if (select_clientdesig_req.readyState == 4) {
			
		str=select_clientdesig_req.responseText;
		document.getElementById("designation").value=str; 	
	}
}

var selected_quiz_req = getXmlHttpRequestObject();
function select_quiz(txt){
	if (selected_quiz_req.readyState == 4 ||selected_quiz_req.readyState == 0) {
		var str1 = escape(txt);
		selected_quiz_req.open("GET",'gethint.php?quiz=' + str1 + '&keyperson=' + toGetHint, true);
		selected_quiz_req.onreadystatechange = handleselect_quiz; 
		selected_quiz_req.send(null);	
	}		
}

function handleselect_quiz() {

	if (selected_quiz_req.readyState == 4) {
		
		str=selected_quiz_req.responseText; 
		document.getElementById("questions").innerHTML=str;
			 
	}
}

//----------------------------My code--------------------------------
//var my_req = getXmlHttpRequestObject();
function my_quiz(txt){
	//if (my_req.readyState == 4 || my_req.readyState == 0) {
		var str1 = escape(txt);
		alert(txt);
		//toGetHint=str1;
		//my_req.open("GET",'gethint.php?keyperson=' + str1, true);
		//my_req.onreadystatechange = handle_my_quiz; 
		//my_req.send(null);	
	//}		
}

/*function handle_my_quiz() {

	if (my_req.readyState == 4) {
		
		str=my_req.responseText;
		alert(str); 
	}
}*/
//-------------------------------------------------------------------------

</script>
<!-- help code-->
<script language="javascript">
var id;
var txtname;
function handleSearchSuggest(txt) {
var str;

			id=txt;
			txtname=txt;		
			var ss = document.getElementById("help");
			ss.innerHTML = '';
			if(id=="Questionnairehelp"){
		    str = "This is the section where you can use to interview the key persons. You can ask selected questions from the key person get their feed back.";
			}
			
			var suggest = '<div onmouseover="javascript:helpOver(this);" ';
			suggest += 'onmouseout="javascript:helpOut(this);" ';
			suggest += 'onclick="javascript:closeBox(this.innerHTML);" ';
			suggest += 'class="suggest_link">'+ str + '</div>';
			ss.innerHTML += suggest;
			}

//Mouse over function
function helpOver(div_value) {
	div_value.className = 'help_over';
}
//Mouse out function
function helpOut(div_value) {
	div_value.className = 'help_out';
}
//Click function
function closeBox(value) {
	document.getElementById("help").innerHTML = '';
}

</script>
</head>

<body>

<div class="topic">Questionnaire View </div>
<form action="questionairetab.php" method="post" id="forum">
<table>

<tr><td align="center" height="40" width="10"></td> </tr>

<tr><td class="label">Organization Name</td><td>

<select id="client"  name="client" id="client" class="select" onChange="javascript:select_client_kp(this.value);">

	<option>-select-</option>
		<?php
		require("../common/database.php");
		 $result = mysql_query( "SELECT Name FROM client");
			 while($row=mysql_fetch_array($result)){
		?>
				<option value="<?php echo $row['Name']?>"><?php echo $row['Name']?></option>
				
			<?php
			 } 
			?>
	</select>

</td>
<td class="label">Turn:</td><td> <select  id="turn" name="turn" class="select" onChange="javascript:select_quiz(this.value);" >
			<option value="-select-">-select-</option>
			<?php
			for($i=1;$i<100;$i++){
			?>
			<option value="<?php echo $i;?>"><?php echo $i;?></option>
			<?php
			}
			?>
			

</select></td></tr>

<tr><td class="label">Person Name:</td><td>
<select id="kpName" name="kpName" class="select" onChange="javascript:select_designation(this.value);" >
<option>-select-</option>
</select>
</td></tr><tr></tr><td class="label">Designation:</td><td>
<input type="text" id="designation" name="designation" class="textbox1" disabled >
<input type="hidden" id="no_of_quiz" name="no_of_quiz" value="" >
</td><td><img src="../common/HelpIcon.gif" height="30" width="30" type="" name="Submit"  id="Questionnairehelp" onClick="handleSearchSuggest(this.id)" class="pointer"><div id="help" class="length" > </div></td></tr>

<tr><td></td></tr>
</table>
<br />
<div class="topic">Questionnaires </div>
<table class="label">
<tr><td><span id="questions"></span></td></tr>
<tr><td></td>
<tr></tr>
</table>
<table>



<tr><td><td>
<!-- <input type="submit" value="     Add   " class="button" name="add" id="add"> -->
</tr></td></tr>
</table>

</form>

</body>
</html>
Return current item: Decider