guido2004
Nice replly. This is the javascript ul onclick that I have
External.js
Code:
function getjewelry(i){
if(' '==='i'){
document.getElementById('f1').innerHTML=' ';
}
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","getproduct.php?q="+i,true);
xmlhttp.send();
}
var jewelry= document.getElementById('jewelry').childNodes;
for (i = 0; i < jewelry.length; i++) {
if (jewelry[i].className == 'item') { // excludes class="item disabled"
jewelry[i].onclick = function() {
alert(this.id+': Is sending your request.'); // this actually gets the right id
var i=this.id;
alert(i); //alerts correct id
getjewelry('i');
document.title==i+' jewelry';//not sure that worked no alert
alert(document.title);
document.getElementById('f1').className=i;//just checking the i is silver
alert(document.getElementsByTagName('div')[6].className);//div class=silver
}
}
}
getproduct.php
Code:
$q=$_GET["q"]; // Undefined index:'q' at line 2
$link=mysql_connect("localhost","root","root")or die(mysql_error( ));
mysql_select_db("bwi",$link) or die(mysql_error( ));
$query=mysql_query("SELECT * FROM '.q.'")or die(mysql_error( ));
//the bold draws error syntax check sql version syntax etc.


Bookmarks