...

View Full Version : problem with opera browser



eric float
12-22-2007, 04:48 PM
hi - i have any code for dtree menu . this script work with mozila - IE 7 but not work with opera browser .
THIS CODE :
<script>
var gEBI = (document.getElementById) ? true : false;
var da = (document.all) ? true : false;
var lay = (document.layers) ? true : false;

function Menu(ID)
{
var ktgID = "ktg_" + ID;
var imgID = "img_" + ID;

if (gEBI)
{
ktgID = document.getElementById(ktgID);
imgID = document.getElementById(imgID);
//alert("gEBI");
}
else
{
if (da)
{
ktgID = document.all(ktgID);
imgID = document.all(imgID);
//alert("da");
}
else
{
if (lay)
{
//alert("lay");
//KtgID = document.layers(ktgID);
//imgID = document.layers(imgID);
}
else
{
alert("Sorry, your browser does not support this page!");
}
}
}
if (gEBI || da)
{
if (ktgID.style.display == "none")
{
ktgID.style.display = "block";
imgID.src = "images/minus.gif";
}
else
{
ktgID.style.display = "none";
imgID.src = "images/plus.gif";
}
}
else
{
if (document.layers["ktg_"+ID].visibility == "hide")
{
document.layers["ktg_"+ID].visibility = "show";
// imgID.src = "images/minus.gif";
}
else
{
document.layers["ktg_"+ID].visibility = "hide";
// imgID.src = "images/plus.gif"
}
}

}

var agt=navigator.userAgent.toLowerCase();
var is_major = parseInt(navigator.appVersion);
var is_nav = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
var is_nav6up = (is_nav && (is_major >= 5));
var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie4up = (is_ie && (is_major >= 4));
if (!(is_nav6up || is_ie4up))
{
document.location.href = "categories.php";
}
</script>
SO FOR SHOW
echo "<IMG ID='img_$i' SRC='images/plus.gif' border='0' onClick='javascript: Menu($i);'>";

echo "<a href='#' class='Menu' onClick='javascript: Menu($i);'><B>$row[0]</B></a><br>";

echo "<span id='ktg_$i' style='display:none;'>";

$result2 = mysql_query("select DISTINCT maingroup, secondgroup from products WHERE maingroup = '$row[0]' ORDER BY secondgroup");

while($row = mysql_fetch_row($result2)) {

echo "&nbsp;&nbsp;&nbsp;<IMG SRC=\"images/dots.gif\" border=\"0\" WIDTH=\"7\" HEIGHT=\"9\">&nbsp;<a class=\"menu\" href=\"#\" onclick=\"javascript:page_loader('item_list.php?maingroup=$row[0]&secondgroup=$row[1]&sort=item')\">$row[1]</a><br>";

$i=$i+1;

}

echo "</span>";

}

This Script a Dtree Menu For Group list . . . But Not work In Opera . Dont Show Image !! And Dont Work Expand . . What's Problem ??

_Aerospace_Eng_
12-22-2007, 05:19 PM
Where did you get the script from? That script you have looks outdated. There are a few menus here that might interest you that work in
Opera.

http://destroydrop.com/javascripts/tree/

A1ien51
12-22-2007, 05:29 PM
I agree with _Aerospace_Eng_,

Any script that uses document.all or document.layers is usually a sign to look for something else. Only browser that really supports document.layers is 9? years old.

Eric

eric float
12-25-2007, 01:25 PM
hi .

http://destroydrop.com/javascripts/tree/ this nice script . this script for static page . how to change this script for dynamic page and link ?? Example : for add a category in admin panel = generate auto link in dtree menu . thx



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum