Is there a small javascript snippet or something that can dynamically set the body ID on page load? I am using the Inverted Sliding Doors tabs from 456 Berea Street Code: but am trying to do so in a frameset [insert angry comments here] (I know I know, please don't harp!)... anyway, the tabs css sets the active tab using the body ID, but I can't seem to get it to recognize the body ID inside the frameset. Is there a javascript or some other code I could use to dynamically set the body ID? Or perhaps a better approach?
I'm working on a site where we display two lists of boats, sail or power via the organic tabs plugin. Now, our client wants us to show one list type by default depending on the class of the body tag - for example, if the user was on a sailing boat page, the body would have a class of 'sailPage' and therefore the list that would be shown by default would be the 'sail list' - and vice versa for the power (although be default this one shows first anyways as it is the first 'panel' in the HTML') In my admittedly rather clumsy way, I've written the following jQuery function which does seem to work (well, the first half) - however when the user clicks back on to the 'power' tab whilst on page with a class of 'sail', the power list doesn't display. There also seems to be a problem in IE7 where the content of the lists will not display until you select the other tab first, and then select the second tab again?
I'm trying to make my body content scroll at the same time as an iframe located within the body. This has to do with the age old problem of mouse focus on iframes. When my mouse reaches the iframe and it takes over focus, I would like the body to keep scrolling until the iframe is right at the top of the screen. After that I want to relinquish focus to the iframe. I don't mind if the iframe starts scrolling as soon as the mouse reaches it, so long as the main body keeps scrolling for a while.
It's possible to style document.body not to start at 0,0 for example: body {width: 1000px; margin-left: auto; margin-right: auto;} This means that X/Y of the body is not 0,0 but how can I find out what the position is using javascript? document.body.offsetLeft; is 0 and offsetParent is null yet if I position something absolutely at 0,0 it goes to 0,0 of the window, not the body!
I need to execute a JavaScript function "onload". The only problem is I don not have access to the <body> tag as it is a part of the standard page-header include (a separate file). How could I have certain pages execute my function() onLoad?
The function basically just sets the original values of fields so that I can determine if a field has been changed or not, which aleviates unnec. sql update on the backend..
How do you make a small change to the body of an html page from an event handler? If you have a string var, a function that displays it in the body, and a function that changes it, can you change the var on an event and then reparse the body of the page but not the head? And if not, then what?
Can someone tell me if there is a universal way to check the available screen with and screen height for IE, Netscape, and Opera? Is there a universal syntax?
</html> It didn't work. I also tried both of these: document.getElementsByTagName('body').setAttribute('bgcolor', '#000'); document.getElementByTagName('body').item(0).setAttribute('bgcolor', '#000');
now on the page demo.htm, the text will show on index.htm, or a picture (if I call it via img src), but if I have any javascript scripts it will show nothing--not even text. I know 'body' will give me the items/text in the body, but I assume body needs to be replaced with something else to get the srcipt to run. I just have no idea? Any options. I would like to keep the way the page is being calle dinto the frame, I just would like to add some functionality.
A lot of beginner JavaScript tutorials warn that we need to wait for the page to load (or at least the DOM) before we can interact with it. But that's exactly what we do when we put the script at the end of the body tag, as opposed to the head, correct?
I'm trying to get a popup working on my site. I use headers and was wondering if there is a way to put the onload outside of the BODY tag? My header has the BODY tag in it. I only want the popup to come up on one page and not all the pages that use my header.
I have created a page that takes a person to another page automatically:
<body
However, the script waits for the entire page to load before actually taking the person to the other page. What I need to do is to have a script that takes the visitor to the target page as soon as the page appears (without waiting for ads to load completely). How can this be done?
Just wondering if anyone knows if it's bad practice to put multiple body tags within one document? I'm using a template system (php) that loads template files into a main template (already containing a body onLoad()), and the content files also have a body onLoad() preloading functions intact. It seems to be working but wanted to know if there is anything wrong with this? What about broswer specific issues?
I'm working in a template environment, and I can't change the <body onLoad> tag (it already had a muti-use function on it.
On the specific page I'm working on, I need some layer visibilities changed (dependant on a cookie) which seemingly can only can be done in the onLoad event.
so I need to add to or capture the onLoad for one page, and no others with a script included in the body data? (and of course it needs to be cross-broswer compliant 5+)
how can I get the height of the tag body? I mean...I'd like to obtain a value which describes (in pixel) the height of the whole body and not just the height of the window.
I am trying to get the body tag style values. Code: <body style='width: 100%; position: relative; min-height: 100%; top: 0px;'> I would like to get the text 'width: 100%; position: relative; min-height: 100%; top: 0px'
The JavaScript underneath makes _one_ tab bold while the others receive the 'none' CSS property. This works in a frameless page, and has always worked. However, my current project _requires_ me to use frames :-( (leftFrame, topFrame and mainFrame) and when I tested this script in frames, it gave me a "invalid property" error. What can I do? Code:
Is it possible to make a javascript call before "<body onload='...'>"?
What I'm doing is a preview of numerous images in an iframe and I want to resize the iframe to match each picture. Normally I'd use the 'onload' (on the src-page holding the image in the iframe) attrubute, but it's not called until the picture has finished loading. I'd like to resize the iframe before (or at the same time) the image starts loading.
I'm having some trouble with the "onBlur" event in the BODY tag. Ideally, what I want to happen is that when someone leaves window A, window A executes a command. I had put
<body onBlur="savePage();">
I have a couple of problems. On IE 6 (win2000), whenever I put the cursor focus on a textfield within window A, the "savePage" function is invoked. And on Mozilla Filefox 0.9.1, the event never launches even when I leave the window.
Does anyone know how I can solve these respective problems?
Does a contentEditable DIV have the notion of an internal document? I'm trying to convert code that uses an IFrame.contentWindow.document to use the "document" inside a contentEditable DIV but they don't seem to be similar beasts. Eventually I want to add stylesheets to the contentEditable DIV as well as event handling. I'm porting an IFrame editor to a contentEditable DIV based editor.