Reputation: 2121
I want to detect if the browser supports different functions:
var useWrappedLayout = (document.getElementById != undefined);
I have to support quite old devices, thats why I check for getElementById.
Depending on if useWrappedLayout
is true or not, I want the page to have some HTML-Elements or not.
For keeping things simple and to have an example, lets say I only want to have
<p>Test</p>
between
<b>A</b><i>C</i>
if useWrappedLayout
is true
.
What methods do I have? Only innerHTML
?
Upvotes: 0
Views: 154
Reputation: 21501
Building the HTML dynamically using javascript
<script type="text/javascript">
var useWrappedLayout = (document.getElementById != undefined);
document.write("<b>A</b>" + ((useWrappedLayout) ? "<p>Test</p>" : "") + "<i>C</i>");
</script>
Upvotes: 1