Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamically load html problem

Status
Not open for further replies.

stax

Technical User
Sep 25, 2002
81
US
Hi,

I'm trying to load HTML from a file on my server into a table and i just get an error message. Can anyone tell me what is wrong with this?

<td>
<div id="div_products">
<DIV>
<script language="JavaScript">document.getElementById('div_products').innerHTML="</script>
</td>

So in theory this should load the HTML from the txt file and insert it inbetween <div id="div_products"> and <DIV>?

Thnx
S
 
So in theory this should load the HTML from the txt file and insert it inbetween <div id="div_products"> and <DIV>?
No, it will put the string " in the div.

You might have more success doing this by targetting an iframe rather than a div, and setting the src of the iframe (rather than the innerHTML of the div).

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Hi Jeff,

But apparently iframe doesnt work with netscape? should i find a solution that works with every browser?

S
 
should i find a solution that works with every browser?
You are better off deciding what browsers you are going to support, and then choose a solution that will do just that.

Modern browsers account for almost all traffic to a web site. I would suggest looking at a browser support matrix that supports all current major versions of the browsers, and one major version back for the browsers that are updated regularly. For example:

Firefox 2, 1.5 (both)
IE 7, 6 (Windows)
Opera 9 (both)
Netscape 9 (Windows), Netscape 7.1 (MacOSX)
Safari 3 (both)

If you find that you need to support a particular browser/OS combination (maybe because your target audience is profiled to be using that - for example an intranet) then that will change the browser matrix.

The thing is, for each "older" non-modern browser that you attempt to support, you will be compromising your effort (cutting corners, restricting what you can do etc).

Modern browsers follow standards, older browsers do not (which makes it harder and harder to develop solutions that look/perform the same way). People struggle with making an IE6 and Firefox 2 compatible solution (!!!) let alone attempting to support the "old" browsers.

For the record, all the browsers I have discussed above support iframes.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Great thanks Jeff, i'll try to do it with iframe
S
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top