Results 1 to 1 of 1

Thread: Problem with variable transfer...

  1. #1
    Join Date
    Mar 2009
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Problem with variable transfer...

    I am trying to make an image (the edit img) appear when the user logs in. It has a function for the onmousedown event that should transfer the variable from ajax xmlresponse to the img attribute pID.

    Code:
    function editBlog(EntryID, SecurityCode) {
    	alert(EntryID);
    }
    
    function makeEditable(userID) {
    	if(sendReq2.readyState == 4 || sendReq2.readyState == 0) {
    		sendReq2.open("POST",'includes/getPosts.php?userID='+userID+'&secCode='+secCode, true);
    		sendReq2.onreadystatechange = function() {
    			if(sendReq2.readyState == 4) {
    				var xmlDoc = sendReq2.responseXML.documentElement;
    				var i = 0;
    				var items = xmlDoc.getElementsByTagName("entry");
    				var o = [];
    				var iEdit = [];
    				var iRemove = [];
    				while(i<items.length) {
    					iEdit[i] = document.createElement("img");
    					iEdit[i].pID = items[i].attributes[0].textContent;
    					iEdit[i].src = "images/EditBtn.jpg";
    					iEdit[i].alt = "Edit";
    					iEdit[i].onmousedown = function() {
    						editBlog(this.pID, secCode);
    					}
    					iRemove[i] = document.createElement("img");
    					iRemove[i].src = "images/RemoveBtn.jpg";
    					iRemove[i].alt = "Remove";
    					var posID = items[i].firstChild.textContent;
    					o[i] = document.getElementById('BlogO'+posID);
    					clearObj(o[i]);
    					o[i].appendChild(iEdit[i]);
    					o[i].appendChild(document.createTextNode(" "));
    					o[i].appendChild(iRemove[i]);
    					i++;
    				}
    			}
    		}
    		sendReq2.send(null);
    	}
    }
    It just outcomes undefined... The url to the site is: The Site.

    I reloaded the page and got it to work. Thanks for looking anyways.
    Last edited by BillyBoB6969; 03-14-2009 at 06:46 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •