Click here to Skip to main content
15,940,550 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello everyone,

Im trying to load my xml tree into an iframe with javascript on a bouton click
it doesnt seem to work your help will be appreciated. Here is my code:

<script language="javascript" type="text/javascript">

    function GetXML()

         var test = document.getElementById("IframeXmlErreur").src = "DocumentXML/MessageErreur.xml";

       return test;


<form id="form1" runat="server">
<div align="center">

                    <asp:Button ID="BtnMessage" runat="server" Text="Afficher XML"
                        Width="134px" OnClientClick = "GetXML();"/><br /><br />
<div align="center">
    <div class="panel">
        <iframe id="IframeXmlErreur"
            style="width: 548px;" frameborder="0">

Updated 17-Jan-12 21:06pm
Sergey Alexandrovich Kryukov 17-Jan-12 19:19pm    
And what happened? What was wrong?
Suraj S Koneri 17-Jan-12 23:02pm    
try with this "~/DocumentXML/MessageErreur.xml"
DocumentXML seems to be a folder under root so the must be treated as ~.
i think it helps you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900