javascript

How do I disable "compatability mode" in IE8 for my website?

When users go on my website, I want to force them to use IE8 non-compatability mode. If they use compatibility mode, my website doesn't work. How to force it off? Is it a meta tag? Edit: Yes, you can do it. Solution is this: <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /> ...

Restart Apache Tomcat to serve changed Javascript files?

I was under the impression that if I deployed my application (using Ant) then JS files, along with HTML, CSS and images, would be automatically served by Tomcat. However, after editing Javascript files I have to restart Tomcat in order for the changes to be updated. My JS files are in a 'js' directory off of root (not in WEB-INF). I a...

Is obsfucation worthwhile?

Does it make sense to obsfucate Javascript? The only clear benefits I can see are to hide code (albeit non-proprietary in nature since it's client-side) from prying eyes and as a minimizer since often Javascript obsfucators do minimization as well. ...

Framework/libraries for a browser-based game

I am currently half-decided to use Kohana + Zend as needed for the PHP part. What I would need next is an excellent base for JavaScript code. There are a bazillion of contenders here and choosing isn't exactly as easy as with PHP. I would need practically everything from form posting and retrieving results to skinnable widgets and anima...

How to detect ndash entity embedded in a textarea using Javascript?

I have a textarea within an HTML page into which my users paste content. There is often an "" (&ndash;)(\x2013) embedded in that content. I need to detect and replace it and store it in a database as &ndash;. My code document.getElementById("input").value.replace("-", "&ndash;"); only detects the "-" (minus sign)(\x2D). What would be...

Parsing javascript date string to timestamp. the tz info is in the date!

I have to parse a javascript date string to a timestamp. If the date string has the TZ info, why do I have to supply a TZ object in the DateTime constructor and again with setTimezone()? Is there an easier way to do this that is aware of the TZ info in the date? $s = 'Thu Mar 11 2010 13:00:00 GMT-0500 (EST)'; $dt_obj = new DateTime($s, ...

How can you bubble up errors so they can be caught in the same try/catch block?

I've got an object with functions that throw errors, myObj = { ini:function(){ this.f(); }, f:function(){ throw new Error(); } }; but I only want to catch the exceptions where the object is created try{ var o = new myObj(); }catch(err){ alert("error!"); } it looks like i have to have try/catch blocks everywhere ...

javascript alternating color rows of tables

I have a page with several tables on it with the same class name. I want to alternate the colors of the rows of every table on this page. I'm using the code below with . This code isn't working correctly, because only 1 table is alternating colors at a time (the first table). what am I doing wrong? All the tables on my page has "myt...

[ASP.NET] Server variables and the .js file. Is it possible ?

Hi, is it possible to invoke server variables in the external .js file ? [Edit] OK, I resolved the problem, thank for Your help ! :) ...

HTML5 Cache manifest file itself is not cached, and called at each resource load

We have a web app that runs on the iPhone.The manifest file is ok, and the resources(html, css, js) are cached correctly.The page sits in the home screen. The trouble is, when the page loads a resource from the cache, there is as well a GET call to the server to read the Cache Manifest file.The server is configured to send the correct h...

Position div at mouse

I have a floating DIV with dynamic content like this <div id="rollover" style="display:none;background:#ffff99;width:150px;position:absolute;z-index:9999"> <div id="rollover_content" style="padding:4px;border:1px solid"></div> </div> Event handlers fetch relevant content and set the innerHTML of the inner DIV. How can I position t...

What Javascript function is used to check for a certain browser plugin?

What Javascript function is used to check for a certain plugin? Such as for Silverlight, Flash, Quake Live, Real Player... ...

Is there a way to control execution of scripts loaded via JasonP?

I recently ran into a few problems with a third party vendor integration. In order to get a piece of data from them I had to do a cross-domain request, which we implemented using Jason (via jQuery.getScript()). My concern is that this is equivalent to throwing a script tag with the URL as the source and I have no chance to wrap a try/c...

drop down menu float Visible over UI CONTROL like TEXTBOX, select boxes, and iframes

Hi Issue is Menu is not overlaping or float, above the IFrame i am design the menu with table and Div tag in Usercontrol From and i called Usercontrol from in the Index.aspx. If any got the idea or experience to solve this issue please help me Thanks for Time and help Hari ...

Need to have fade out effect in Javascript

Hi, I am doing an Ajax call and on response I would like to hide a div. Right now, I am able to do it successfully, but that is kind of quick. I want some fade out effect on it. How to do it in one single shot? Here is my current code. var someDiv = document.getElementById(someId); someDiv.style.display="none"; Thank you very much i...

Don't submit form unless JavaScript is enabled

I have a basic form that I'm using for member registration. I'm using the form onsubmit event to populate a hidden form field based on some of the form's fields. It's working great, but I'd like to prevent the form from submitting if javascript is NOT enabled. This will ensure that the hidden field gets properly populated on the clien...

Do HTML5 custom data attributes “work” in IE 6?

Custom data attributes: http://dev.w3.org/html5/spec/Overview.html#embedding-custom-non-visible-data When I say “work”, I mean, if I’ve got HTML like this: <div id="geoff" data-geoff="geoff de geoff"> will the following JavaScript: var geoff = document.getElementById('geoff'); alert(geoff.dataGeoff); produce, in IE 6, an alert wit...

How call c# method in javascript

Hi, I need call codeBehind method named RebinData() in a javaScript function How I do it ?? Regards ...

Can't set data property of an HTML object element with javascript

The following works in current Firefox (PDF loads), but not in current IE (page is blank). Any suggestions? <head> <script type="text/javascript"> function startup() { var bubba = document.getElementById('bubba'); bubba.data = 'http://server.qa/test.pdf'; } </script> </head> <body onload=...

jQuery Div Animation - Show w/ URL

I have Divs show and hide (with an animation) using the following script (I included the jQuery library) <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function ShowHide(){ $("#info").animate({"height": "toggle"}, { duration: 1000 });...