Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   HTML, Javascript y otros (https://www.clubdelphi.com/foros/forumdisplay.php?f=38)
-   -   Recargar OBJECT en HTML (https://www.clubdelphi.com/foros/showthread.php?t=89973)

cd.rafael 11-03-2016 15:58:38

Recargar OBJECT en HTML
 
Cordial saludo,

Tengo un pequeño desarrollo en HTML5, JS y PHP y me surgió un pequeño inconveniente.

En el siguiente código muestro como tengo organizada mi página Web:

Código:

<body>       
    <div id="divGeneral">
        <div id="divLeft">
                <object id="object1" type="text/html" data="Pagina1.html" width=100% height=100%></object>
        </div>
        <div id="divRight">
                <object id="object2" type="text/html" data="Pagina2.html" width=100% height=100%></object>
        </div>
    </div>
</body>

Lo que necesito es que cuando yo haga clic en uno de los enlaces que tengo en [Pagina1.html], cargada en el [object1], pueda cambiar el contenido del [object2].

En [Pagina1] tengo el siguiente código de JS:

Código:

    <script type="text/javascript">
            function fLoadDataObject(pURL)
            {
                var obj      = $('#objContent');
                var container = $(obj).parent();
                $(obj).attr('data', pURL);
                var newobj    = $(obj).clone();
                $(obj).remove();
                $(container).append(newobj);
            }
    </script>

Si yo colocar los enlaces en la página que contiene los objects, funcionaría perfecto, pero necesito que pueda ser llámado desde los enlaces de otra página.

Agradezco de antemano cualquier colaboración.

cd.rafael 11-03-2016 17:26:59

Cordial saludo,

Les pido disculpas. Transcribí el código de JS con un error. Lo vuelvo a escribir:

Código:

<script type="text/javascript">
            function fLoadDataObject(pURL)
            {
                var obj      = $('#object2);
                var container = $(obj).parent();
                $(obj).attr('data', pURL);
                var newobj    = $(obj).clone();
                $(obj).remove();
                $(container).append(newobj);
            }
    </script>

La variable [obj] tenía mal el nombre del object.

Nuevamente, mil disculpas.


La franja horaria es GMT +2. Ahora son las 00:13:52.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi