javascript

What's the most efficient way to hide content for a mobile version of a site?

I'm working on a mobile version of a large site. There's a lot of content from the full site that's not needed for mobile. What is the best way to hide this? i.e. What will cause the least amount of work for the browser, so it stays responsive? CSS display:none jQuery's .remove() method, for example (not tested): var elements_to_rem...

javascript checking path already exists

how would i check if the file path already exists in javascript ...

This works in Chrome but not IE, why?

var shell = function (method) { window[method].apply(null, Array.prototype.slice.call(arguments, 1)); }; shell('alert', 'monkey!'); ...

Prototype: add/remove input element

I'm creating file(images) upload form. I want to add input elements by clicking on button. This is my input: <input type="file" name="file"/> I've alerady write some code: <script language="javascript"> fields = 0; function addInput() { if (fields < 10) { document.getElementById('text').innerHTML += "<input type="file" name...

How to display dynamic columns in richfaces datatable

Hello, I am currently trying to come up with the best way to create dynamic columns in a data table using richfaces and was wondering if maybe some out there has done this before or could point me in the right direction. Basically I would like to click some kind of add button and another identical column with input fields appears below ...

how to find the the system regional time zone name by java script

Hi i have a typical requirement in my web application, i have to fill a dropdown box with all system timezones and set the selected time zone where from the client is browsing. Only timezoneoffset is not enough to handle this suituation, since there are two reasons 1.the latest OS having more than one time zone with the same offset 2.If...

Form submitted twice in Chrome/Safari

Dear Stackoverflow, I am seeking to perform a basic form post, but the following submits to the server twice in Chrome and Safari (but behaves as expected in Firefox): <form id="create-deck-form" action="/decks/create" method="post"> <fieldset> <legend>Create new deck</legend> <label for="deck-name-field">Name</label> <in...

jQuery - move to a specific element location

Hi I have a pagination system like this: [content] 1 2 3 Next > when you click on 1/2/3/next the [content] element gets replaced trough ajax. the problem is that the screen focus moves up if the new height of the [content] is larger than the previous one. can I force the screen to stay focused where where the pagination links are? ...

javascript video canvas

I am testing out canvas and video and I have read up on alot of examples, but I am running into a slight problem when I press the play button on the video canvas doesn't play the video as well it just shows a snapshot. I can not figure out why it doesn't play simultaneously. Here is my code in javascript. function draw() { var ctx3 = d...

Why can't Javascript (running in Rhino) access methods on a java.lang.reflect.Method instance?

Here's a very simple example of what I see: jrunscript -f - js> var d = new java.util.Date(); js> var m = d.getClass().getMethods(); js> println(m[0].getClass().getName()); java.lang.reflect.Method js> var name = m[0].getName(); script error: sun.org.mozilla.javascript.internal.WrappedException: Wrapped java.lang.UnsupportedOperationExc...

Which .NET controls don't use javascript to handle events?

I noticed that the asp:Button for example will work without javascript enabled in the browser. However any other control with an "OnClick" or "OnServerClick" event must use the javascript_doPostback. Are there any controls besides the Button that don't need to use javascript? I want to know because I want to be able to style the ...

Creating an imageslider using javascript

I want to create a imageslider using javascript. I have found this script. But I can't find tooltip in this. I want to do exactly like in this website. I would appreciate any help. ...

onclick disable submit button

hi, i wanna disable a submit button when onclick. im able to disable the button but i cant submit the post value to php. ...

problem with "Button" and ":button" selectors

Hello, I am new to Jquery and in learning phase. I have written a test program in it. <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("Button").click(function(){ $(this).parents(".ex...

optimizing jQuery Selectors - Which is faster?

Are selectors or functions faster in jQuery? Example: $('#something div.else'); // find multiple divs with class .else or $('#something').children('div.else'); I'm trying my best to optimize a page with hundreds of returned elements that seems to hang on a certain crappy computer here in the office (that must use Internet Explore...

Adding !important within a dynamically written stylesheet for Internet Explorer

I have been experimenting with using javascript to dynamically write stylesheets. In Firefox, one can use the setProperty method on the style for the cssRules of the styleSheets, like... document.styleSheets[0].cssRules[0].style .setProperty(propertyName, propertyValue, 'important'); ...to set the !important flag on the style. I hav...

Finding next element of a specific class inside a parent jQuery

I have the following: <div class="container"> Test 1 <div class="child">Testing</div> </div> <div class="container"> Test 2 <div class="child">Testing</div> </div> <div class="container"> Test 3 <div class="child">Testing</div> </div> I wish to have the child div inside the container thats hovered over to show and hide when the mous...

Get url for the page being opened next in window.onunload event

Hi, Is there a way get the location for page being opened next in the window.onunload event. Best Regards, Keshav ...

JavaScript - best way to add an event to an element without a library or using the onclick attribute?

So I want an element i.e: <a id="target">click me</a> to perform a JavaScript function i.e: functionName(); I want to avoid using the "on" attributes i.e: onclick="". By cross-browser I mean the A-grade browser compatibility list from YUI ...

how to prevent hacking if users change html/javascript variables on client side ?

Using a simple tool like FireBug, anyone can change javascript parameters on the client side. If anyone take time and study your application for a while, they can learn how to change JS parameters resulting in hacking your site. For example, a simple user can delete entities which they see but are not allowed to change. I know a good de...