Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8857923
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:42:25+00:00 2026-06-14T14:42:25+00:00

document.onkeydown = function(event) { var tagName = event.target.tagName; if (tagName != ‘INPUT’ && tagName

  • 0
document.onkeydown = function(event) {
    var tagName = event.target.tagName;
    if (tagName != 'INPUT' && tagName != 'TEXTAREA' && !event.alt && event.control) {

        if (event.ctrlKey && event.keyCode == 37) {
            if (_this.currentPage > 1) {
                window.location.href = _this.baseUrl.replace(/%page%/i, _this.currentPage + 1);
            }
        } else if (event.ctrlKey && event.keyCode == 39) {
            if (_this.currentPage < _this.pagesTotal) {
                window.location.href = _this.baseUrl.replace(/%page%/i, _this.currentPage - 1);
            }
        }
    }
}

This gives me an error only in IE 8:

‘target’ is null or not an object

for that line var tagName = event.target.tagName;

How to fix that? Error happens when I press Ctrl or arrows button.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T14:42:26+00:00Added an answer on June 14, 2026 at 2:42 pm

    Do it like this:

    event = event || window.event;
    var tagName = (event.target || event.srcElement).tagName.toUpperCase();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

document.onkeydown.toString() returns onkeydown function but I only want to get this function's name. Is
document.observe('click', function(e, el) { if (e.target != Element.descendantOf('calendar')) { $('calendar').fade(); } }); I am
From an input text I need to call a function to capture the onkeydown
I have an <input> which has an onkeydown inline event handler. In this handler,
document.forms[regform][fname].value; In java script i get the value of input having name(fname) which is
document.getElementById('container').addEventListener('copy',beforecopy,false ); In Chrome / Safari, the above will run the "beforecopy" function when
document.body.innerHTML works to search within the body. Is there a similar function for searching
function test() { this.str = hello; this.sayHello = function() { document.write(this.str); } this.init =
Here's the problem, document.onkeydown = checkkeycode I'm passing two variable to checkeycode e which
Onkeydown , I run the following JavaScript: function ThisOnKeyDown(el) { if (el.title == 'textonly')

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.