javascript

input box gets cleared on refresh page : javascript

Hi, I have a javascript function that writes the value of input box to a cookie, then it tells the page to refresh. The page must be refreshed to the server side can reconstruct the page based on the values of the cookies. Output the correct data on the page. However I do not want the user to lose the value they type on the input box...

What is the difference between this.click() and $(this).click() ?

In the end, I have decided that this isn't a problem that I particularly need to fix, however it bothers me that I don't understand why it is happening. Basically, I have some checkboxes, and I only want the users to be able to select a certain number of them. I'm using the code below to achieve that effect. $j( function () { $j(...

Ajax using JS, but WITHOUT XMLhttp AND using the same socket every time?

Is it possible to communicate and update data in a page without reloading, but without using the XMLHttpRequest object, AND sharing the same connection or socket every time (so, without closing the connection for every request)? ...

Javascript - Fastest way to show and hide lots of list items

As the user pans around a Google Map, a list of of currently visible markers is updated. This list contains up to 1000 items, and it slows down when several hundred li's are shown or hidden all at once. It's less than half a second, but it's getting annoying. An array (newLiList) contains the items which should now be visible. Anothe...

Is there a hot key to run the contents of the Firebug Console?

If you're using Firebug (Firefox) and you type in javascript in the Console command line and press enter it executes. However, for good reason, when you expand the command line into a multi-line text area to the right then pressing enter does not execute the code. Instead you have to click Run at the lower left of this window. Is there ...

JavaScript Method results in Non Secure Item IE6

So I am baffled by this one. I have a function that is responsible for a non-secure item warning message to appear when viewing my web page from with IE6 on SSL. If I comment out the entire function the message goes way. If I just comment out the one method call it remains. What is really driving me nuts is if I remove all of the logic f...

changing document.location.href loses the DOM

I have a form where you may press a button which will give you a PDF of the current information on the form. This is done by setting window.location.href to the link to the pdf file. After i do this, none of the javascript works on the page because all form elements have value of undefined. The weird part is that the browser stays o...

Using scroll wheel to zoom in/out

I know this is available in version 2.x of Google Map API. But I couldn't find how to use it in v3, I'm not even sure if it's implemented yet. So I was just wondering if someone had the idea. Thanks. ...

IE innerHTML error

Hi, This is a little different than the questions that have already been asked on this topic! I used that advice to turn a function like this: function foo() { document.getElementById('doc1').innerHTML = '<td>new data</td>'; } into this: function foo() { newdiv = document.createElement('div'); newdiv.innerHTML = '<td>...

IE javascript compatibility is killing me...

I left cross-browser compatiblity issues for last, and it seems IE is going to be a big pain. Nothing is working in IE; First of all, the following is not working: var img = document.createElement("img"); img.setAttribute("height", "270px"); I have an invisible div onmouseover which displays a transparent div "cpanel". I cant access ...

easiest way to open a download window without navigating away from the page

What is the best cross browser way to open a download dialog (lets assume we can set content-disposion:attachment in the headers) without navigating away from the current page, or opening popups, which doesnt work well in IE6. ...

mimic target="_new" for a button

lets say we have a link <a href="/something" target="_new">blah</a> and now i want a button to do the same thing as the link does, without using jquery. does anyone have experience with something like that? edit: This needs to be a link that uses target="_new" because doing that instead of a straight popup is a workaround for some...

How to make a Javascript DropTree

I am trying to determine the best way to create a treeview list in a dropdown. I have found many JS controls of treeview's, but not how to implement in a dropdown list. ...

Can javascript capture image download times in the client?

With javascript event timers, you can relatively easily determine how long it too for the page to render in the browser, especially when using tools like Jiffy. However, is it possible to capture more granular events such as individual image/object download times using javascript in the page? I am fairly sure this is not possible, but wa...

regex matching image url with spaces

I need to match a image url like this: http://site.com/site.com/files/images/img (5).jpg Something like this works fine: .replace(/(http:\/\/([ \S]+\.(jpg|png|gif)))/ig, "<div style=\"background: url($1)\"></div>") Except if I have something like this: http://site.com/site.com/files/audio/audiofile.mp3 http://site.com/site.com/f...

HREF on <a> not being followed in IE8 after onclick event?

On the following page, the orange "Buy Topo Map" link will open a page in IE7 (and Firefox and Safari), but not in IE8. The link is in the top-left. http://www.trailbehind.com/node/1148091/ I am using the following code to create the link: var a = dec('a'); a.className = 'jLink'; a.style.fontWeight = 'bold'; a.style.color = '#CC5500';...

positioning JS popup in Fx

I have the following code that positions a popup under an element. This works properly only if the Fx window is maximized. What do I add to account for window's position relative to the screen, so it works for a window in Normal mode as well? var elm = document.getElementById("back-forward-dropmarker"); var x = elm.boxObject.x; var y = ...

Determine if page is valid in JavaScript - ASP.NET

What is the best way to determine if a form on an ASPX page is valid in JavaScript? I am trying to check the validation of an user control that was opened using the JavaScript window.showModalDialog() and checking the 'Page.IsValid' property on the server side does not work. I am using ASP.NET validation controls for page validation....

Is it possible to embed a SWF in a form using swfobject 2+ in IE6+?

I've been having endless problems embedding a dynamically loaded SWF into a HTML Form within IE 6,7,8 using swfobject.embedSwf. All the proposed manual workarounds for the problem involve creating a reference to the Object DOM element from the window object. For example: window[id] = document.getElementById(id); Where id is the id of...

json array: How to create new array elements?

My aim is to get a json array like this one: var args = [{ name: 'test', value: 1 }, { key: 'test2', value: 2}]; How can I get the below code to build up an array like the above one? this.dependentProperties = []; //array function addDependentProperty(depName, depValue) { dependentProperties.push(new Array(depName, depValue))...