By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

setting properties left of div tag with statementes in javascript

oranoos3000
100+
P: 107
I want to use under statementes for give amount to properties left from
tag div
Expand|Select|Wrap|Line Numbers
  1.  <script type="text/javascript">
  2. a=(screen.width);
  3. a=a-800;
  4. re=0
  5. if(a>0)
  6. {
  7. if(a%2==1)
  8. a=(a-1)/2
  9. else
  10. a=a/2;
  11. }
  12. else
  13. {a=0}
  14. document.write('<div id=Layer1 style=position:absolute; left:'+a+'px; top:68px; width:226px; height:152px; z-index:1"><p>welcome to our site</p></div>');
  15. </script>
  16.  
but I dont answer
please help me
thanks alot
Feb 19 '09 #1
Share this Question
Share on Google+
3 Replies


Dormilich
Expert Mod 5K+
P: 8,639
what does Firefox' Error Console say?
Feb 19 '09 #2

oranoos3000
100+
P: 107
hi
I have a layer in site that all of members of site is included
and each members in this layer ,is in layer else
my problem is while resolution is 800*600 all of things is saw as well
but while I change resolution to 1024*768 i see content of site
in left side of screen and a white space and empty in right side
of screet I want to put base layer so that base layer is put base on resolution
computer user
code that i use
is as follow
Expand|Select|Wrap|Line Numbers
  1. <div id="lyrBody" style="position:absolute; left:0px; top:4px; width:800px; height:688px; z-index:1">
  2.  
my browser is internet explorer
do I do this work ?that get screen.left and less than 800 and divide this number
2 and set propertis left of above div tag with this number
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. a=(screen.width);
  3. a=a-800;
  4. if(a>0)
  5. {
  6. if(a%2==1)
  7. a=(a-1)/2
  8. else
  9. a=a/2;
  10. }
  11. else
  12. {a=0}
  13. if (a>0) {
  14. document.getElementByid("lyrBody").style.left = a;
  15.  
thanks alot
Feb 20 '09 #3

gits
Expert Mod 5K+
P: 5,390
threads merged ... please do not double post and keep all things that relates to one problem in one thread ...

kind regards,
MOD
Feb 20 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.