Hi,

I have two html pages that are consisting of frames. They are using
shared jQuery code, and I used the anchor click events to load pages
into frames (as target attibutes fails to work when jQuery is
present).
I used the click event of two anchor classes two create the same
funcionality and while the event of the first class works correctly,
the second just fails during execution.

Here are the jQuery codes (custom.js) - other jQuery is of jTree code:
$(document).ready(function()
{
$("a.contentLink").click(
function()
{
    top.$("#content_frame").attr("src",$(this).attr("href")); //works
correctly in the first document
    alert("success"); //I get the message
    return false;
});

$("a.collectionLink").click(
function()
{
      top.$("#content_frame").attr("src",$(this).attr("href"));  //
fails in the second document
//top.$("#doc_toc_frame").attr("src",$(this).attr("name"));
     alert("success"); //never executed
    return false;
});
});//doc ready

The pages are these:
(first one works)

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd";>
<HTML>
<HEAD>
<TITLE>Doc</TITLE>
<meta http-equiv='Content-type' content='text/html' charset='utf-8' />
        <link rel='stylesheet' type='text/css' href='../../Style/CSS/
styles.css' />
        <link rel='stylesheet' type='text/css' href='../../Style/CSS/
jquery_style.css' />
        <link rel='stylesheet' type='text/css' href='../../Style/CSS/
tree_component.css' />
        <script type='text/javascript' src='../../Style/Script/_all.js'></
script>
        <script type='text/javascript' src='../../Style/Script/
tree_component.js'></script>
        <script type='text/javascript' src='../../Style/Script/bubble.js'></
script>
        <script type='text/javascript' src='../../Style/Script/custom.js'></
script>
</HEAD>
<FRAMESET cols="20%, 80%"  id="main_frame" name="main_frame">
  <FRAMESET cols="100%" id="toc_frame" name="toc_frame">
      <FRAME src="toc.html"/>
  </FRAMESET>
  <FRAME src="content.html" name="content_frame" id="content_frame"/>
  <NOFRAMES>
      <P>Frame error</P>
  </NOFRAMES>
</FRAMESET>
</HTML>

Second page (doesn't work):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd";>
<HTML>
<HEAD>
<TITLE>Doc coll.</TITLE>
<meta http-equiv='Content-type' content='text/html' charset='utf-8' />
        <link rel='stylesheet' type='text/css' href='../../Style/CSS/
styles.css' />
        <link rel='stylesheet' type='text/css' href='../../Style/CSS/
jquery_style.css' />
        <link rel='stylesheet' type='text/css' href='../../Style/CSS/
tree_component.css' />
        <script type='text/javascript' src='../../Style/Script/_all.js'></
script>
        <script type='text/javascript' src='../../Style/Script/
tree_component.js'></script>
        <script type='text/javascript' src='../../Style/Script/bubble.js'></
script>
        <script type='text/javascript' src='../../Style/Script/custom.js'></
script>
</HEAD>
<FRAMESET cols="20%, 80%"  id="main_frame" name="main_frame">
  <FRAMESET rows="50%,50%" id="toc_frame" name="toc_frame">
      <FRAME src="coll_toc.html"/>
      <FRAME src="" name="doc_toc_frame" id="doc_toc_frame"/>
  </FRAMESET>
  <FRAME src="" name="content_frame" id="content_frame"/>
  <NOFRAMES>
       <P>Frame error</P>
  </NOFRAMES>
</FRAMESET>
</HTML>

I am not smart enough to see where the tiny difference is, please,
give me hints. I hope someone sees the mistake at firs glance.
I think that is why I never use Jscript, the page is loaded, no error
message, simply doesn't work...

Reply via email to