javascript

JQuery help, How to Hide all button in JQuery

Hi guys, I'm trying to make a request/reply section in my project. I want to achieve these functionality in that code (that I'm not able to implement; so guys please help me out): 1> When user click on reply button; other reply area(text-area +button) should be hide (means at a time only one reply area should be visible to the user). 2> ...

Force page reload with html anchors (#) - HTML & JS

Say I'm on a page called /example#myanchor1 where myanchor is an anchor in the page. I'd like to link to /example#myanchor2, but force the page to reload while doing so. The reason is that I run js to detect the anchor from the url at the page load. The problem [normally expected behavior] here though, is that the browser just sends me ...

How to set fixed width for columns of a table with expand/collapse functionality?

I have a table with expand/collapse functionality. How do I enforce fixed width for columns in such a table? I used COL tags with width property. But the table becomes distorted when I expand/collapse the rows. ...

Why can't I use the return from an insertAfter as a regular jQuery object?

I'm trying to insert a link after form elements to clear them. This demo code with headings doesn't work: h2 = $('h2'); clickytest = $('<a href="#" class="clicky">click me</a>').insertAfter(h2).click(function() { $(this).append('foo'); }); But this does: h2 = $('h2'); clickytest = $('<a href="#" class="clicky">click me</a>').inser...

Appending javascript code piece to the end of the body tag

I am looking for a way to insert javascript code block to end of ASP.NET page. Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "showVideo", sScript, true); is appending to body but js codes are always requesting some js files didn't load or some functions are below of the script. How can i append scripts that i generated dy...

Javascript hasOwnProperty does not work under Google Chrome

I am currently working on a project with some help and it has been going well, until this incident. function runCommand(commandString) { commands = new Object(); commands.clear = function(){ $('#terminal').html('') } parameters = commandString.split(" "); command = parameters.shift(); if( commands.hasOwnProperty(comm...

Use JS to add characters into textfield

I want to add a $ symbol before a users entry into a text field without actually submitting the $ when the user clicks submit. Additionally, I need to prohibit the user from entering anything but numerical values in to the text input. I know about the JQuery input mask (http://www.conetrees.com/2009/03/blog/jquery-masked-input-plugin-inc...

Change cursor to loading animation

Hey, I've got a few loading bars that appear during any postbacks. How can I use CSS to have the cursor change into a custom loading animation? In examples I've come across, I can only turn the cursor into other preset images (such as an hourglass). Is it possible for me to use a custom gif as the cursor? Thanks ...

How to get a reference for Gmail Inbox button?

Hello, I want to get a reference to the Gmail Inbox button in Javascript? I tried my code in Firebug console but could not manage to find the right DOM node. ...

getting part of an image with javascript

Hi all, i want to ask that, is it possible to show any part of image in img tag (with pixels) via Javascript. I mean, i'll prepare a big image (e.g. 32x320 pixels) and i'll define starting position (X,Y , e.g. 0,32) and width/height (e.g. 32,32), so script will show second (32x32 pixel) part of main image.. I hope i can explain. Thanks r...

Problem with adjacent function in prototype

Hi, I have this code: <input name="rz" class="required validate-string" style="margin-left:17px" id="rz" title="Input rz value" size="23" /> <p class="msg" style="display:none;">Input rz value</p> In the head I have: Event.observe(window, 'load', function() { $$("input").each(function(field){ Event.observe(field, "focus", fun...

Trouble defining method for Javascript class definition.

I'm somewhat new to object oriented programming in Javascript and I'm trying to build a handler object and library for a list of items I get back from an API call. Ideally, I'd like the library functions to be members of the handler class. I'm having trouble getting my class method to work however. I defined as part of the class bcObj...

AJAX problem-onreadystate does not work

I am having a problem where my AJAX code does not get past the onreadtstate. The if( XMLHttpRequestObject) works fine, but the other part does not. The code is below: enter code here function //Get the Ajax Object getXmlHttpRequestObject() { if (window.XMLHttpRequest && !(window.ActiveXObject)) { XMLHttpRequestObject= new XMLHt...

JS Display Content based on Dropdown User input

I am working on a search box that displays different options based on a users selection via dropdown box. Basically I need a really clean, light-weight method for switching out different divs without reloading the page. Im new to JS, but I know enough that there should be some really simple way of setting the display property using JS - ...

Ajax Javascript method cannot be called

I made this method to load JavaScript functions dynamically. It does include the .js file, but when I call a method, the method says that it is undefined. The following two .js files are ajax_object.js and user_manager.js. The alert outside the function is read and works, but the alert inside does not. enter code here //ajax_object.js ...

Possible to modify DOM during/before initial DOM parsing?

Is it possible to modify the DOM during or before the initial DOM parsing? Or do I have to wait until the DOM is parsed and built before interacting with it? More specifically, is it possible to hinder a script element in DOM from running using userscripts/content scripts or similar in chrome or firefox? Tried using eventListeners on DO...

Refactoring a javascript array rotate function

I wrote a rotate function, but I'm not satisfied with it: var pixels=['011','110','000']; var result=new Array(); result=['000','000','000']; var r = {x:1,y:1}; //rotating point var clock = true; //clock or counter-clock rotation for ( y=0; y<(pixels.length); y++ ){ for ( x=0; x<(pixels.length); x++ ){ var newx=0,newy=0; if ...

How can i open Thickbox from a form and feed it with data ?

I have a simple search php script, within that script there is some html and javascript to make a search input field and a button. What i am trying to do is when someone enters a search, and presses submit, thickbox opens, and the results will be displayed in the thickbox. What i have so far is the search field and button, when i press ...

48-bit bitwise operations in Javascript?

I've been given the task of porting Java's Java.util.Random() to JavaScript, and I've run across a huge performance hit/inaccuracy using bitwise operators in Javascript on sufficiently large numbers. Some cursory research states that "bitwise operators in JavaScript are inherently slow," because internally it appears that JavaScript will...

fullcalendar, how to limit the number of events per day in the month view

I have many events on a day, and it works as expected but now looking at the month view, my calendar grid is much taller that expected. I'd like to hide some of these events from the month view, like a summary with a visual que that there are more on this day than can be shown. I can use eventRender and return false, but i would like t...