Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Dyanamic load of images with in a single page

malliksastrymalliksastry Posts: 6Member
I want to write a program that dyanamically creates webpage taking an image and then add comment about the page
And finally I want all these to be added in a single webpage where in onclick of next and previous buttons the pages are to be displayed with in the same page

Please help me out in generating the code
Also I want the path to be taken as a relative path

Comments

  • zibadianzibadian Posts: 6,349Member
    : I want to write a program that dyanamically creates webpage taking an image and then add comment about the page
    : And finally I want all these to be added in a single webpage where in onclick of next and previous buttons the pages are to be displayed with in the same page
    :
    : Please help me out in generating the code
    : Also I want the path to be taken as a relative path
    :
    Here is a javascript function, which changes the image:
    [code]
    function changeImage(url)
    {
    imgSpanID.innerHTML = 'image';
    }
    [/code]
    The HTML that goes along with it is this:
    [code]

    [/code]
    Place the HTML code anywhere where you want the image to be. You can modify the DHTML code the function creates as you wish. This can also be used to update the comment and to update the buttons.

    A relative path is similar to a absolute path, but leaves certain parts out. So if you have your images located in a subfolder called "myimages" then you can call the function as follows:
    [code]
    changeImage('myimages/someimage.jpg');
    [/code]
  • WeirdofreakWeirdofreak Posts: 439Member
    I doubt that function'll work, AFAIK IDs aren't level two objects. There's also a more practical way - modify the image itself instead of the contents of its parent element:

    : [code]
    : function changeImage(url)
    : {
    : document.getElementById('pic').src = url;
    : }
    :
    : image
    : [/code]

    If you don't want an image until the function is called, just use a 1x1 transparent gif.
  • zibadianzibadian Posts: 6,349Member
    : I doubt that function'll work, AFAIK IDs aren't level two objects. There's also a more practical way - modify the image itself instead of the contents of its parent element:
    :
    : : [code]
    : : function changeImage(url)
    : : {
    : : document.getElementById('pic').src = url;
    : : }
    : :
    : : image
    : : [/code]
    :
    : If you don't want an image until the function is called, just use a 1x1 transparent gif.
    :
    I've used that same method to create several databases. It surely works under IE4+, Opera, and Netscape 4.5+.
  • WeirdofreakWeirdofreak Posts: 439Member
    It doesn't work in Mozilla/Firefox.
Sign In or Register to comment.