Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. include javascript within document write

include javascript within document write

Scheduled Pinned Locked Moved JavaScript
questionjavascripttoolshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wfzen
    wrote on last edited by
    #1

    I use Dreamweaver to generate the rollover Javascript code to something like this:

    The problem is the last part of the link is dynamic. so I tried to include the javascript for rollover and rollout within document.write.

    document.write("[");](http://astringforURL=" + theCourseCode + ")

    [IT does the link OK not the rollover anymore with this. I think it may relate to the single quotes it had initially and I had to change the double quotes into single quotes while retaining the single quote. I can't put the script to do rollover outside either. How can I make it work? Thanks,](http://astringforURL=" + theCourseCode + ")

    T 1 Reply Last reply
    0
    • W wfzen

      I use Dreamweaver to generate the rollover Javascript code to something like this:

      The problem is the last part of the link is dynamic. so I tried to include the javascript for rollover and rollout within document.write.

      document.write("[");](http://astringforURL=" + theCourseCode + ")

      [IT does the link OK not the rollover anymore with this. I think it may relate to the single quotes it had initially and I had to change the double quotes into single quotes while retaining the single quote. I can't put the script to do rollover outside either. How can I make it work? Thanks,](http://astringforURL=" + theCourseCode + ")

      T Offline
      T Offline
      twseitex
      wrote on last edited by
      #2

      Don't use doument.write() During parsing parts of document (e.g. HEAD-part before body) browser finds script inside of BODY (browser parses body part). In this case the body object is real exist. document.write in use of Internet Explorer may create an NEW BODY and new document. To append objects inside actual document - actual body - please use Javascript functions createElement() and appendElement(). var X01=document.createElement("IMG"); if(X01!=null) {var X02=document.body.appendChild(X01); if (X02!=null) { // X02 is pointer of created object inside body } }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups