Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-22-2007, 03:48 PM   PM User | #1
eric float
New Coder

 
Join Date: Dec 2007
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
eric float is an unknown quantity at this point
problem with opera browser

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=\"javascriptage_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 ??
eric float is offline   Reply With Quote
Old 12-22-2007, 04:19 PM   PM User | #2
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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/
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||

Last edited by _Aerospace_Eng_; 12-22-2007 at 04:22 PM..
_Aerospace_Eng_ is offline   Reply With Quote
Old 12-22-2007, 04:29 PM   PM User | #3
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
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
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Old 12-25-2007, 12:25 PM   PM User | #4
eric float
New Coder

 
Join Date: Dec 2007
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
eric float is an unknown quantity at this point
hi . 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
eric float is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:39 AM.


Advertisement
Log in to turn off these ads.