javascript

Is it necessary which thing comes first in source will render first, always?

Is it necessary which thing comes first in source will render first? and other thing will wait to render above element then they will start to render? like if header and sidebar comes first in source then will main content section will always render after header and sidebar.? Does rendering of html element fully depend on source order?...

How do I shorten this load jQuery?

I'm pretty good with jQuery but when I get to stuff like this I need a little help. So I want to shorten this code: $(function() { $('#experience_nav').click(function() { $('#contentWrap').load('files.html #content_experience', function() { $(this).hide().fadeIn(); $('#content_experience').siblings().fadeOut(); ...

What is the proper way to control related objects in javascript?

I'm new to object oriented programming and am slowly learning how to apply it to javascript. So please bear with me. :) I have two basic objects: "record" which contains methods for editing a single record from a recordset. (create, save, load, etc.) "recordList" which contains methods for outputting a paginated list of record titl...

need help with a javascript void problem!!!

i'm trying to listen to an archived radio programme file from here (via firefox): http://www.sunriseradio.com/player/archivelist/?audionum=14/02/2010 ...but it just doesn't play/work!!! just keeps giving a "javascript void" message. any solutions or suggestions??? i really need to play that file!!! ...

Get part of string into variable

Hello, i need to get part of string into variable. (note, i will always use exactly 4 names) var names = "Andrew Peter Bob Mark" I need to get the last one to var last = "Mark" Thanks for help in advance ...

Use javascript/jquery to append URL?

Is it possible to use javascript/jquery to append something on the end of a url when a link is clicked? For example, I have 5 tabs on a page (product.php), when I click a tab, then that tab opens. What I want to do is have the URL change to product.php#tab-3 (or whichever number tab is clicked) when you click on it. The reason I am do...

loop on a function in javascript?

Can we run a loop on a function in javascript, so that the function executes several times? ...

Export JSP output to a PDF on click of a button

I have created a JSP with various fields. I want to provide an option to export the page to a PDF before submit but after the user fills in the form. How can this be achieved? I am struggling with this problem past many days and not able to get solution. ...

How can I create custom HTML5 video controls?

I'm interested in building a custom video player in HTML5. I have no problem embedding html5 video media utilizing the dual format of Ogg and h.264. My main issue is in referencing the API for the video tag element. What properties and event listeners do I have access to via javascript? ...

How to Import Bookmarks from Browsers (Firefox, Safari, Opera, Chrome) into your Application?

Hello all, As a feature of the application I am creating - I wish to enable the importing of bookmarks from different browsers. I have two questions, the first is a bit silly: Is it possible to import bookmarks from the browser using JavaScript - I am guessing no? Does anyone know of any pre-written classes that I can make use of to a...

How to avoid the loading of a specific javascript lib on IE?

Hi, I have a JQuery-Datepicker that (however) crashes my site when you are using IE6. So I want the site to prevent the loading of that particular javascript on IE6. I know about this trick: <!--[if IE 6]> <script type="text/javascript" src="datepicker.js"></script> <![endif]--> But I need it the other way around: To load the Scri...

Javascript block script execution

Hi, i need to do something like this: Execute a piece of code Start to load an image and block the script execution When the image is loaded resume the execution Execute the rest of the code I know that the simplest way is to assign a function on the onload event of the image and then execute the rest of the code in the function, but...

user dbl-clicks on a word inside a SPAN or P or DIV; the word is highlighted; how to get the selected word?

Can you get the word the user has double-clicked on? I've tried in a onDblClick eventhandler but selectionStart is undefined there; and the onselect event seems to be available only for TextArea. ...

How do I detect the difference between Adobe Acrobat versions higher than 8 in non-IE browsers with JavaScript

I know that starting with version 8, the name of the Adobe Reader plugin was changed to "Adobe PDF Plug-In for Firefox and Netscape", and does not include any version information. However, the version information does appear in the "Plugins" tab when viewing Firefox Add-ons. Does anyone know where that information comes from, and if it...

Javascript isset() equivalent

In PHP you can do if(isset($array['foo'])) { ... }. In Javascript you often use if(array.foo) { ... } to do the same, but this is not exactly the same statement. The condition will also evaluate to false if array.foo does exists but is null or false (and probably other values as well). What is the perfect equivalent of PHP's isset in Ja...

Give the JavaScript the button's id.

In my JavaScript code, I have to make a line like this (I use smarty template engine, that is the literal stuff). <script language="javascript" type="text/javascript"> function ajaxTextKill() { // ...etc. ajaxRequest.open("GET", "functions.php?action=kill{/literal}&id="+IWANTMYIDHERE+"&p={$smarty.get.page}&c={$smarty...

Problems with IE and appending to the window.opener

I have the following script that works well in Firefox and Chrome (not sure about other browsers), but it doesn't work at all in IE. It basically opens a popup which appends a div to highlight an item in the window opener. I want it to work across multiple pages on the same site, so I didn't want to add a function to create the div in th...

I have alot of "IF/ELSE" statements, should I write this differently?

This is what I have: (category=="Ljud & Bild")?byId("nav_sub_ljud_bild").style.display='block' : byId("nav_sub_ljud_bild").style.display='none'; (category=="Datorer")?byId("nav_sub_datorer").style.display='block' : byId("nav_sub_datorer").style.display='none'; (category=="Telefoner & Fax")?byId("nav_sub_telefoner").style.display='bloc...

Drawing lines with clickable points using JavaScript

I'm interested in doing some drawing using JavaScript. I'll get straight to an example: The green horizontal line would be static, and all the vertical lines would be clickable. An example of a clicked line would be the red one. I've seen many API's, but they all allow more complexity than I need, making it more complicated than neces...

Div with "display: none" style appears anyway

I have a div with the id "hubspot-contact-form". This div has a display style of none. But when the page loads, the div appears anyway. Can anyone help me figure out how to hide this form when the page loads? Here is the whole page. Thanks. <?php include ('includes/secure.php'); include ('includes/globals.php'); $thisPage =...