javascript

Is there any solution to disable Javascript style changes in print?

Is there any solution to disable Javascript style changes in print? For instance, if I'm hiding something through Javascript but I want to include that hidden info in print. I hid a div using Javascript and I want to show that div if Javascript is disabled. Now the problem is, because div is hidden using Javascript it's also not showin...

universal javascript for set homepage functionality

Is there any javascript that works on almost all browsers for setting a webpage as homepage? I am using below one. But it only works for i.e. and mozilla var flag = false; function setHomepage(web) { if (document.all) { document.body.style.behavior='url(#default#homepage)'; document.b...

Function "is not defined"

Hi I have this code <script type="text/javascript" src="http://www.google.com/jsapi"&gt;&lt;/script&gt; <script type="text/javascript"> google.load("maps", "3", {other_params:"sensor=false"}); google.load("jquery", "1.3.2"); google.load("visualization", "1", {packages: ["columnchart"]}); ...

How do i use reconfigure in extjs ?

Hi , i have two Ext.grid.GridPanel but i have reconfigure from one to another. How do i use reconfigure in Extjs . Ext.reg('printsuppliers1', supplierlist1.Grid); Ext.reg('printsuppliers2', supplierlist2.Grid); here supplierlist1 has an actionlistner added say 'click' so when this actionlistener is invoked i want to reconfigure su...

Best practice for trapping certain keyCodes in onkeypress in Javascript

I'm somewhat curious about the "best practices" when it comes to trapping the ENTER key in an html input tag. In IE, it's easy. window.event.keyCode will be 13 when enter is pressed and it's pretty straight forward. In all other browsers, an arguments object is passed into the function. However, this seems to basically force you to l...

Convert MySql DateTime stamp into JavaScript's Date format

Does anyone know how I can take a mysql datetime stamp, such as YYYY-MM-DD HH:MM:SS and either parse it or convert it to work in JavaScript's Date() function, such as.. Date('YYYY, MM, DD, HH, MM, SS); Thank you! ...

Scripts added via jQuery not visible in FireBug

I am adding <script type="text/javascript" src="http://somedomain/somescript.js"&gt; to the document head via jQuery. This is the code I use: $(document).ready(function () { var s = document.createElement("script"); s.type = "text/javascript"; s.src = (document.location.protocol == "https:" ? "https://ssl" : "http://www") + ...

reading optional attributes from optional setting in javascript

What is the most efficient way of reading optional attributes in an optional setting argument. I'm using something like: f = func(var1, optionalsettings) { var2 = (optionalsettings === undefined ? 0 : (optionalsettings['var2'] == null ? 0 : optionalsettings['var2'])); }; But I've the feeling it can be done more efficient...

Preloader for dynamic content

Hello, I have dynamic page which takes about 8 seconds to load searched data. Problem is, all browsers remain on old page for those 8 secs & show dynamic page only after it loads completely. What I want is preloder image to be shown to the customers until second page gets load. How can I achieve this? Thanks ...

validating internet address in javascript

Possible Duplicate: how can i validate a url in javascript using regular expression I want to validate whether user input a valid internet adress like www.hotmail.com http://www.abc.com.pk ...

XMLHttpRequest not working with http

Below code is working properly now. But if I replace 'text.txt' with 'http://google.com' isn't showing anything, nor displaying an error. What am I doing wrong? I need this code to get content of an url to a string, on client side. Thakns. <script type="text/javascript"> var webUrl = 'text.txt'; var queryString = ''; var xmlText = g...

Javascript Closure and DOM Builder

I am making a DOM builder which I have working succesfully but now I am trying to assign some shorthand functions so that div() -> e("div") Here is my code: //assign these objects to a namespace, defaults to window (function(parent) { /** * Creates string of element * @param tag The element to add * @param options An object of attribu...

Indicate word wrap in textarea.

I have textarea with rows="50" and cols="15". I want when it's going to wrap the words to simulate enter pressing,because I check when the user goes to new row with keydown and e.which==13 ,but the word wrap prevents me to check this. edit: Because I want to try to make something like online editor ,and I dynamicly count the rows like Be...

Binding class method to event in google maps v3?

In V2 of the Google Maps API, you could bind map events to a class method using the GEvent.bind function: GEvent.bind(this.drag_marker, "dragstart", this, this.start_dragging_route); In the example above pretend that's a link from a prototype.init function, where start_dragging_route is a method inside the class. It appears that the ...

Why is my for loop stopping after 5 iterations? (in function hello())

<script language="javascript"> function hello() { var selectproducto = document.getElementById("producto"); var totalproducto = document.getElementById("producto").length; var selectmanufacturero = document.getElementById("manufacturero"); var chosenoption = selectmanufacturero.options[selectmanufacturero.selectedIndex].ge...

Circular Progress Indicator in Javascript

Hello, I have a simple carousel to display some images. As you would expect the carousel auto rotates every x seconds. I currently have a div which I animate the width over the x seconds to show progress. This allows users to see how long they have to wait until the next image is displayed. When a user hovers over the image, the progr...

Tree like view for xml in web browser

I have xml data(file or text) sent to client from web server. The xml has tags only (no attributes). Actually I am using it to represent a tree. On client side I need to render it as a tree and let client select multiple nodes in tree and submit it back to web server. Are there any useful resources out there I can use ? ...

Accessing class member variables inside an event handler in Javascript

I have a quick question regarding the proper way to access Javascript class member variables from inside of an event handler that class uses. For example: function Map() { this.x = 0; this.y = 0; $("body").mousemove( function(event) { this.x = event.pageX; // Is not able to access Map's member variable "x" ...

Is there a cross-browser solution for getSelection()?

I need to make a comment mechanism in which user highlights a piece of text, clicks "comment this", and then does something. The Javascript code has to know not only the selected text (this is trivial), but also the anchorOffset, to know exactly from which to which character the text was selected. I've found a cross-browser solution tha...

Asp.Net MVC Combine and remove inline scripts during response.

I have been doing some performance analysis on a few websites I am working on and I am noticing that a big problem is the inline scripts. For the external scrips I wrote an http handler which combines, minifies, and gzips the javascript into one file. This is then stored for reuse later by hashing the filenames. What I am wondering (...