Q:

Replacing  content by external html file with Javascript

I'm a bit rusty on my HTML and JavaScript and can't seem to get this one right. The simple approach I took works fine, but I want to be more flexible. Here is the simple approach:

<head>

    <script>
        function loadContent(a){
            document.getElementById(a).innerHTML='<object type="text/html" data="home.html" ></object>';
        }
    </script>
</head>

<body>

    <div id="topBar"> 
        <a href ="#" onclick="loadContent('content')"> HOME </a> 
    </div>
    <div id ="content"> </div>

</body>

This works fine. However, I also want to get the desired document as a variable of the function. Here is where I get stuck. Probably has something to do with the "" and '', but I have not been able to find the answer. Here is my 'desired' situation:

<head>

    <script>
        function loadContent(a, b){
            document.getElementById(a).innerHTML= b;
        }
    </script>
</head>

<body>

    <div id="topBar"> 
        <a href ="#" onclick="loadContent('content', '<object type='text/html' data='home.html' ></object>')"> HOME </a> 
    </div>
    <div id ="content"> </div>

</body>

Can anybody help me out?
Thanx

A:

Try:
<a href ="#" onclick="loadContent('content', '<object type=\'text/html\' data=\'home.html\' ></object>')"> HOME </a> 

Basically just escape the quotes.

