SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot samohtwerdna's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setting a dynamic div as the response area?

    Hello all,

    I have a div that is repeated as such:
    <div align="right" id="TotalPrice<?php echo $row_rsOrderItems[OrderItemId]; ?>">

    and a javascript function that I would like to update the totals for as such:

    ...
    case(''): alert("An error occured upda**** totals, please try again."); break;
    default: document.getElementById('TotalPrice<?php echo $row_rsOrderItems[OrderItemId]; ?>').innerHTML = results;
    ...

    I am passing the order_item_id in the javascript but when I change the div to:
    'TotalPrice'+order_item_id

    I get an error that says that "document.getelementById("TotalPrice" + order_item_id) has no properties

    What am I doing wrong?

    how can I call a dynamic orderItemId inside the getElementById ??

    Any help would be appreciated - Thanks

  2. #2
    SitePoint Zealot samohtwerdna's Avatar
    Join Date
    Jul 2007
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I should add:

    I tried concatenating two variables like:
    var repDiv = "TotalPrice";
    var uniqueOII = repDiv + order_item_id;

    and then placing the uniqueOII variable in the getElementById like
    document.getElementById(uniqueOII).innerHTML = results;

    this only gives me the error that uniqueOII has no properties

    ???


Bookmarks

Posting Permissions

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