Forum Moderators: open
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
<div
id="example1div"
style="border-style:solid;
padding:10px;
text-align:center;">
I will be replaced when you click.
</div>
<a href="javascript:ReplaceContentInContainer('example1div','Whew! You clicked!')">
Click me to replace the content in the container.
</a>
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = '<img src="/images/webhours.png">';
}
<area shape="rect" coords="2,2,105,42" href="javascript:ReplaceContentInContainer('maincon')" onmouseover="activate1()" onmouseout="deactivate1()">
onclick="document.getElementById('myDiv').innerHTML='hello sailor';"
onclick="document.getElementById('myDiv').?='myForm';"
function replaceDivWithForm(){
var oldHTML = document.getElementById('myDiv').innerHTML;
var newHTML = "<form action="http://blablabla.com"><div><td><tr><input type="text" bla bla bla></td></tr></form>";
document.getElementById('myDiv').innerHTML = newHTML;
}
onclick='replaceDivWithForm()'
function swapform() {
document.getElementById('formdiv').style.display = '';
document.getElementById('maincon').style.display = 'none';
}
<a href="javascript:swapform()">
function swap(){
var obj0=document.getElementById('hoursarea');
var obj1=document.getElementById('myimage');
var flag=true;
obj0.onclick=function() {
flag==true?
(obj1.src='images/webhours.png',flag=false):
(obj1.src='images/mainpage.png',flag=true);
}
}
window.addEventListener?
window.addEventListener('load',swap,false):
window.attachEvent('onload',swap);
<a href="javascript:swapform()">
and 'myimage' no longer exists.
as if obj1=document.getElementById('formdiv')