javascript

Draw a self intersecting polygon on the HTML Canvas.

I'm looking for a way to draw a self intersecting polygon with holes, I'm using the HTML Canvas element. So given 5 points, I want to draw the red one below. This question is essentially the same thing. Note: I don't want to do this using line intersections and adding more points, the actual paths I will be using will be curved. ...

How can we know when pop-up window url is loaded (window.open) ?

I need to change the URL of the page in the pop-up as soon as it completes loading ( I am using window.open function call). Is there anyway I can find out when the page in pop-up has completed loading in the parent window? I cannot change anything in the page I am opening in pop-up, because it belongs to another website. ...

javascript semantics

I am trying upgrade my javascript programming skills ( or lets say my programming skills period : ) ) so I am trying to understand some semantics : in the first line what does the "?" mean as well as the minus sign in "-distance" in the second line what does '+=' or '-=" mean? el.css(ref, motion == 'pos' ? -distance : distance) ani...

Strange problem with object property - present outside of loop, missing inside of loop

Hey guys, I have a really strange problem right now. markers is an array of objects. 0 content (String) coords (Object) gMarker (Object) 1 content (String) coords (Object) gMarker (Object) 2 content (String) coords (Object) gMarker (Object) So far, so good. The problem: console.d...

Button to call a php function?

I am new to javascript world. I wrote a function in PHP. How do I call it when I click a button or image in html? ...

replace space in URL JavaScript

These are the 2 relevant lines from a function written in Javascript. var v_depttime = document.getElementById("EDDepttime").value ; url=url+"?select_bno="+v_busno+"&select_depttime="+v_depttime ; It sends the select_depttime as 2010-01-24 14:30:00 and I want it to be an URL encoded string like 2010-01-24%2014:30:00 How is it...

Multithreaded JavaScript how to?

Is there any idea (library or methodology) to create multithreaded apps in JavaScript? ...

How i can i delete a selected item out of a listbox using php,javascript?

I got 2 buttons. One is to add an item to the listbox. The other is to delete something out of the listbox. The filling happens with an array. So what I need to know is: how can i delete a selected item out of the listbox? Thanks Stijn ...

Count words like Microsoft Word does

I need to count words in a string using PHP or Javascript (preferably PHP). The problem is that the counting needs to be the same as it works in Microsoft Word, because that is where the people assemble their original texts in so that is their reference frame. PHP has a word counting function (http://php.net/manual/en/function.str-word-c...

remove elements with "display: none;" for email using javascript (jquery)

Hey, I'm generating a email from a web page and taking a section of the page and putting it into the email. The problem is the section of code has elements with "display: none;" and some email clients don't recognise the display:none property which then displays unwanted elements in the email. I want to remove these elements using some...

Including a .js file within a .js file

I'd like to know if it is possible to include a .js file within another .js file? The reason for me wanting to do this is to keep client includes to a minimum. I have several .js files already written with functions that are needed by the client. The client would have an html file which he/she manages with a .js file include (my .js fil...

JQuery String replace ......

var value = $("#text").val(); and value = 9.61 i need to convert 9.61 to 9:61 how can i use jquery replace function here... pls help me Regards Nisanth ...

Is there a System.Web.UI.ClientScriptManager method that registers scripts inside the <head> tag?

I know it's strictly OK to put <script> tags in the body, but in the interest of neatness I'd like to use System.Web.UI.ClientScriptManager to register a script in the <head> of my page. Is there a method to accomplish this? Thanks in advance. ...

How to create a function which can return Date Difference in javascript?

i have created below function to get date difference between two dates.. pleas check it that its correct as well as how to find no of month (multiply by 30 or 31 ?) and year.. function days_between(date1, date2,datepart) { // The number of milliseconds in one day var ONE_DAY=0; if ( datepart === undefined ) { datepart = 'D'; } i...

How to get local variable by its name in JS?

Working example with global var: var example_var = 'global var example'; var x = function(){ var var_name = 'example_var'; alert('Global var value is: ' + window[var_name]); } How can I do same thing with a local variable? Like this (not working example): var x = function(){ var example_var = 'Local var example'; v...

Are there any alternatives for an IFrame if I need to load an external url to my webpage

I need to know if there are any alternatives for an IFrame that I could use to load in an external URL into my webpage. Even if it's JQuery or JavaScript or PHP ...

Javascript-HTML - how to iterate through all the forms on a page?

How can I iterate through all forms in a document using javascript? ...

Which framework is preferable of JavaScript to work with ASP.NET?

As we know we have JavaScript frameworks like Dojo and some more others. Which is best to use with ASP.NET? ...

Cannot get jQuery click handler to fire on ajax loaded element

"MyParentPage.htm" uses the load function of jquery to load('myDiv.htm') // myDiv.htm only contains: <a href="#" class="bt-cbox">Click me</a> I have the following in "MyParentPage.htm" $(document).ready(function() { $(".bt-cbox").click(function() { alert("handler hit"); }); }); Why is the my alert not being...

How to center map on marker and open marker's InfoWindow in one method

I'm using Google Map APIv2. On my webpage I've a sidebar containing a list of markers with onclick event executing showDetails method, that looks like: GMarker.prototype.showDetails=function() { map.panTo(this.getLatLng()); this.openInfoWindowHtml(this.details); }; The problem is that i cannot both panTo and openInfoWindowHtml ...