JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 28th, 2013, 11:58 AM
kakolaukiom kakolaukiom is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 1 kakolaukiom User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 21 sec
Reputation Power: 0
Problem with element.style.left

Hello,

I am trying t do some tests of javascript to make in practice what i did learn from some tutorials..

So I suggest to you to examin this code :

Code:
<html> <head> <title>Test Javascript</title> <style> #bonjour{ position : absolute; } </style> </head> <body> <label id="bonjour" style="{position : absolute;}">Bonjour ca va?</label> <script> var bonjour = document.getELementById('bonjour'); document.addEventListener('keyup',function(e){ if(e.keyCode == 37){ bonjour.style.left = '200px';} },false); </script> </body> </html>


So what i want to do is so simple . I just want to move my label in the right when I click on the button right of the keyword..But it doesn't work..
Could you verify please where I made the error in my code ??


Thanks ,

Reply With Quote
  #2  
Old January 28th, 2013, 01:41 PM
coothead's Avatar
coothead coothead is offline
~ bald headed old fart ~
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2005
Location: chertsey, a small town s.w. of london, england
Posts: 192 coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level)coothead User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 17 h 41 m 25 sec
Reputation Power: 86
Hi there kakolaukiom,

and a warm welcome to these forums.

In your code you have...
Code:

var bonjour = document.getELementById('bonjour'); 

...it should, of course, be...
Code:

var bonjour = document.getElementById('bonjour'); 


coothead
__________________

Reply With Quote
  #3  
Old January 29th, 2013, 03:33 AM
tiwariankit tiwariankit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 5 tiwariankit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 43 sec
Reputation Power: 0
Please use this code

<html>
<head>
<title>Test Javascript</title>
<style> #bonjour{ position : absolute; }
</style>
</head>
<body>
<label id="bonjour" style="{position : absolute;}">Bonjour ca va?</label>
<script>
var bonjour = document.getElementById('bonjour');
document.addEventListener('keyup',function(e)
{
if(e.keyCode == 39)
{
bonjour.style.left = '200px';
}
},false);
</script>
</body>
</html>

Thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Problem with element.style.left

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap