Public feed #889238

Unnamed

public text v1 · immutable
Raw Edit
·published 2008-02-02 19:56 UTC
rendered paste body
test.html:
---------------------------
<!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">
	<head>
		<base href="http://localhost/bank/" />
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<title>Test</title>		
		<script type="text/javascript" src="script/lib/prototype.js"></script>
		<script type="text/javascript" src="script/src/scriptaculous.js"></script>
		<script type="text/javascript" src="script/expenses.js.php"></script>
		<link href="css/expenses.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
			window.onload=add_place_input;
		</script>
	</head>
	<body>
	<form method="post">
		<span id="places"></span>
		<span id="loading" style="display: none"><img src="images/spinner.gif" alt="Working..." /></span>
	</form>
	</body>
</html>




expenses.js.php:
-------------------
var place_input_count=1;
var add_place_input=function(){
	var new_input=document.createElement("input");
	new_input.setAttribute("id", "place_input"+place_input_count);
	new_input.setAttribute("type", "text");
	new_input.setAttribute("size", "7");
	new_input.setAttribute("name", "q");
	new_input.onkeydown=function(){if (!this.already_added) add_place_input(); this.already_added=1;}
	$('places').appendChild(new_input);
	
	
	var autocomplete_choices=document.createElement("div");
	autocomplete_choices.setAttribute("class", "autocomplete");
	autocomplete_choices.setAttribute("id", "autocomplete_choices"+place_input_count);
	$('places').appendChild(autocomplete_choices);
	
	
	
	new Ajax.Autocompleter(
		"place_input"+place_input_count,
		"autocomplete_choices"+place_input_count,
		"<some path>",
		{
			/*paramName: "q",
			minChars: 1,
			indicator: 'loading'*/
		}
	);
	place_input_count++;
}