javascript

how can i use a variable of one <script> in another <script> in javascript?

how can i use a variable of one in another in javascript? ...

document.getElementById(id).focus() is not working for firefox or crome

When ever I do onchange event, its going inside that function its validating, But focus is not comming I am using document.getElementById('controlid').focus(); I am using Mozilla Firefox and Google Crome, in both its not working. I don't want any IE. Can any one tell me what could me the reason. Thanks in advance Here's the code: var...

what is the role of the plus sign(+) in the following function which is excerpt from jquery source code

function now(){ return +new Date; } questions : what does the plus sign mean? when can you create a new object with a constructor function but without the following parentheses, such as new Date but not new Date() great thanks! ...

how can i understand jquery source code

i'm new to object oriented javascript. i want to be a javascript guru. so i leant oo-related concepts in javascript, such as scoping, scope chain, execute context, colsure, anonymous function... but when i try to practice my javascript knowledge to read jquery source code. i still can't understand a lot of it. anyone can give me some sug...

Jquery - How to run a function onclick only if link is not dragged?

I am running thickbox and jquery ui draggable both on the same page, and they are conflicting. Jquery UI Draggable allows me to drag and drop things from one place to another with this code: $(".droppable").droppable({ drop: function(ev, ui) { do stuff } }); Thickbox starts on a click event, with essentiall...

document.getElementById().innerHTML fails with 'Unknown Error' in IE

I'm trying to use document.getElementById().innerHTML in a JavaScript to change information in a webpage. On FireFox this works as described in the W3C documentation, however, the same method returns 'Unknown Error' in IE. The JavaScript looks like this: function Change_Info (ID, ROW, VALUE) { if (document.getElementById) { ...

Support for encoding query string or POST data in YUI ?

How do you encode a javascript object/hash (pairs of properties and values) into a URL-encoded query string with YUI (2.7.0 or 3.0.0 Beta) ? I want to do the equivalent of Object.toQueryString() from Prototype: I need this to encode parameters for GET and POST requests with YAHOO.util.Connect. It turns out YAHOO.util.Connect has a set...

Do browsers parse javascript on every page load?

Do browsers (IE and Firefox) parse linked javascript files every time the page refreshes? They can cache the files, so I'm guessing they won't try to download them each time, but as each page is essentially separate, I expect them to tear down any old code and re-parse it. This is inefficient, although perfectly understandable, but I w...

Iterating a JavaScript object's properties using jQuery

Is there a jQuery way to perform iteration over an object's members, such as in: for (var member in obj) { ... } I just don't like this for sticking out from amongst my lovely jQuery notation! ...

ASP.NET make a panel visible on click of hyperlink (whilst also cuasing postback for page navigation)

I may be asking the impossible but let me set out my problem: I have a menu in a MasterPage which uses images and mouseover mouseout events for design purposes. On one of the menu options I need to display a set of sub menus options on the click of the parent menu item. The menu item itself also needs to navigate to a specified url. I...

Javascript OLE Word

I want to show a MS Word environment in an Iframe without all the toobars. The document that is being showed contains input fields. After these fields are filled in, the document must be printed. I have created the print button and want the (filled in) document printed when this button is clicked. I hope you understand want I want and h...

html entity decode fail with the new lines in textareas

hi when I get a text from a textarea in html like this &#119;&#97;&#115;&#101;& ;#101;&#109; the correct decode is waseem notice the newline , when I decode it I get wase&;#101;m the newline make errors here , Can I fix it ? I use javascript in the decoding process . I use this function in decoding function html_entity_decode(...

How to determine when scroller in browser appear

I am using resize event, but when scroller appear - it change window size, but event is not called. ...

What are the drawbacks of accessing DOM elements directly by ID?

Today I stumbled upon the possibility to access a DOM element in Javascript simply by its id e.g. like this: elementid.style.backgroundColor = "blue" I tested with a very short snippet if this works in IE, Firefox and Chrome - and it does. Here is the snippet I used: <html><head> <script> function highlight() { content.st...

Javascript Date.Parse blows up on Russian Dates

Hello, We have a web application that gets its data from a certain database. The product writing to that database has been localized to RUSSIAN, thus its data, in particular the dates had been localized too. We encountered a problem where our DATES would not show on our application. We traced the problem to an invalid Date.parse() java...

Calling ActionScript code from HTML JavaScript and obtaining return value?

I need to obtain the text from the system clipboard in HTML JavaScript, in a way that it works on all browsers. Some form of clipboard.swf is sometimes used on many sites to copy text into the system clipboard. How can I do the reverse, i.e. obtain the system clipboard's text in JavaScript via ActionScript code in a 1x1 swf file that I ...

Is it impossible to separate javascript from HTML?

To be specific, I'm talking about avoiding this type of code: <input type='text' id='title_33' class='title' onfocus='updateCharsLeft(33);' onkeypress='updateCharsLeft(33);' /> Here I would like to put the onfocus and onkeypress event handles separately, i.e in a .js file. Like this: $(document).ready(function() { $(".titl...

javascript innerHTML issue

hi , using obj.innerHTML = "abcxyz <[email protected]>" getting ouput: abcxyz the rest part is getting ignored because of angle bracket(<>). so how to achieve the same. thanks in advace ...

Keep focus on blur event

I am using jquery to keep the focus on a text box when you click on a specific div. It works well in Internet Explorer but not in Firefox. Any suggestions? var clickedDiv = false; $('input').blur(function() { if (clickedDiv) { $('input').focus(); } }); $('div').mousedown(function() { clickedDiv = true; }) .mouseup(function() {...

how to call another function in javascript?

how do i call the doSubmit() function from the conFirmUpload() when the confirm msg box is true? <script type="text/javascript"> function confirmUpload() { if (confirm("Are you sure want to upload '" + document.getElementById("txtWS").value + "' ?") == true) { return true; } else re...