Need some help with JavaScript...
Hi all, I recently heard about the AJAX web technology. I always wondered how gmail is able to give desktop like environment on a web page and now I've learned a good part - how it works. I decided to implement very basic AJAX on my webpage. I am not very good at JavaScript and I need your help. I googled a lot but in vein. So here is the code
Code:
<html><head><title>Ajax Example</title>
<script language="Javascript">
function xmlhttpPost(strURL) {
var xmlHttpReq = false;
var self = this;
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
updatepage(self.xmlHttpReq.responseText);
}
}
self.xmlHttpReq.send(getquerystring());
}
function getquerystring() {
var word = value(here);
qstr = 'w=' + escape(word);
return qstr;
}
function updatepage(str){
document.getElementById("result").innerHTML = str;
}
</script>
</head><body>
<a href="#" onmouseover="JavaScript:xmlhttpPost('ajax.asp');return escape('<div id=result></div>'); return value('1')">Text1</a>
<a href="#" onmouseover="JavaScript:xmlhttpPost('ajax.asp');return escape('<div id=result></div>'); return value('2')">Text2</a>
<a href="#" onmouseover="JavaScript:xmlhttpPost('ajax.asp');return escape('<div id=result></div>'); return value('3')">Text3</a>
<script language="javascript" src="wz_tooltip.js">
</body></html>
What I want is when ever onmouseover is called on Text1,Text2,Text3 it returns some value to a variable 'word' in this case repectively. I hope you understand my problem and val is reading this thread ;). If you need more info please post.
Any help is much appreciated.
- :S: