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

  • SEARCH
  • Home
  • 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 3611042
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:49:41+00:00 2026-05-18T21:49:41+00:00

This is not working and I can’t figure out where I went wrong: <style>

  • 0

This is not working and I can’t figure out where I went wrong:

<style>
* {
margin: 0px
}  

div {
    height: 250px;
    width: 630px;
    overflow: hidden;
    vertical-align: top;
    position: relative;
}
  iframe {
    position: absolute;
    left: -50px;
    top: -130px;
  }
</style>
<script>
window.onload = function() {
   document.getElementsByTagName('body')[0].onkeyup = function(e) { 
      var div = document.getElementById('capture');
      if(e.keyCode == 70) {
         if(div.style.height == 250){
             alert("Yes");
         }
         else {alert("no");}
      }
   }
};
</script>

++++++++++++++EDIT+++++++++++++

Ok, well this works fine:

         if(div.style.height < '260px'){
             alert("Yes!");
             div.style.height = '475px';
             pan.style.top = '-25';
         }
         else if(div.style.height > '260px') {
            alert("no");
            div.style.height = '250px';
            pan.style.top = '-130';
         }

But this doesn’t:

     if(div.style.height = '250px'){
         alert("Yes!");
         div.style.height = '475px';
         pan.style.top = '-25';
     }
     else if(div.style.height = '475px') {
        alert("no");
        div.style.height = '250px';
        pan.style.top = '-130';
     }

What gives?!?

  • 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-05-18T21:49:42+00:00Added an answer on May 18, 2026 at 9:49 pm

    Use parseInt to convert the value to number:

    var divHeight = parseInt(div.style.height, 10);
    if(divHeight === 250) {
        alert("Yes!");
        div.style.height = "475px";
        pan.style.top = "-25px";
    }
    else if (divHeight === 475) {
        alert("no");
        div.style.height = "250px";
        pan.style.top = "-130px";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone explain why is this not working? on div> ol :first-child ? div>ul:first-child
runat=server /> But this code is not working How can I add multiple controls
I want to know i can do something similar to this (not working) code
I want to display data from database in DataGridView...This is my code...Its not working...Can
Can someone explains me why this is not working as I expect it? zen:~
Brains not working today and can't find a nice way of doing this. So
Can anyone tell me why this function is not working ? for(var i=1;i<=12;i++) {
can someone explain me why this script is not working? <script type=text/javascript> function destroy(ID)
Can anyone tell me why this code would not be working? $('body').on('test', function() {
Can anybody please tell me why the removeEventListener call is not working? this.addEventListener(Event.ENTER_FRAME, eventCall,

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.