Forums

[resolved] Load Image in Div (4 posts)

  1. macart
    Member
    Posted 2 years ago #

    I would like an image to load into "contentBanner" when home or blog is clicked. Can I somehow do a call in my secondaryNav to load an image into contentBanner?

    <div class="secondaryNav">


    </div>
    <div id="contentBanner"></div>

    #contentBanner {
    height: 250px;
    width: 788px;
    float: left;
    background-image: url(images/home.jpg) !important;
    margin-top: 10px;
    margin-bottom: 20px;

    Thanks

  2. macart
    Member
    Posted 2 years ago #

    Sorry somehow my code was lost in the first post

    <div class="secondaryNav">


    </div>
    <div id="contentBanner"></div>

    #contentBanner {
    height: 250px;
    width: 788px;
    float: left;
    background-image: url(images/home.jpg) !important;
    margin-top: 10px;
    margin-bottom: 20px;

  3. macart
    Member
    Posted 2 years ago #

    Sorry lets try this again.

    <div class="secondaryNav">
    <a id="home" href="mysite/wordpress/home" title="home"></a>
    <a id="blog" href="mysite/wordpress/blog" title="blog"></a>
    </div>
    <div id="contentBanner"></div>
  4. macart
    Member
    Posted 2 years ago #

    My web search found this, but not sure how to properly write the function for wordpress. Will this work in WordPress?

    <script type="text/javascript">
    function changeIt(imageName,objName)
    {
    	var obj = document.getElementById(objName);
    
    	var imgTag = "<img src='"+imageName+"' border='0' />";
    
    	obj.innerHTML = imgTag;
    
    	return;
    }
    </script>
    </head>
    
    <body>
    <div id="image1">
    <img src="1.jpg" border="0" alt="one" />
    </div>
    
    <br /><br />
    
    <a id="one" href="#" onclick="changeIt('1.jpg','image1');">one</a>
    <a id="two" href="#" onclick="changeIt('2.jpg','image1');">two</a>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.