javascript

How do I add an external js file with a parameter

I want to give a minimal js code to random websites so that they can add a widget. The code needs to run after the main page loads and include a parameter with the domain name. ( I don't want to hardcode it) One option is to add this code just before the </body> (so It will run after the page loads): <script type="text/javascript" id=...

Copy half of an HTML child nodes array

I have an HTML element (let's say a division) that contains a set titles (h2) and paragraphs (p) with other element inside (some links for example, a). My goal is to cut my HTML element in 2 same size element. Constrains : paragraphs, titles, and block should not be cut My idea asbout this was to browse inside the child nodes list and...

Textpattern's hak_tinymce plugin does not work in IE

I've set up Textpattern's hak_tinymce plugin on a website I run, and it works great in Firefox, Chrome, Safari and Opera. However, in IE the content area is gray (e.g. it just isn't there), and the Javascript fails with this error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; ...

ASP Form problem

Hi I have an asp form that has a checkbox and dropdown menu. If the checkbox in not selected then I need to make sure the dropdown is either not selected or disabled. ...

How to retrieve iframe top position in IE6 using JavaScript?

Does anyone know how to retrieve an iframe top position within a page for IE6 using JavaScript? The following code works for IE7: window.frames(0).screenTop but the same code in IE6 retrieves the wrong value (far too high). Any ideas? ...

Why is ContentEditable removing “ID” from div

I am having problems with getting a HTML editor working. We are using “contentEditable” to implement it, however when any paragraph formatting option is done without contents selected, IE removes the ID from one of the divs in the page. The problem repeats for me with the HTML, just save it to a file, then open it in IE enable jsc...

Problem in javascript and PHP

Dear all I using the price in Euro in javascript. var currency = '\u20AC'; Total Sum = Sum in Euro When I try to use in PHP mail. The Euro Symbol is appears differently. I used following command: $mail_body_reply=Sum from Javascript mail($email, $subject_reply, $mail_body_reply, $header_reply); Any idea to act same in PHP and Jav...

How can I upload a file using JavaScript without a postback?

I am working on a file upload in ASP.NET. I used <input type=file id=upload> and <input type=button id="btnupload" value="File Upload"> I want to upload the file in JavaScript. The update panel does not work, I do not want it to postback and refresh the page. thanks but If you have code related to fileUpload in javascript then send me....

using jQuery after someone else's Javascript

Scenario: I have a Javascript-generated web page that someone else wrote a long time ago that I'd like to pretty up using jQuery. My goal is to clean up the Javascript generated html that someone else produces just by using some jQuery calls against that HTML, after it has been generated. This will be much simpler than modifying the ot...

How to fade the background

I was going to look up how to do this, but I don't really know what to call it to look it up, so I was hoping I could describe it here and someone could point me in the right direction. Anyways, I'm looking for how to make it so on a website, when you click on something, a new sorta layer pops up and fades the background. I see sites do ...

javascript blur event -- is there any way to detect which element now has focus?

Hello, Does anyone have a technique that will allow me to determine which element has focus after a blur event? I have an input field which I'd like to reset on blur unless the blur was caused by the user clicking the "save" button. I'd love to just set a flag in the save button's onclick funtion, but that would fire too late (unless cl...

How do I run different versions of jQuery on the same page?

My company has purchased a product that renders an ASP.NET control on the page. This control uses jQuery 1.2.3 and adds a script tag to the page to reference it. The developers of the control will not support use of the control if it modified in any way (including modification to reference a different version of jQuery). I'm about to st...

body onload handler in a content page

How to call a javascript function on body load of a content page? As I can not use the body load of my Master page body onload in this. ...

Javascript in PDF double values

I have the following code that is supposed to do a sum in a pdf. var sum = 0.0; var f1 = this.getField("price"); var temp = parseFloat(f1.value); sum = temp; var total = this.getField("total"); if(sum > 0) { total.value = sum; } else { total.value = ""; } But if the input is 18.31 my total is 18 EDIT: I also tried conso...

How to structure my javascript/jquery code?

I am toying around with a pretty intensive ajax based jquery web application. It is getting to a point where I almost loose track of what events that should trigger what actions etc. I am sort of left with a feeling that my javascript structure is wrong, on a more basic level. How do you guys structure your javascript/jquery code, the e...

JavaScript window.open only if the window does not already exist

I have an application that opens a new window on clicking a link. This spawns a page that holds a Java applet. The problem I am having is that clicking the same link reloads the page, which resets the Java application. Is there any way to trap this? Two solutions that would be acceptable are: Allow multiple windows to be opened from th...

Convert escaped html ASCII codes to plain text using JavaScript

I'm looking to convert a string of html entities specifying ASCII codes (ie: &#97;) to the ASCII characters they represent (ie: a). I'm using a property of an object and trying to assign a value. For instance: object.Text(""); When I pass is the string representing the entity, I get the same string back. I can't find the function to c...

Regex to match 2-10, but not 99

I have a field on a form that takes the following values: -1, 2-10, 99 I have a business rule that's concerned with answers 2-10. I'm trying to write a regular expression that will match 2-10 but not 99, and I'm having trouble. The original expression: ^2|3|4|5|6|7|8|9|10$ Fails because 99 is matched (technically, twice). Also, th...

How can I intercept the F5-button-clicked event using jQuery?

Hi, I want to implement keyboard shortcuts using jQuery. Specifically, I want to fire an event when e.g. F5 is clicked. What kind of issues do you run into with keyboard shortcuts? Also, any online chart that has all the keyboard mappings to numbers? ...

How can I check for an open URL in another window?

This is a follow up to my last question Open a window if the window does not already exist Essentially, I am now keeping a list of all the window references that have been opened by a page, and only allowing them to be opened if they are not already open. Then a potential problem struck me - it is of course possible for a user to shut do...