www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Rate Thread Display Modes
      #1  
    Old 07-18-2006, 12:22 PM
    sagel sagel is offline
    Registered User
     
    Join Date: Jul 2006
    Posts: 14
    onblur problems in ie

    im creating an input with javascript. im assigning it an onblur attribute. it works fine in firefox, but not in ie (on pc). any ideas? thx.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script>
    window.onload = function() {
    var newInput = document.createElement("input");
    newInput.setAttribute("onblur","alert(this.value)");
    document.getElementsByTagName("form")[0].appendChild(newInput);
    }
    </script>
    </head>

    <body>
    <form>
    </form>
    </body>
    </html>
    Reply With Quote
      #2  
    Old 07-18-2006, 01:06 PM
    Charles's Avatar
    Charles Charles is offline
    JavaScript Banned
     
    Join Date: Nov 2002
    Location: Baltimore, Maryland
    Posts: 11,881
    1) You need to run that through The Validator.

    2) Try setting the handler thusly: newInput.onblur = function () {alert (this.value)}.
    __________________
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web
    Reply With Quote
      #3  
    Old 07-19-2006, 11:23 AM
    sagel sagel is offline
    Registered User
     
    Join Date: Jul 2006
    Posts: 14
    weird, i responded to this yesterday but it didnt post. anyway, thx! okay here's another one. assigning an attribute of onkeyup with "event" passed in the function breaks the code. thx for any help!

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script>
    window.onload = function() {
    var newInput = document.createElement("input");
    newInput.onkeyup = function () {KeyPress(this,event);};

    document.getElementsByTagName("form")[0].appendChild(newInput);
    newInput.focus();
    }

    function KeyPress(inputField,event) {
    if(event && (event.keyCode == 13 || event.keyCode == 9)){
    alert(event.keyCode);
    return false;
    }
    }
    </script>
    </head>

    <body>
    <form>
    </form>
    </body>
    </html>
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:07 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.