DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Loading HTML text into a variable dynamicly

  1. #1
    Manoj Shah Guest

    Loading HTML text into a variable dynamicly


    Hi,
    I dont know if this is possible, but I want to assign a variable with HTML
    text. This would come from either a text file. I then want to use the DIV
    element to display this text by using innerHTML property. This all is done
    on the client side using javascript.
    I don't see why this is a problem because with images one can do this by
    changing the src property. I am sure there is a way but at the momment I
    am stuck.
    Anyhelp appreciated, even if you can explaint to me why its not possible
    I would be very helpful.
    Thanks in advance manoj


  2. #2
    Russell Jones Guest

    Re: Loading HTML text into a variable dynamicly

    It is possible. Here's an example.
    <html>
    <body>
    <div id="div1"></div>
    </body>
    </html>
    <script language="JavaScript">
    var s = "<b>This is some HTML</b>";
    document.all("div1").innerHTML = s
    </script>

    To meet your needs, you'd need to get the text for the variable "s" from the
    text file.

    "Manoj Shah" <AKshah1@yahoo.com> wrote in message
    news:3b3f3b12@news.devx.com...
    >
    > Hi,
    > I dont know if this is possible, but I want to assign a variable with HTML
    > text. This would come from either a text file. I then want to use the DIV
    > element to display this text by using innerHTML property. This all is done
    > on the client side using javascript.
    > I don't see why this is a problem because with images one can do this by
    > changing the src property. I am sure there is a way but at the momment I
    > am stuck.
    > Anyhelp appreciated, even if you can explaint to me why its not possible
    > I would be very helpful.
    > Thanks in advance manoj
    >




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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center