javascript

CSS and JQuery: spaces inside image name break code of url()

Hi, I have a page that is supposed to display a larger version of an image when hovered over a thumbnail. I have a 'div' with an ID and the JQuery code is as following: $(document).ready(function(){ $('img').hover(function() { var src = $("#im" + this.id).attr("src"); $('#viewlarge').css('backgroundImage','url(' + src +')...

What is the difference between these two javascript functions ?

I've been looking at how some jQuery plugins work and I've seen the following acting as a closure around the whole plugin $(function(){ // plugin code here }); (function($){ // plugin code here })(jQuery); What is the difference between these two ? ...

trigger onchange event manually

Hi all, I'm setting a date-time textfield value via a calendar widget. Obviously, the calendar widget does something like this : document.getElementById('datetimetext').value = date_value; What I want is : On changing value in the date-time textfield I need to reset some other fields in the page. I've added a onchange event listener to...

unobtrusive "default" text in input WITHOUT jQuery

Hello, i'm trying to write unobtrusive default/placeholder text in input (actually, relatively placed label over input, which hides on onFocus, and stays hidden if input isn't empty on onBlur), but I don't want to use jQuery, because this is the only javascript used on page - therefore using jQuery seems a bit over the top. Please, how...

How to Open Print Friendly Page Windows?

Our users can currently select a number of funds from a page and go to another page to see the funds compared on a chart. I now have to present the user with an option to produce a print-friendly fact sheet page for each fund in the chart. The requirement is that each page will open in a new window (or tab), and be minimised so as not t...

Path to WordPress Template Directory inside jQuery?

My header is calling a javascript file which sends out an email: <script type="text/javascript" src="<?php bloginfo('template_directory') ?>/css/effects.js"></script> But inside this file, I have a jQuery code that calls a .php file that does the actual sending of the email: $.ajax({ type: "POST", url: "css/sendmail.php", data:...

Measure text size in JavaScript

I want to measure the size of a text in JavaScript. So far this isn't so difficult because I can simply put a temporary invisible div into the DOM tree and check the offsetWidth and offsetHeight. The problem is, I want to do this BEFORE the DOM is ready. Here is a stub: <html> <head> <script type="text/javascript"> var text =...

How to use Math.max, etc. as higher-order functions

In short, this works: [1, 2, 3].reduce(function (a, b) { return Math.max(a, b); }); => 3 But this doesn't: [1, 2, 3].reduce(Math.max); => NaN Pure puzzlement. This is in Firefox 3.5.9, which I presume is using the mozilla standard implementation of reduce, FWIW. ...

Can I Open a New Browser Window Minimised with Print Dialog Already Open?

I understand I can call window.print() when the page loads to load the print dialog, but can I force the window to be minimised from the point that it's opened and the print dialog is generated? Ideally it would be minimised until the user maximises it. Thanks ...

how run bash script on client system to detalis system process

i wnat to run a script on client system to get & access imformation of client and using ubuntu ...

Palm application development using external html and .js files

Hi Fellas, I am new in Palm application development and my project demands to connect my application with client's server. Issue is that, client has provided me with pre- developed htmls, javascripts, and server interaction json files. I am in a fix like how to use them. Is it possible to use external html and javascript files(not devel...

Javascript delete cookie next day

Hi, I was wonder if you can delete a cookie at the beginning of the next day. Lets say I log in to a website at 1:30pm and use it again throughout the day but at midnight or 1 minute past, in the new day, the cookie is removed. Many thanks for any help, C ...

Count Upwards for ID jQuery

Hi Guys, I have the following HTML structure <div id="test-1-yay"></div> ... bunch of code ... <div id="test-2-yay"></div> ... bunch of code ... <div id="test-3-yay"></div> I was wondering how I can use jQuery to basically identify each of these "id's" and then apply some jQuery to them ? I'm new to this so little unsure ? Something ...

Minified Sizzle

Hello guys. I can't find minified sizzle =( And if i trying to make it myself by yuicompressor, after that, some features not work. Please help. ...

Drag and drop issues in TinyMCE

I'm trying to let users visually move around component placeholders inside a TinyMCE editor, however I can only seem to get drag and drop working with divs in Internet Explorer. Even dragging simple text around seems buggy in Firefox and Chrome. Any way of getting this done somehow? I've tried finding a plugin or something but no luck s...

How get <body> element from the html which one have as a string

Hello! I have a stupid problem. An jQuery.ajax request return me a full HTML text as a string. I receive such response in an case of error on the server. The server give me an error description which I want to place inside of the corresponding place of my current page. So now the question: I have a string contains full HTML document (w...

Pass data from one form to another on a separate page

I am building a price/distance calculator with Google Maps API and am trying to pass the info from the calculator to a booking form on a separate page. My first form has 2 submit buttons - one to make the calculation, and one to submit the relevant data to the booking form. I'm stuck trying to make the 2nd button work. Once the API ca...

How to color a treeview node in javascript

i have a treeview and a texbox that allows a user to search for nodes inside the treeview. i already wrote the JS function that determines if a node exists in the treeview. what i want is to color the node that the user have searched for. how can i do this?? ...

Is it possible to change the file path of the video using javascript?

I have an object tag in a HTML file: <object classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95"> <param name="FileName" value="../ABC/WildLife.wmv" id="mediaPlayerFile"> <param name="AutoStart" value="false" /> </object> I want to change the filename using javascript. What I have so far is this: <script type="text/javas...

Adding DOM elements using contentEditable

Hi all, I've created an editable div, and I want to replace smiley signs with smiley images. But whenever I replace a string with a dom element (<img> or <span> or whatever..), the div stops being editable (i.e. I can see the caret when I click on text, but can add no characters to it). What's going on? (I'm doing this in Safari) He...