473,569 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript snippet modification ?

13 New Member
Hello,

I've aquired some Javascript that will kick in when a IE version < 6 comes to visit. It positions elements with a position:fixed effect. I need to add control for one more div container. Problem is - I don't have a clue about Javascript.

This is the complete sheet:

Expand|Select|Wrap|Line Numbers
  1. html, body{
  2.   background:url(foo) fixed;}
  3. #head, #footer, #navigation_oben{
  4.   position:absolute;
  5.   top:75px;
  6.   z-index:10;}
  7. #head{
  8.   top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop : document.body.scrollTop)}
  9. #wrap, #content-wrap {
  10.   height:100%;}
  11. #content{
  12.  padding:6em 1em;}
  13. #footer{
  14.   top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop +(documentElement.clientHeight-this.clientHeight) : document.body.scrollTop +(document.body.clientHeight-this.clientHeight));}

This controls the header and brings it up to the top (?)

Expand|Select|Wrap|Line Numbers
  1. #head{
  2.   top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ? documentElement.scrollTop : document.body.scrollTop)}
I'd like the code to position the addtional div 75px down from the top of the viewport / directly underneath the #head object. Could someone please help me mod the code necessary ?



regards.
Aug 15 '07 #1
3 1235
acoder
16,027 Recognized Expert Moderator MVP
I don't think this code is a very good idea - mixing CSS with Javascript.

However, if 'head' appears at the top, adding +75 to 'head2' (the additional div) should move it to the desired position.
Aug 15 '07 #2
MrPutty
13 New Member
Ah, sweet - that works thanks! I'm not fond of using JS myself, but it seems the only way to achieve the desired effect. Are there any problems I should be aware of?

What about the ActiveX warning posted by IE6 under WinXP? Is there a way to prevent this from happening?

regards
Aug 15 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
Ah, sweet - that works thanks! I'm not fond of using JS myself, but it seems the only way to achieve the desired effect. Are there any problems I should be aware of?
Read about the viewport. Note that for a novice, it may not be an easy read.
What about the ActiveX warning posted by IE6 under WinXP? Is there a way to prevent this from happening?
There is, but it's there for a reason. You can prevent it for yourself probably by adding your website to your trusted sites or signing the control, but it's up to each individual to decide what level they wish to keep their security.
Aug 15 '07 #4

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

Similar topics

9
2160
by: MStepansky | last post by:
Whats the difference between Javascript and Java3D? I mean can Javascript do like Java3D can? Or is Java3D on top of Javascript (the core, if thats what it is)? Then I should learn Javascript BEFORE Java3D, right? no? Worse, whats the difference between Java and Javascript? Whats the difference between Visual Basic and Visual...
104
16879
by: Leszek | last post by:
Hi. Is it possible in javascript to operate on an array without knowing how mamy elements it has? What i want to do is sending an array to a script, and this script should add all values from that array Could you show me a little example how to do this? Thanks.
5
6709
by: nescio | last post by:
hello, i have made an application in php so that people can make, on the fly, a form. when they submit the form there is a javascript formvalidation. because we do not know how many fields there are in the form (it is made on the fly) i collect all the form fieldnames in an php array and sent it to the javascript function:
2
1918
by: Water Cooler v2 | last post by:
http://www.w3schools.com/js/js_whereto.asp This link is to a JavaScript tutorial on w3schools. The page says that a script put in the HEAD is executed only when called, whereas one put in the BODY is executed as the page loads (implying invariably, whether called or not). To test, I tried the following two pages:
2
2812
by: sgMuser | last post by:
Hi, I am not a good developer of Javascript codes. Needs this help to make some modification to this famous free javascript from Anarchos. i am using this in one of my webpage. What it does is, rotates banners with hyperlink specific to each image. it works just perfect but i need a simple modification. now I want to stop rotating the images...
7
1801
by: Wm.M.Thompson | last post by:
For a computer programmer JavaScript is not difficult. It is pretty easy to look at some code for the first time and figure out what is going on. This is especially true if you have gratuated from an old-fashioned top-down programmer to an object oriented computer programmer. I mean, most Javascript has a look where things are sectioned...
8
4019
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form has a Button. When the Button is clicked, I want a JavaScript confirm dialog to pop-up with the options 'OK' & 'Cancel'. I have done this using the...
18
1883
by: Tom Cole | last post by:
I'm working on a small Ajax request library to simplify some tasks that I will be taking on shortly. For the most part everything works fine, however I seem to have some issues when running two requests at the same time. The first one stops execution as the second continues. If I place either an alert between the two requests or run the second...
4
3109
by: Joe Hrbek | last post by:
Could someone help me translate to something that would close to it in python? The anonymous functions are giving me problems. var dataListener = { data : "", onStartRequest: function(request, context){}, onStopRequest: function(request, context, status){ instream.close(); outstream.close(); listener.finished(this.data);
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8132
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7678
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.