I want to close a popup-window with the onBlur eventHandler. function closeIt() { setTimeout('window.close()',2000); } <body onBlur="closeIt()"> html </body>
There is a form on my page, and when a input-field gets focus, body looses focus and the window closes. That's not what I want. I want to close the window, if focus goes to another window or application, but not when someone tries to fill that form.
I have a HTML and I am opening another link in a separate window using window.open() . The child window is something like 'http://yahoo.com' which is out side html. I need to refresh the parent window when the child window is closed.
I want to make a nice floating bar at the bottom of the screen, which hovers about 15px from the bottom. I am doing this to make a site look good in small and big resolutions. The minimum height for the bar to hover is 600px about, if the window is smaller, it is still there so it doesn't go into the content, if the window is bigger, it will follow the resize and be at the bottom still. It is obviously absolutely positioned, and also centered using some javascript (getting the width of the window).The second function is called in the header and positions the bar. The last two document.get things are just for testing so I can see the height in px somewhere. This works fine in IE. If I resize the window, making it shorter, everything goes as planned, and I can see the pixel count dropping in the header where it is displayed. However, in FF it does not work.
The weird thing is this. If I resize by a small amount, less than 10px, it works fine. However, I can not resize by more than 10px! If I do, the window height shown in the top still drops by only 10px.So if my window is 1000px tall, and I close it to say 500px, the value of the height will still be 990px. If I then resize it to any where higher than the 500px, say 550px, the javascript still sees it as making it smaller, since it says the height is 990px, therefore, the window height goes down to 980px. If I shrink the window to 500px and reload everything is fine, if I make it bigger, it works in both browsers. I am thinking that this could be a problem which is like "sampling rate" in music. When in IE I expand or shrink the window I can see the pixel count drop continuously and the bar floating down as I move the window, as if it was "sampled" every 0.05 seconds or something. In FF, shrinking is not working, but if I expand the window the pixel count doesn't change and the bar doesn't change place until I stop resizing (let go of the mouse button), as if it was sampled once, when I stop, so the problem maybe is related?
I am attempting to modify the style of an element (its width) as the window is being resized, in firefox.
Long story short, I've tried to use CSS but one particular part of the layout just won't do what I need.
The javascript solution assigns a function to window.onresize that sets the inline style, it works with one problem -- the handler only gets called after the resizing stops, and so there is noticeable lag before it redraws.
It is not the function that is taking a long time to execute, its appears to be firefox's handling. It doesn't call it as frequently as I expected.
Is there another javascript method to accomplish this without the extra lag?
I'm listening for the window.onresize event and trying to get the document.body.clientWidth afterwards to make sure a wide block fits onscreen. I'm working in Firefox and the thing is, when a scrollbar is added to the page due to content getting longer, the body.clientWidth gets smaller, but the window.onresize doesn't fire (I guess this makes sense as the window hasn't been resized per se).
I am assuming that I will have to check the body.clientWidth manually after the content gets longer and then call my resize function if so. But is there a way to achieve this or watch body.clientWidth other than window.onresize?
The window.onresize is not called (in Mozilla) when changing the text size on the browser (crtl + or View/Text Zoom).
Is the xAddEventListener function usefull ? What does the "For some browsers the window.onscroll and window.onresize events are simulated." mean ?(found in the X Library function reference).
I have a TabContainer on my page, and I want to add a keyup handler to the textbox, but somehow I counldn't find the textbox in my jquery function using $('#TabContainer1_TabPanel1_TextBox1'). Here is my code:
Normally, when I use .post in an event handler, "this" refers to the object that triggered the event. That doesn't happen in this case. When I use "this" the first time, to pull data parameters, it refers to the .trigger_button. But inside the .post callback, it refers to the AJAX call object instead. I don't think that's how it's supposed to work, is it? Is this a bug?
i am using popupwindow.document.write(html_text); all the html of the pop-up goes into html_text.how can i build a function inside the html_text that can be called within the popup window?
I have an HTML page where I am opening a child window using window.open. the child window is something like yahoo.com. I want to refresh the parent window when the child window is closed.
How do I pass a PHP variable into a window.onload event function? I have a URL that I need to pass to the JavaScript file that has this function in it. The JavaScript file itself is being linked from the PHP file that will pass the variable and I've seen many examples of how this is done via embedded JavaScript, but none where someone is linking to an external JavaScript file. I suppose this is probably a trivial matter to most of you, but I've never done this before and could use some guidance!
I try to add a function to be triggered also within an event (which already has a function). I coded it, unfortunatelly one line of the code should be different for IE and Moz. I try to find a common way without using a browser detector... Any ideea? The red line works for Mozilla, the blue one for IE:
function addFunc(){ var e = document.getElementsByTagName('*'); for(var i=0;i<e.length;i++){ if(e[i].getAttribute('onclick')||e[i].getAttribute('onclick')!=null){// Moz || IE //var f = new Function(e[i].getAttribute('onclick')); var f = e[i].getAttribute('onclick'); e[i].onclick=function(){f();otherFunction()} }}} Code:
I need to know how to add an event to a button. The specific issue is that I want to add an event which is a prototype function of a class. Consider the following as an example:
I have created and opened a child window called "checkwin" and have written some data to it. If the data is valid, I want the user to click on the 'CONFIRM' button on the child window, at which time I want the "submit()" function for the form on the parent window to be executed. If the data is invalid the user clicks on 'MODIFY' and I want focus to return to a field on the parent form. However, when I click on the "CONFIRM" or "MODIFY" buttons on the child window, nothing happens. Here is the code:
Is it possible to set an html element's (created through HTML DOM's createElement() method) 'onclick' attribute's value to a Javascript function which requires a parameter, passing a variable to it at the same time?
I have the following Javascript code:
var parentDiv = document.getElementById("subscribers"); var stubSpan = document.createElement("span"); stubSpan.id = "opentok_subscriber_" + stream.streamId; stubSpan.onclick = showStreamInFullScreenMode(stream); parentDiv.appendChild(stubSpan);
'stream' in the bolded line is a parameter variable of the function that the above code is in, and I'm trying to pass it to another function using an onclick event.
I am trying to set a div width through the onresize event. For some reason, I am able to set the height ok. When setting the width, it will set once and then both the height and the width will not respond to the onresize event anymore. I basically want the div to resize whenever the browser is resized.
To demonstrate what I mean, copy and paste this code into a htm file. Add long strings of text to the div so that it will scroll both horizontally and vertically. Notice when resizing, the resize will get called once, but when resizing again it will not. Comment out the width line, and now the resizing will always get called.
Danged if I can find the thread, but I swear I saw a $.url() reference in here a day or two ago. It was beingutilized for parsing out the window.location or window.location.search parameters. I made a mental note because that was something I would be needing to do.
Now I can't find it, either because the search isn't finding it or I was dreaming about this function existing.
I rummaged about the API docs and didn't find it there either. Is it something provided by one of the plugins and not a function native to jQuery?
This is something that i came up with a while back, but never got around to putting up. when you resize a window, you don't get the same result across different browsers because of different chrome sizes. the way around this, is to resize your window based on the visible document area. this function does that.
this should work in IE4+ and NS4+. i've tested it in IE5+, and Moz 1+
<SCRIPT><!-- self.resizeIn = function(new_w, new_h) { var old_w = self.innerWidth || document.body.offsetWidth; var old_h = self.innerHeight || document.body.offsetHeight; if (!new_w) { new_w = old_w; } if (!new_h) { new_h = old_h; } new_w -= old_w; new_h -= old_h;