I know how to get the scrollTop of a page, I use this simple JS function (code copied around):
function GetScrolledTop()
{
//I never work in IE quirkmode, I always use DOCTYPE as 1st line, so I don't need to test for document.body.scrollTop
return self['pageYOffset'] || document.documentElement.scrollTop;
}
This works and my p...
I have a page with a dropdown and two textboxes. The javascript code checks to make sure that if the dropdown says Appointment Made or Patient Scheduled, the appropriate text boxes will have dates in them. When the page loads and the drop down shows either of the two above, all works fine but when I change the drop down the script does n...
In the code below, how to get the values of multiselect box in function val() using jquery or javascript.
<script>
function val()
{
//Get values of mutliselect drop down box
}
$(document).ready(function() {
var flag=0;
$('#emp').change(function() {
var sub=$("OPTION:selected", this).val()
if(flag == 1) $('#new_...
Code:
DeCheBX = $('MyDiv').insert(new Element('input', { 'type': 'checkbox', 'id': "Img" + obj[i].Nam, 'value': obj[i].IM, 'onClick': SayHi(id) }));
document.body.appendChild(DeCheBX);
DeImg = $('MyDiv').insert(new Element('img', { 'id': "Imgx" + obj[i].Nam, 'src': obj[i]...
What does 'this' keyword refer to when used in gloabl object?
Let's say for instance we have:
var SomeGlobalObject =
{
rendered: true,
show: function()
{
/*
I should use 'SomeGlobalObject.rendered' below, otherwise it
won't work when called from event scope.
But it works when called f...
Hello,
is there any possible solution, to fadeIn(500) multiple list elements one after the other?
<ul id="list">
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>
Kind Regards,
Werner
...
I ran into a problem in IE8 today (Note that I only need to support IE) that I can't seem to explain: detachEvent wouldn't work when using a named anonymous function handler.
document.getElementById('iframeid').attachEvent("onreadystatechange", function onIframeReadyStateChange() {
if (event.srcElement.readyState != "complete") { ...
How do I default an accordion to be closed on start-up. here is the sample view here
Here is the code:
<script>
$(function() {
$("#accordion").tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide'});
});
</script>
<script>
// add new effect to the tabs
$.tools.tabs.addEffect("slide", function(i, done) {
// 1. upon hiding, t...
How would I go about creating a cross-browser script, that would intercept all events firing on
a page/browser window/DOM-tree (regardless of browser)?
What I'm hoping to accomplish is basically to get a better understanding of the different handling
of events in different browsers; I know the basic theory, but need to see to believe......
Dear expert,
please consider the following problem:
(1) You have assigned an inline event handler to a DOM element, like so <a id="link1" href="..." onclick=" ... ´">
(2) You also assign one or more further event handler(s) to the onclick event of link1 with the DOM2 or IE-specific assignment mechanism.
The verified behavior in FF3.0...
There is an annoying website out there that foils attempts to "open in new tab" by using <div onclick=> instead of <a href=>. I've written a bookmarklet, using jQuery, that creates a wrapper <a> tag and inserts it within the <div> around its content.
How can I remove the original onclick handler?
...
I've got the following HTML
<li><input type="checkbox" /><label>This is the label!</label></li>
I bound a click event to the li, and let the click event bubble up to the li before doing anything else.
$('li').each(function(i){
var item = $(this);
var checkbox = $("input[type='checkbox']", item);
item.bind('click', function(e){...
I'm working on a Javascript class based on the Prototype library. This class needs to observe an event to perform a drag operation (the current drag-drop controls aren't right for this situation), but I'm having problems making it stop observing the events.
Here's a sample that causes this problem:
var TestClass = Class.create({
in...
(I posted this on the jQuery forums but it's still awaiting moderation, so I thought I'd try my luck here since Stack Overflow is so awesome. If I get an answer I'll post it here.)
I have a couple of links on my page (inside a <div id="theme-selector">) which allow you to change the CSS stylesheets:
$('#theme-selector a').click(functio...
Does anyone know how to get the blur event to fire on the document for the iPhone?
I'm trying to get it to fire either when a user changes windows in Safari, or when they open their bookmarks or when they decide to add the page to their homescreen. But none of these are firing it.
Here's my code:
$(document).blur( function () { ...
What's the best way to execute a function exactly once every time a button is clicked, regardless of click speed and browser?
Simply binding a "click" handler works perfectly in all browsers except IE.
In IE, when the user clicks too fast, only "dblclick" fires, so the "click" handler is never executed. Other browsers trigger both eve...
Hi there. I am writing a WWW application, it has to run under IE. I have the problem with the code that runs under FF, but i can't get it running under IE.
// JS code
function test()
{
if (window.event.keyCode == 13)
window.location.assign("myPage.php");
}
I've tried some similar ways around window.location and location.h...
Is there a simple way in jQuery to detect when scrollbars appear and disappear on a div that has overflow:auto? (Like an event? Fingers crossed...)
(I'd prefer not to have to look at the height of the content of the div)
Thanks!
...
In the following link
<a href=\"#\" onclick=javascript:print(\"\") style=\"color:blue;\">Print</a>"
<script>
function print()
{
//How to print the contents of another page
}
...
How assure the closing of the window in the firefox with window.close command?
...