javascript

Embedded Youtube videos slowwww things down

I'm creating a site with a lot of embedded Youtube videos, but it seems the video players take a while to load. Is there a way I could speed things up? If this is not possible, then how do you embed just the thumbnails and load the videos when a user clicks on the thumbnail? ...

FBJS setStyle( {backgroundImage}) not working?

Hi, i am trying to add some images to my facebook tab-app via FBJS. The Problem: I can't see the images and I don't know why. The FBJS code url = "http://www.domain.de/image.gif"; myImg = document.createElement('img'); myImg.setStyle( {backgroundImage: 'url('+url+')' }); document.getElementById('wrapper').appendChild(myImg); The r...

How to change Images by using jquery by using .load()

Hello All, I have a list of images. When the page load each time I want to show the next image in the series, and when it reloads again I want to change next image, etc. Please suggest me a solution using jQuery. Thanks ...

Encountering Error when doing post-back using __doPostBack()

Hi, I am getting an error on javascript when doing post back. The code is as follows: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs" Inherits="test" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/...

How to format contenteditable div as you type?

I'm trying to write a function that allows a contenteditable div to do some auto formatting while the user is typing in the div. So far I only manage to make it work in IE. Anyone can help me? function formatOnKeyUp(){ if (window.getSelection) { // ??????? } else if (document.selection) { cursorPos=document.selec...

Getting ResponseText without calling servlet using xmlhttprequest in IE(Any version)

Hi, I'm using xmlhttprequest to call servlet. It is working fine in Firefox. But, in IE, only if I click refresh button, it is working(that too sometimes). Otherwise, it is not triggering. Moreover, the response text is displayed without calling the servlet. Is that using Cache or what? I don't have any idea . Help me out please. ...

Initializing an Array with a Single Value

Is there a more compact way to do this sort of initialization? for (var i = 0; i < arraySize; i++) array[i] = value; ...

How to save the value of INPUT in variable?

How to save the value of INPUT in variable to not to write a lot of duplicate code? like var input = $(this).val(); full example <div id="form"> 1. <input type="text" value="title" /> 2. <input type="text" value="value" /> </div> $(function(){ $('#form input:eq(0)').bind({ focus: function(){ if($(this).val()=='ti...

How to always show scrollbar in browser using javascript?

Hi there, I want to always show vertical scrollbar in my webpage. How it is possible using javascript? I think it is possible using javascript or jQuery. I want vertical scrollbar whether there is enough content to show or not. thanks. ...

What is the best free JavaScript obfuscator that is available as a Java library?

I know this question has been asked many times, but here are my specific needs. The obfuscator needs to come in a form of a java library, so I can make an Ant task in order to automate the build process. IE7, 8, Firefox and Chrome must be able to interpret the resulting js very fast (original js file is pretty big - 18k lines of code). I...

Reference service-side code from <script> tag

I don't know where I got the idea before but a year ago I wrote this in php: <script type="text/javascript" src="http://www.mydomain.com/getmarkers.php"&gt;&lt;/script&gt; Now I'm ready to convert this website to an ASP.NET MVC website and I'm wondering what the best way is to convert this into something more 'normal?'. The options ...

How to find google gears database path dynamically

Hi, I am new to google gears concept. I want to find google gears database location dynamically using javascript. Please anybody tell me how to find location dynamically. Thanks in advance. Regards, Neeraja. ...

Replace all the dots in a number

Hi, I'm trying to replace all dots found in a value entered by the user in an HTML form. For instance I need the entry '8.30' to be converted to '8x30'. I have this simple code: var value = $(this).val().trim(); // get the value from the form value += ''; // force value to string value.replace('.', 'x'); But it doesn't work. Using t...

Want to pass php variable as argument in javascript function?

Hi friends, i want to pass my php variable in one javascript function. i know it seems simple but i don't know where am i missing something? <?php while($gg=mysql_fetch_array($lg)) { ?> <td id="add_td"> <?php $id = $gg['p_id']; echo "<a onclick=cnf('Are you sure you want to delete ...

Why Doesn't jQuery use JSDoc?

Or do they and it's just not in the source? I'd really to get something that will stop js-doc-toolkit from freaking out each time it parses jQuery. It also means I can't properly document any code using jQuery as a dependency without at least putting some boilerplate js-doc blocks, which fail to properly document jQuery's structure. Is t...

require() a node.js module?

I have a node.js module like this: # couchdb.js var couchdb = { // code } module.exports = couchdb; How do I do to be able to use require("couchdb") in all my files? ...

Help with AJAX and HTML

Hi, I have HTML code similar to <div class="menu"> <div>Latest</div> <div>Oldest</div> </div> I loop through all items in JavaScript and bind a click event listener on them. Now in the event callback, I'd like to know what data to fetch via AJAX. How do I figure that out from one item? I know that I should put something in t...

how to set height of ListBox to auto.

I have Html listBox: <select id="targetField" multiple="multiple" name="D1" style="width:200px;"> <option>INDIA</option> <option>USA</option> <option>UK</option> <option>AUSTRALIA</option> <option>RUSSIA</option> <option>FRANCE</option> <o...

Rhino: How to return a string from java to javascript?

enter code hereHow do I use Rhino return a string from java to javascript, all I get is org.mozilla.javascript.JavaNativeObject when I use var jsString = new java.lang.String("test"); inside my js file. Is this the right way to do it? var jsString = String(new java.lang.String("test")); PS. The goal is to have a java method to ret...

javascript / jquery using a variable to reference diferent parts of a json/xml object

I'd like to create a function which can cope with JSON in the following nested format. The keys will change ie conditions - could be anything and the subcondition key could be anything but the structure remains the same. My function is defined as populatePageEditorMenu: function (jsonPath, topLevel, childLevel){ and called by ...