JavaScript - Problem Separating Body From Footer In Css
Hey everyone,
I'd like to know how to separate my body from the footer. Here is my code: [CODE] /* BODY */ html { background: url(http://website.com/wp-content/themes/portfolio/images/background.png) scroll; } body { text-align: left; font-family: Arial, Helvetica, sans-serif; font-size: 100%; background: url(http://website.com/wp-content/themes/portfolio/images/mainBG.png) repeat-y; margin-right: 137.2px; margin-left: 137.2px; margin-bottom: -500px; } a { text-decoration: none; } a:hover { text-decoration: none; } a:selected { font-weight: bold; color:#0066FF; } p { color: #000000; line-height: 20px; } h1 { float: left; } h2 { color: #bab8b8; font-size: 25px; } #container { width: 973px; margin: auto; text-align: left; } /* END BODY */ /* NAVIGATION */ #nav { background: url(http://website.com/wp-content/themes/portfolio/images/nav_bg.png) repeat-x; overflow: hidden; height: 93px; margin-right: 18.2px; margin-left: 1px; padding: 0 0 0 31px; } #nav li { float: right; line-height: 93px; padding-left: 20px; padding-right: 50px; } #nav li a { padding: 0 1em; color: #565354; text-transform: uppercase; font-size: 18px; list-style-type: none; } #nav li a.first { padding-left: 0; } ul, li { list-style-type: none; } /* END NAVIGATION */ /* SIDEBAR */ #sidebar { margin-right: 312px; padding-bottom: 100px; color: #231f20; } #sidebar h3 { color: #bab8b8; font-size: 25px; margin-right: 312px; padding-right: 20px; padding-left: 30px; position: relative; } #searchform { margin-right: 630px; padding-left: 45px; margin-top: -1300px; } #sidebar links_with_style { margin-right: 312px; } #sidebar wp_list_categories { margin-right: 300px; } #sidebar wp_get_archives { margin-right: 312px; padding-bottom: 100px; } /* END SIDEBAR */ /* MAIN CONTENT*/ #content { margin-left: 380px; margin-right: 150.2px; } /* END MAIN CONTENT*/ /* FOOTER*/ #credits { margin-top: 5px; padding-top: 650px; margin-right: 100px; margin-left: 312px; } /* END FOOTER*/ [CODE] When I try to move the footer down so its separate from the body it doesn't work. I know I set the image on the body tag instead of #main. #main doesn't seem to work for loading the mainBG.png. Any know how to fix this? Similar TutorialsI wanted to resize the modal dialog based on the content of the modal dialog for that i used the following lines of code, window.dialogWidth = document.body.scrollWidth+ "px"; window.dialogHeight = document.body.scrollHeight+ "px"; The 'document.body.scrollHeight' is not giving the exact height of the modal dialog bcos the button on the modal dialog are not completely visible to click for the user. Please can any one tell how to get the exact height of the modal dialog to resize it? hi all im trying to hide a div on page load, ive used this. Code: <script type="text/javascript"> function hideDiv(){ document.getElementById('sidebar').style.display = "none"; } hideDiv() </script> and this in the body tag Code: <body onload="javascript:hideDiv()"> it works fine hiding the div named sidebar, problem comes when i try to then use an Onclick event to show the hidden div, it just wont show. can this be done? please help if you can this work has to be in soon Hello, I was wondering why my code is perfectly working in Firefox, but does not work in Internet Explorer at all: Code: <script language="javascript"> <!-- document.body.onload=document.body.appendChild(document.getElementById('testdiv')); --> </script> I don't get any error messages, the div is just not showing how it is supposed to show with body as parent. Any suggestions? Thanks this: Code: <body onload="pack = 'Original';recoger_mapa_url();" onkeydown="pulsar_tecla(event, 'onkeypress');" onkeypress="pulsar_tecla(event, 'onkeydown');"> [/CODE] to this: Code: pack = 'Original'; recoger_mapa_url(); window.onkeydown = pulsar_tecla(window.event, 'onkeypress'); window.onkeypress= pulsar_tecla(window.event, 'onkeydown'); does not work(event is undefined). Suggestions ? i had to put to onload commands in a body tag and now only one will work. is there any way to make both work?
hi guys, how can i get this code to load on body onload? without fading in and out? Code: <html> <head> <!-- For ease i'm just using a JQuery version hosted by JQuery- you can download any version and link to it locally --> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function() { $("#responsecontainer").load("response.php"); var refreshId = setInterval(function() { $("#responsecontainer").load('response.php?randval='+ Math.random()); }, 9000); $.ajaxSetup({ cache: false }); }); </script> </head> <body> <div id="responsecontainer"> </div> </body> Thanks Hello, How can i get scroll bar position of body tag ? Thanks in advance. The only way I know to make a script automatically run on the page is by using the "onLoad" property of the HTML body tag. However, I'm working with a template that serves the same header and footer for every page on my site, and this JavaScript is only needed on a single page. I therefore don't really want to edit the body tag with a function call that won't be needed in most cases. To avoid doing this, is there any other way to make a piece of JavaScript run without input from the user? All I want to do is autofocus on a form field. Thanks for any advice. Before <body> bunch of codes </body> After <body> <div id="trololol"></div> bunch of codes </body> I am a novice with Javascript and need help. The homepage of the website I am developing includes a simple javascript slideshow. The code for the script came from a different site that allowed code sharing. It functions wonderfully once loaded. However, in Internet Explorer, I must control-click to allow for the script to run. This wouldn't be a huge problem, but it is an inconvenience to visitors of the site. Since the website is for a public high school, the district computers have a high security setting. Therefore, anyone trying to access the site from a school computer (the main clientele) will have to control-click and allow access everytime they wish to visit the site. Not ideal. I know my problem is that I am using <body onload="runSlideShow">. I have tried including the defer attribute, but that did not work. Is there any other way I can write the code to not cause viewers to control-click everytime the page is loaded? Thanks tons! EDIT---- When opened in IE 7, there is a bar that warns againsts scripts and activex. I understand that I can lower my personal security setting, but I don't have the authority to do so for district PCs. Once a user clicks to allow the script the slideshow begins automatically. So, how can I write the code so that the warning bar does not show up? ---- Here's the bit of code that is applicable. Code: <script language="JavaScript"> var slideShowSpeed = 4000; var crossFadeDuration = 4; var Pic = new Array(); Pic[0] = 'field.jpg' Pic[1] = 'mural3.jpg' Pic[2] = 'cheer1.jpg' Pic[3] = 'Nuncrackers.jpg' Pic[4] = 'soccer4.jpg' Pic[5] = 'radio4.jpg' var t; var j = 0; var p = Pic.length; var preLoad = new Array(); for (i = 0; i < p; i++) { preLoad[i] = new Image(); preLoad[i].src = Pic[i]; } function runSlideShow() { if (document.all) { document.images.SlideShow.style.filter="blendTrans(duration=2)"; document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"; document.images.SlideShow.filters.blendTrans.Apply(); } document.images.SlideShow.src = preLoad[j].src; if (document.all) { document.images.SlideShow.filters.blendTrans.Play(); } j = j + 1; if (j > (p - 1)) j = 0; t = setTimeout('runSlideShow()', slideShowSpeed); } </script> <body onload="runSlideShow()"> <img src="field.jpg" name='SlideShow' width="814" height="300" /> I found a little chat script online and I wanted to check it out. When I integrated it into a page I created, for some reason this will not work correctly <body onload="setInterval('chat.update()', 1000)"> I tested it with two different browswers open Lets say on two different browser windows you have user1 and user2 if user1 types 'Hello' it will not show up on user2 window but if user2 types 'Hi' then on user2 window it will say user1 says Hello user2 says Hi so basically for user1 to see what user2 has wrote, user1 has to type something first and send it to see what user2 said. hope you understand, if you would like I could post up the code. i cannot understand, am i making the same mistake each time but my <body onload="startChecking()"> does not want to load again?? here my full code: Code: <head> <script language="JavaScript" type="text/javascript"> var sendReq; var receiveReq; var lastmessage = 0; var mTimer; function startChecking() { receiveReq = new XMLHttpRequest(); console.log("1234"); getNewMessage(); } function getNewMessage() { if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { console.log(receiveReq.readyState); } mTimer = setTimeout('getNewMessage();',30000); } </script> </head> <body onload="startChecking()"> //more code here </body> i just want the console.logs to execute then i will continue with the rest of my code... please help? thank you I'm trying to implement saving the document.body.scrollTop value and then restoring it but the restore does not work. The SetScrollLocation() alert line is empty. The save alert() lines displays a value so its saving the scrollTop but it seems to loose the value on the SetScrollLocation() call. I'm saving on an OnClick event and then restoring when the form reloads from a refresh. PHP Code: function SaveScrollLocation () { document.forms[0].frm_body_hidden.value = document.body.scrollTop; alert(document.forms[0].frm_body_hidden.value); } function SetScrollLocation () { alert(document.forms[0].frm_body_hidden.value); document.body.scrolltop = document.forms[0].frm_body_hidden.value; } Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script language="javascript" type="text/javascript"> alert (document.body); </script> </head> <body> </body> </html> EDIT: moved script to after body, and now it works. Not the way it should be done I think ? Hi, is it possible to have a different background image on IE to firefox, I am doing my background image as shown below: Code: <body style="background-image: url(unbranded_bg.png);"> however I want script that says if IE, show unbranded_bg2.png and if firefox show unbranded_bg.png. Many Thanks, Simon I am pretty new to JavaScript, so I apologize if this is a stupid mistake. I am using this code, but trying to have several slideshows on the page. I have set up two to test it, and one works while the other just displays a static image. What is the best way to do this? Do I need to repeat the script code in the head? Thanks in advance for any help.
Hi, Is there any alternative to the ' body onload="" ' function? I have on the page several scripts running and one is blocking the others because of the body onload function. It is working if I change that to body onfocus but it is loading the content all over when the user gets back to the page. Any ideas how can I avoid this? I can't apply onload to some element, onfocus is not working and this code also does not suite me: Code: <script type="text/javascript> function(); </script> Thanks in any case! Batric What I mean is that my <body> tag currently is like this: Code: <body class="page-course"> I would like to insert a pop-up contact form which requires the body tag to be like this: Code: <body onload="javascript:fg_hideform('fg_formContainer','fg_backgroundpopup');"> Not quite sure how to merge these - indeed can I merge them? Perhaps better to make the body class (top example) execute elsewhere? THANKS!! Hi my code returns all the html of the iframe. I would like just the body html. Any one know how to amend to suit? Code: alert( $("#uploaderIframe").contents()[0].documentElement.innerHTML ); This code not work, Code: if( document.body.scrollTop() > 200 ) { $( '.navigation' ).addClass( 'fixed' ); } else { $( '.navigation' ).removeClass( 'fixed' ); } I want it to work without jQuery, because half my site die's when i use jQuery, jsut want a simple scrollTop script for when im 200px from top it locks navigation fixed top the top, it works with jQuery but not without and been trying for hours to get it to work, any help would be kindly recieve thanks. |