Results 1 to 2 of 2

Thread: Get ImageAltText and Image path in Javascript

  1. #1
    Join Date
    Sep 2012

    Post Get ImageAltText and Image path in Javascript

    This is my response

    <createstkyUserResponse xmlns="http://xyz.com/abc"><stky imagePath="Bicycle/mc20/bicycle.jpg" imageAltText="Bicycle 123"/>

    the image list I get it from this div

    imageList += '<div class="myclass"><img class="stky" src="data:image/png;base64,' + $(this).text() + '"></div>';
    i need the imageAltText and path

    tried this way not working

    var imageAttr=image.attr("id");
    var myAttr=imageAttr.split("-");
    applicationObj.imagePath = myAttr[0];
    applicationObj.imageAltText = myAttr[1];

    Please need a help will be appriciated

  2. #2
    Join Date
    Sep 2007
    If I understand
    The code I try:
    <createstkyUserResponse xmlns="http://xyz.com/abc"><stky imagePath="Bicycle/mc20/bicycle.jpg" imageAltText="Bicycle 123"/> 
    <script type="text/javascript">
    var el = document.getElementsByTagName('stky');
    alert(el[0].getAttribute('imageAltText') );     //  Bicycle 123
    alert(el[0].getAttribute('imagePath') );    //  Bicycle/mc20/bicycle.jpg

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center