Jump to content

Need help with javascript...


Guest boy

Recommended Posts

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

<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="java script:xmlhttpPost('ajax.asp');return escape('<div id=result></div>'); return value('---- from here -----')">Text1</a><a href="#" onmouseover="java script:xmlhttpPost('ajax.asp');return escape('<div id=result></div>'); return value('---- from here -----')">Text2</a><a href="#" onmouseover="java script:xmlhttpPost('ajax.asp');return escape('<div id=result></div>'); return value('---- from here -----')">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. If you need more info please post.Any help is much appreciated.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...