Js function not working on pages with DWT?

M

Marindi

I have a page showing a list of reports in a tree structure, and the
structure expands with a javascript function as you click on certain
expandable headings. I've created a normal htm page with the javascript
functions in the <head> tag and it works fine.

Now I have a new site where all my pages are based on a DWT - so the <head>
of each page is actually in the template's <head>. I've put the javascript
functions in the template's <head> (note for each expandable click you need a
seperate js function with its own unique name, otherwise it doesn't work).
When I test the page, and click on one of the headings, it does expand/open
the menu below but it also opens a seperate page with the standard error
"Internet Explorer cannot display the webpage" and in the address line says:
"javascript:;".

Any ideas what I'm doing wrong??
I've tried putting all the js functions in a seperate .js file with the
following in my DWT's <head> : <script language="javascript"
src="../Inserts/MIexpands.js"></script> but it gives the same errors.
I've copied the code straight from the file that does work fine (only moved
the js part to the dwt's head), so can't understand the problem??

Here is the function in js:
function Drop1()
{ if
(this.document.all.Drop1.style.display=="none")
(this.document.all.Drop1.style.display="block") ;
else (this.document.all.Drop1.style.display="none") ;
}

Here is the code in the body where the click should expand the menu:
<tr><td class="MIname">
<p style="margin-bottom: 4px"><a href="javascript:;" class="MIexpand"
onclick="Drop1()" target="main">+ General</a></p>
<div id="Drop1" style="display=none">
<p style="margin-bottom: 3px; margin-left:25px"><a target="_blank"
class="banneranchor" href="file://digit/">Voice of Customer</a></p>
</div></tr>
 
M

Marindi

After days of battling with this, I've just spotted a stupid mistake which
seems to have made the difference... the href should go to target="_top" and
not target="main" - the previous page that was working was in a frames-based
layout..... anyway, stupid me, it seems to be working now so no need to
assist :) Thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top