hi guys, i have a javascript application which compares two xml files, to show that comparison i load two files on two iframes and when user click on node(i rendered the nodes to span elements) i run a comparison function, the problem is i want to disable onclick event of the spans on right-hand-side, but i call that event when user clicks the same span with the same id on left-hand-side. Do you know how can i disable it when it is directly clicked?

i found it guys, it took a little long though here is the example that i created.

mainpage.htm :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Untitled Page</title>
</head>
<body>
    <table>
        <tr>
            <td>
                <iframe id="leftPane" src="iframepage.htm" width="300" height="800"></iframe>
            </td>
            <td>
                <iframe id="rightPane" src="iframepage.htm" width="300" height="800"></iframe>
            </td>
        </tr>
    </table>
    <script>
     window.frames.leftPane.document.onclick = function()
   {
        window.frames.rightPane.document.getElementById(window.frames.leftPane.window.event.srcElement.id).click();
   }
    </script>
</body>
</html>

iframepage.htm :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <script type="text/javascript">
    function x()
    {
        if(window.frameElement.id == "rightPane")
        {
            if(window.event.x > 0)
            alert("you clicked physically on rightPane's deneme");
            else
            alert("you called rightPane's click event from leftPane's deneme");
        }
    }
   
    </script>
</head>
<body>
<a id="ID" href="#" onclick="x()" >deneme</a>
<div id="dv"></div>
</body>
</html>

if you create these two files and run the application you will see what i mean.

commented: Thank you for sharing +16
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.