views:

15

answers:

1

I'm using javascript to control the href= field of the iframe located within the page. I am currently using

function DoIFrameNav(object_URL)    
{       
    document.all.additionalText.src="iframeContents.php?id="+object_URL;    
    selectedEvent = object_URL;   

}//end DoIFrameNav

to perform this action. And

onclick=\"DoIFrameNav(".$iCounter.");

to call the action when the user clicks on the table row.

It works perfectly in Firefox and IE6, but nothing else... Chrome just ignores it...

What would be the universally browser compatible way of doing this?

+1  A: 

You should not use document.all in a script that is intended to be cross-browser. Removing that should be your first step. Use document.getElementById() instead. At that point, the code you posted should be acceptable to all major browsers (hopefully).

Eric Mickelsen
You mean like: document.getElementById('additionalText').src="iframeContents.php?id="+object_URL; ?This does not seem to work in ANY browser...
Sakamoto Kazuma
It ought to work if 'additionalText' is the value of the id attribute of your iframe. Could you post a complete listing of the html and javascript involved?
Eric Mickelsen