Results 1 to 3 of 3

Thread: erase Javascript the way innerHTML can Html

  1. #1
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default erase Javascript the way innerHTML can Html

    Is there a way to erase the javascript between <div> tags; innerHTML="" does not erase the java.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There shouldn't be any javascript between <div> tags, it belongs between <script> tags. It is rarely necessary to erase javascript though. You can just tell it to stop.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    HTML is set and unchanging. This means that the only way to change it and control it is to use javascript, such as with innerHTML.

    Javascript, as programmable code, is great because you can use conditional statements (if, etc.) that allow for the code to act upon certain events or situations.

    Javascript is generally run from an event, such as the page loading, the user clicking or typing, or time. As such, you can better choose this event, then you won't need to worry about deleting the actual code.

    One great option here would be to use a function, so that the function is only executed when it's called, but isn't actually active in a div, etc.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

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
  •