Why does IE say there is an error?

Discussion in 'JavaScript' started by mark_s, Dec 18, 2008.

  1. #1
    Can someone explain why IE7/8 say there is an error on my home page?

    I have very little javascript but apparently there is an issue with it.

     
    mark_s, Dec 18, 2008 IP
  2. astupidname

    astupidname Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In your script, in the prepareSearchFields function there are these lines of code that look to be wrong:

    var searchField = document.getElementById("user"); //I was not able to locate an element on your page with an id of "user"
    //find the default value of the search field
    var defaultValue = searchField.defaultValue; //This I don't believe will work either as it is asking for searchField.defaultValue when defaultValue has just now been defined, so then searchField.defaultValue will be undefined
     
    astupidname, Dec 18, 2008 IP
  3. mark_s

    mark_s Peon

    Messages:
    497
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks...

    Do you know of any decent script that can have it so that the user and pass fields have a value in them but when you click on it, they disappear and when you click away, they reappear?
     
    mark_s, Dec 18, 2008 IP
  4. astupidname

    astupidname Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    http://www.dynamicsitesolutions.com/javascript/change-input-type-dynamically/
     
    astupidname, Dec 21, 2008 IP