Forum Moderators: open
<script type="text/javascript">
window.addEvent('domready', function(){
var box = $('box');
var fx = box.effects({duration: 1000, transition: Fx.Transitions.Quart.easeOut});
$('save_button').addEvent('click', function() {
box.style.display="block";
box.setHTML('Save in progress...');
/* AJAX Request here... */
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open("GET", "secure/saveTitle.php?title="
+document.getElementById('title').value, true);
httpObject.send(null);
}
function getHTTPObject(){
if (window.ActiveXObject)
return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest)
return new XMLHttpRequest();
else {
alert("Your browser does not support AJAX.");
return null;
}
}
fx.start({
}).chain(function() {
box.setHTML('Saved!');
this.start.delay(1000, this, {'opacity' : 0});
}).chain(function() {
box.style.display="none";
this.start.delay(0100, this, {'opacity' : 1});
});
});
});
<form name="event_title" method="get">
<div align="center">
<table width="100%" border="0">
<tr>
<td><div align="center"><div id="box"></div></div></td>
</tr>
</table>
<input name="title" type="text" class="createSteps" size="45" maxlength="125" id="title" />
<input name="save_button" type="button" class="createSteps" id="save_button" value="save"/>
</div>
</form>