javascript swap with in line.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    javascript swap with in line.

    using one line <p> or <div> content, how to swap values ? without using refresh browser and even html id elements.

    Code:
    <p><%= (Mid(arrDBinx(J+1, I),1,73))%>
    
    <a href="#" onclick="javascript ob.innerHTML('<%= arrDBinx(J+1, I)%>')"> Read More...</a></p>
    swapping values;
    Code:
    <%= (Mid(arrDBinx(J+1, I),1,73))%>
    to
    <%= arrDBinx(J+1, I)%>')">
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Effectively, it's a "Read more..." link, so what I would suggest is to hide the "more" content and display on clicking the link (hide by setting the 'display' setting to 'none' and show by setting to 'block').

    Comment

    • Fary4u
      Contributor
      • Jul 2007
      • 273

      #3
      i don't want any more page to create.
      dat is why on the same page i'm swapping the value

      about display none or inline can't use coz it's array method if i use id to show or hide content then i've to assign each var with different values?

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        You don't have to create any more pages. I meant hiding the content with something like this:
        Code:
        <p>some content up to 73 chars<span class="hide">hidden content</span>
        where the "hide" class would contain the necessary CSS rule.

        You don't need to set the IDs manually. You can use your server-side code to generate the IDs as well as the appropriate links.

        The link itself doesn't need to have inline event handlers. Modern browsers can use advanced event handling or even the old-style link.onclick = someFunction;

        Comment

        Working...