PDA

View Full Version : ddtreemenu Internet Explorer 8 (IE8) Issue



Logberg
04-24-2013, 08:38 PM
1) Script Title: ddtreemenu

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex1/navigate1.htm

3) Describe problem: IE 8 is reporting "Error: 'ddtreemenu' is undefined"

It works fine in Chrome, but I can't figure out how to fix it. I can't post the link because its inside my firewall, but here is the code:

<head>
<style>
#tree {/* body Div */
margin-left: 0px;
height: 250px;
}

.treeview ul{ /*CSS for Simple Tree Menu*/
margin-left: 0px;
margin: 0px;
padding-left: 10px;
text-indent: 0px;
font-family:"Arial";
}


.treeview li{ /*Style for LI elements in general (excludes an LI that contains sub lists)*/
background: white url(list.gif) no-repeat left center;
list-style-type: none;
padding-left: 0px;
text-indent= 2px;
margin-left: 0px;
margin-bottom: 3px;
color: #000000;
font-weight: normal;
font-size: small;
font-family:"Arial";
}

.treeview li.submenu{ /* Style for LI that contains sub lists (other ULs). */
background: white url(closed.gif) no-repeat left 1px;
cursor: hand !important;
cursor: pointer !important;
color: #00b5e6;
font-weight: bold;
text-indent: 0px;
font-family:"Arial";
}

.treeview li.submenu ul{ /*Style for ULs that are children of LIs (submenu) */

display: none; /*Hide them by default. Don't delete. */

color: #000000;
font-weight: bold;
font-family:"Arial";
}

.treeview .submenu ul li{ /*Style for LIs of ULs that are children of LIs (submenu) */

cursor: default;
}

a:link {
color: #00b5e6;
font-family:"Arial";
}

