PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Sun Dec 21, 2014 10:29 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: how to get Div values
PostPosted: Tue Jul 17, 2012 1:45 am 
Offline
Forum Newbie

Joined: Tue Jul 17, 2012 1:35 am
Posts: 14
Hello Friends
plz help me
there is a div
which contain a list of values I want get These values in a variable
bcz in that div I m using function which take perameter


function item_list(str){
var xmlhttp;
var str2=document.getElementById('search_suggest').value;

var str=document.getElementById('search_suggest').innerHTML=str2;

alert(str);
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("itemList").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","itemList.php?q="+str,true);
xmlhttp.send();

}

<div id="search_suggest" onmousedown="item_list(this))">
</div>
plz plz help


Top
 Profile  
 
PostPosted: Tue Jul 17, 2012 5:58 am 
Offline
DevNet Master
User avatar

Joined: Sun Feb 15, 2009 12:08 pm
Posts: 2775
Location: .za
The script below will find the text inside the first div element within a html document and then alert it; not what you require but should help you get started on a solution.
Syntax: [ Download ] [ Hide ]
var theDiv = document.getElementsByTagName("div")[0];
var info = theDiv.textContent;
       
alert(info);
 

_________________
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: Bing [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group