javascript

Why do browsers still allow Javascript to see cookies?

I'm sure there's still plenty of sites out there that, for some inexplicable reason, use Javascript to manipulate cookies, but there's really no good reason to allow this in light of all the XSS that can occur. Why do browsers still allow this? Why not simply prevent JS from seeing cookies? ...

What's the best way of passing a .NET System.DateTime using JSON so that cient-side javascript can construct a javascript Date object?

I'm building the JSON string "by hand" server-side. Should I Convert.ToString(System.DateTime.Milliseconds) on the server-side and use javascript Date.setTime(milliseconds) on the client side? ...

weird javascript/jquery behavior

Possible Duplicate: Why dont self-closing script tags work? I had this bit of javascript code inside a <head> element. <script src="jquery-1.3.2.js" type="text/javascript" /> <script type="text/javascript"> $(document).ready(function() { $("#welcome").addClass("centered"); $("#created").addClass("centered")...

Need sample java to query mysql and dispay result upon combo box update

I have a combo box that will be loaded with a list of choices. When the user selects a choice, I need a javascript to simply run a query of mysql (obviously based on the user choice in the combo box) which will return a simple, discrete value that then needs to be displayed on the page next to the combo box. The query is nothing more t...

How do I "quietly" reload a page from a Greasemonkey script?

I want to reload a page so that it does not cause the effects of a full-page refresh, like displaying "Loading..." on the page's tab. Here's the code I have so far. My theory was that I could overwrite the body section with a <frame>-wrapped version of the updated site, gotten via GM_xmlhttpRequest. reloader.js setInterval(reload, 10...

change image size with javascript

Hey, I'm trying to change the size of an image with javascript. The jS file is separate from the html page. I want to set the height and width of an image in the JS file. Any good ways on doing this? Thanks for any help. ...

jQuery - Scripts slow to apply in IE6: Can anything be done?

The answer is probably no, but in IE6, jQuery is slow to apply the jQueryUI accordion control, meaning the unstyled links behind the accordion are visible for probably a quarter to a half of a second before the accordion styling applies. This is highly distracting, so I went ahead and hid the div and had jQuery unhide it when it loads. ...

Running a PHP through Ajax on Unload

I'm trying to have a php script run when the user navigates away from the page. This is what I'm using currently: function unload(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ...

JavaScript/VBScript SQL Database

I need information on JavaScript/VBScript with SQL database. I'm currently doing scripting. My problem is, in scripting, how to connect and insert some data to a MySQL database. I did find something mentioning on client/server side database. Do I need to consider that also? I'm not building the application for the Web services. ...

Multi line js regex replacement in Internet explorer

I'm trying to replace something multi line in Javascript, IE is giving me trouble. pastebin here:http://jsbin.com/olahi/edit Explanation of what I'm trying to do: Here's my HTML: <textarea id="editthis"> Hello from JS Bin Whats up from JS Bin Whats up from JS Bin </textarea > And my JS: jQuery.fn.runReplacement= function(expr) { ...

traversing dom in jquery?

I have code similar to the following: <div class="class1"> <a class="link1" src="...">...</a> </div> <div class="class2"> <a class="link2" src="...">...</a> </div> Assuming I am currently in the click event for class link2, how do do I get the src value of the link1 hyperlink? These are dynamically generated so there may be m...

refresh single cell in yui datatable

I am using a yui datatable to show tabular data with certain fields that update in real timee. All examples I've seen require that the entire table be re-drawn even if only one column of data has been changed. Obviously this causes problems with both client-side sorting and scrolling and adversely affects UI performance as well. Is th...

using jquery to get the 'src' of an image link?

Say i have the following: <a class="class1"><img src=".." /></a> If I am currently in the click event of a.class1, how to I pull the 'src' value of the 'img'? Update: for some reason neither of the suggestions below worked. My code looks like this: $("a.class1").click( function() { alert($(this).children('img').attr('src')); ...

disable all the elements in html.

How can we disable all the elements in html through javascript.The easiest way... ...

Close a window on button click

How to close a tab or window by clicking on a button in JQuery? I tried window.close() thinking that it would close that window,but it doesn't seem to work. Someone help me. <?php echo $javascript->link('jquery');?> <script type="java/javascript"> $(document).ready(function(){ $(".close").click(function(){ window.close(); }...

javascript css framework

Which is the best open source javascript css framework to implement? ...

how to create a window focus hook

I have the page with iframe (having java applet), now I want to monitor where the focus is from the parent page. Is it possible to check whether Java applet was closed (inside iframe) by monitoring which frame/page has the keyboard focus? ...

What's the best way to allow the browser to fall back to a link if JavaScript is turned off or disabled?

I want to add some Ajax sorting options to a list. Since my site runs without JavaScript thus far I'd like to keep it running for people with it turned off, old/mobile browsers or noscript. How can I run a block of JavaScript when clicking a link if JavaScript is enabled and have that link direct the browser to a new page if it's not. I...

Regular expression in JavaScript - Replace Image src attribute

In JavaScript I have a string containing a DOM fragment. How would I find and replace the src attribute of an image? I would like to replace the path of all images with a new path but keeping the image name. Not all the paths are the same and can come from various locations. My regular expression skills are poor at best. For example: ...

Bookmarklet - grabbing videos from other sites

Hi I want to grab videos from other sites (youtube.com, vimeo.com) via bookmarklet. I have created bookmarklet. It works for "selectd text" and "images" but how to do with videos? Any Idea? Thanks in Advance. ...