Web Analytics Made Easy -
StatCounter Problems with Javascript and CSS - CodingForum

Announcement

Collapse
No announcement yet.

Problems with Javascript and CSS

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems with Javascript and CSS

    I want a vertical line to be the lenght of the user's screen and I have a DIV set up to do that, but it doesn't seem to show up when I put a document.write around it. Look at the code here:



    I commented out the DIV with a static height

    jga

  • #2
    Code:
    document.write("<div style=""position: absolute; background-color: 999966;height: "screen.height" px;top: 0px; left: 182px; width: 2px; "">")
    try:

    Code:
    document.write("<div style='position: absolute; background-color: 999966;height:"screen.height";  px;top: 0px; left: 182px; width: 2px; '>")
    Not sure what to do about the height:"screen.height". But you have quotes in the document.write, so that could be one reason.

    Comment


    • #3
      As squirell said

      you probably want

      height: " + screen.height + " px;top

      Javascript does not use "" to dispkay a single quote like other languages do. To do this you need to use \" and it will be ignored.

      Eric
      Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

      Comment

      Working...
      X