Call javascript from html object or iframe

I have the following problem using HTML and javascript. On my website, the div has an HTML page containing the following data:

<object name="cont" type="text/html" data="myHtmlPage.html"></object>

I have a javascript function (linked to the main page) that modifies the contents of this object.

The code works well, because I can navigate the "inner" page without changing the external context.

The problem is that now I need to call a function on the javascript main page from the html page loaded into this object (it needs to be called on the main page, because I need to change some properties of the div’s main page)

Is there any way to do this?

Hope I was clear, thanks for your help.

Matteo

Edit:

I have index.html that has a series of sections (this is one website).

(#services) div: , , , iFrame (#content) ( html-).

js (serviceMenuHandler.js) :

function changeService(servizio){
            var pathServizio;
            var pathMenu;
            pathServizio = servizio + ".html";
            pathBg = 'url(img/'+servizio+'.jpg)';
            if(servizio=="applicazioni" || servizio == "progettazione"){
                pathServizio = "errore.html";
            }
            document.getElementById('content').src=pathServizio;
            $("#services").css('background',pathBg);}`
}

, serivice1.html, iFrame, .

changeService , .

JSantosh, javascript service1.html, parent.changeService(service), .

js <script type="text/javascript" src="js/serviceMenuHandler.js"></script> , iFrame.

, ,

2:

Firefox , , .

- , Chrome?

+4
1

ok , , .

changeervice , .

- .js, , .js . .

<script src="javascript.js"></script>

, .

0

All Articles