Forum Moderators: open
i have various forms that pass a value to a function that in return queries a db ie:
<input type="button" value="Blah" onclick='getXYZ("stuff.php?name=blah")'; action="get" class=button>
what i'd like to do is build a search form button that passes the result and adds it to the end of name=
anyone?
thanks :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset:utf-8">
<title></title>
<script type="text/javascript">
// Create a global namespace object to avoid conflicts with other scripts
var WW = window.WW ¦¦ {};
WW.ButtonAppender = function () {
return {
/**
* @param {String} el The id of the button
*/
init : function (el) {
var btn = document.getElementById(el);
if (!btn) { return; }
// Attach an onclick event listener
btn.onclick = function () {
// Display the current value
alert(WW.ButtonAppender.paramlist);
// Then update it to be appended with the new data
WW.ButtonAppender.paramlist += ":" + (new Date()).getSeconds();
};
},
/**
* The String to append
*/
paramlist : 'item1'
};
}(); // Create the Singleton instance of ButtonAppender
window.onload = function () {
WW.ButtonAppender.init('foo');
};
</script>
</head>
<body>
<input type="button" value="Blah" id="foo">
</body>
</html>