a:visited {color: #00b5e6;}

table, tr, td{
vertical-align: top;
text-align: left;
height: 600px;
overflow: auto;
}

</style>


<script type="text/javascript" src="https://sites.google.com/site/mylanjive/files/simpletreemenu.js">

/***********************************************
* Simple Tree Menu- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

</head>

<body>

<table>
<tr>
<td>


<a font-size: small; font-family:"Arial"; text_indent: 5px; align: middle; color: #00b5e6 href="javascript:ddtreemenu.flatten('locations', 'expand')">Expand All</a> | <a href="javascript:ddtreemenu.flatten('locations', 'contact')">Collapse All</a>


<ul style="margin-left: -10px; padding=0px; list-style-position:inside;" id="locations" class="treeview">

<li>North America
<ul>
<li>Canada</li>
<li>United States
<ul>
<li>Cannonsburg, PA
<ul>
<li><a href="https://jive.mylan.com/groups/fountainhead">Fountainhead</a></li>
<li><a href="https://jive.mylan.com/message/4023#4023">Global Center</a></li>
<li><a href="https://jive.mylan.com/groups/southpoint">Southpointe</a></li>
</ul></li>
<li>Greensboro, NC</li>
<li>Morgantown, WV
<ul>
<li><a href="https://jive.mylan.com/groups/mylan-morgantown">Chestnut Ridge (MPI)</a></li>
<li>Collins Ferry</li>
<li><a href="https://jive.mylan.com/groups/greenbag-road-morgantown-wv-us">Greenbag Road</a></li>
</ul></li>
<li>Napa Valley, CA (Dey)</li>
<li>New Jersey (Dey)</li>
<li>New York</li>
<li>Puero Rico</li>
<li>Rockford, IL (UDL)</li>
<li>St. Albans, VT (MTI)</li>
<li>Texas
<ul>
<li>Allen, TX (Dey)</li>
<li>Sugarland, TX (UDL)</li>
</ul></li>
<li>Washington, D.C.</li>
</ul></li>
</ul></li>
<li>EMEA
<ul>
<li>Austria</li>
<li>Belgium
<ul>
<li>Docpharma Belgium</li>
<li>Mylan Belgium</li>
</ul></li>
<li>Czech Republic</li>
<li>France</li>
<li>Germany
<ul>
<li>Darmstadt</li>
<li>Stuttgart</li>
</ul></li>
<li>Greece</li>
<li>Hungary
<ul>
<li>Budapest</li>
<li>Komarom</li>
</ul></li>
<li>Ireland
<ul>
<li>Dublin
<ul>
<li>Gerard</li>
<li>Respiratory</li>
</ul></li>
<li>Galway (Insitutional)
<ul>
<li>Casla</li>
<li>Inverin</li>
</ul></li>
<li>Northern Cross</li>
</ul></li>
<li>Italy</li>
<li>Luxembourg</li>
<li>Netherlands</li>
<li>Poland</li>
<li>Portugal</li>
<li>Russia</li>
<li>Slovakia</li>
<li>Slovenia</li>
<li>South Africa</li>
<li>Spain</li>
<li>Sweden</li>
<li>Switzerland
<ul>
<li>Geneva (Insitutional)</li>
<li>Rolle</li>
<li>Zurich</li>
</ul></li>
<li>United Kingdom (UK)
<ul>
<li>Cambridge</li>
<li>Potters Bar</li>
<li>Sandwich</li>
</ul></li>
</ul></li>
<li>APAC
<ul>
<li>Australia
<ul>
<li>Corporate Office</li>
<li>Melbourne</li>
<li>Queensland
<ul>
<li>Manufacturing</li>
<li>Distribution</li>
</ul></li>
</ul></li>
<li>China</li>
<li>India
<ul>
<li>Matrix Labs</li>
<li>Development Centre</li>
</ul></li>
<li>Japan</li>
<li>New Zealand</li>
<li>Taiwan</li>
</ul></li>
</ul>



<script type="text/javascript">

//ddtreemenu.createTree(treeid, enablepersist, opt_persist_in_days (default is 1))

javascript:ddtreemenu.createTree("locations", false)
javascript:ddtreemenu.flatten('locations', 'contact')

</script>


</td></tr></table>

</body>



-----------------------------------------------------
This seems to be a common problem with IE8 and javascript, but I haven't found a solution yet!

Any help is appreciated!

jscheuer1
04-25-2013, 12:52 AM
Host the simpletreemenu.js script on your own domain, or if you must host it on another domain, use something other than https://sites.google.com/site/ . . . or similar which serve it as a file for download, not as a file for use on the page.

Logberg
04-25-2013, 02:39 PM
Host the simpletreemenu.js script on your own domain, or if you must host it on another domain, use something other than https://sites.google.com/site/ . . . or similar which serve it as a file for download, not as a file for use on the page.

Hi John. When you say google only host the file for download, is this an IE specific issue? The script works fine in Chrome and FF.

I can explain more about our issue:

--We have a company social networking site hosted externally
--We need to run the html that uses the script inside of a sort of widget on a page
--They can not host js files for us
--We can not host the file because it would only be available inside the network
--google just seemed like a good, free solution, and its works perfectly fine with the other browsers

jscheuer1
04-25-2013, 03:00 PM
If I try to navigate directly to the script in Chrome, it downloads automatically. The usual behavior is for it to appear in the browser window. So it is being served differently than a normal script. I have seen this before with scripts hosted on Google in this manner. In Opera, it asks if I want to open or save it (I have Opera set as my default application for javascript). In Firefox it asks to save or cancel. Firefox says it's jScript, rather than text/javascript. And there could also be something else about how it's served that differs from how a javascript script on the web is usually served. And yes, IE is the most finicky about that.

If you have 'normal' public web pages anywhere that you can host the script on, host it there.

The only other thing I can think of is to contact Google (or check their forum that applies to this type of script hosting if they have one) about the problem and ask them/check for a solution. The external script tag might be able to have an attribute added to it that could take care of the problem. But that's a might, not a certainty. They may have other advice.

Logberg
04-25-2013, 03:39 PM
If I try to navigate directly to the script in Chrome, it downloads automatically. The usual behavior is for it to appear in the browser window. So it is being served differently than a normal script. I have seen this before with scripts hosted on Google in this manner. In Opera, it asks if I want to open or save it (I have Opera set as my default application for javascript). In Firefox it asks to save or cancel. Firefox says it's jScript, rather than text/javascript. And there could also be something else about how it's served that differs from how a javascript script on the web is usually served. And yes, IE is the most finicky about that.

If you have 'normal' public web pages anywhere that you can host the script on, host it there.

The only other thing I can think of is to contact Google (or check their forum that applies to this type of script hosting if they have one) about the problem and ask them/check for a solution. The external script tag might be able to have an attribute added to it that could take care of the problem. But that's a might, not a certainty. They may have other advice.

Thanks John. You were right, I used Drop-Box instead and it's working now.

Thanks again for the help!