I know this is a javascript Ajax //addevent(link.id,'click',function(){
type question but I'd like an answer so hear it goes,I'd like to see a loop through ul li elements that grabs their string and adds the products.php?
page for all the ul li elements with LI.ID writing each case[] like this:;
Code:
function readlink(){
var links=document.getElementById('ulID').childNodes.length;
links=iObj;
for(var i=0;i<iObj.length;i++){
iObj[i].onclick=function(){sqljewelry(this);};
}
};
function sqljewelry(li.id){
case:sidebar.ul.id="silver"{
//set up ajax call for select db mydb, SELECT*FROM"+silver+" table;
//posable with javascript query ? match on strings in links aray but no loop, wow!:cool: NO CASE= BETTER
{
case:sidebar.ul.id="Gold""{
//set up ajax call for select db mydb, SELECT*FROM"+gold+" table;
{
window.onload=function(){readlink();}
:
Last edited by THEFOOL; 08-17-2011 at 04:09 PM.
Reason: GOT THIS I POSTED IN JAVASCRIPT
function readlink(){
var links=document.getElementById('ulID').childNodes.length;
links=iObj;
for(var i=0;i<iObj.length;i++){
iObj[i].onclick=function(){sqljewelry(this);};
}
};
function sqljewelry(li.id){
case:sidebar.ul.id="silver"{
//not quite set up ajax call for mysql_query="select db mydb SELECT*FROM"+li.id+"table;
if (ul.li.id="silver")//id like to match an array at this point
{
document.getElementById("display").innerHTML="";
return;
}
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("display").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","+li.id+".php?s="+ul.li.id,true);
xmlhttp.send();
}
case:sidebar.ul.id="Gold""{
//set up ajax call for select db mydb, SELECT*FROM"+li.id+" table;
if (ul.id="gold")
{
document.getElementById("display").innerHTML="";
return;
}
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("display").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","+li.id+".php?s="+ul.li.id,true);
xmlhttp.send();
}
}
window.onload=function(){readlink();}
Sorry about that I'm a total FOOL and seriously diminished in capacity to express myself. Any direction greatfuly appreciated.
OK. I MIGHT BE DREAMING, YOU CAN'T CHANGE THE SELECT FROM STATEMENT IN THE FILE.PHP WITH THIS SCRIPT, MAYBE YOU HAVE TO RUN THE CASES IN THE FILE.PHP? //NO PUN INTENDED ????????? TRIED THIS TO FIGURE IT OUT BUT JEEP GETTING SYNTAX ERROR
Code:
function getsilver(){
document.getElementById("f1").innerHTML="";
return;
}
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("f1").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","getSilver.php?",true);
xmlhttp.send();
}//keep getting error syntax error here??
function readjewelry(li){
var jewelry=document.getElementById('jewelry').childnodes.childnodes.id;
jewelry=iObj;
for(var i=0; i<jewelry.length;i++){
iObj[i].onclick=function(){writesql(this);};
}
};
function writesql(id){
if(id=='silver'){
getsilver();}
else(!id=='silver'){
alert('This link:'+id+' dose not have a get'+id+'.php file to return');
}}
window.onload=function(){
readjewelry();
}
already tried adding brackets to getsilver(){................end}}} and };
Bookmarks