javascript

How to create multiple instances of show/hide div in jquery?

I have the following code $(document).ready(function() { $('a#slick-toggle').click(function() { $('#slickbox0').toggle(400); return false; }); }); <a id="slick-toggle" href="#">Show/Hide</a> <div id="slickbox" style="display: none;"> hidden content here </div> The problem is, if there is more than 1 instance of this on the ht...

Difference between MyClass.prototype = new Object() and MyClass.prototype = Object

Hi, could anyone please tell me, where in Javascript the difference between MyClass.prototype = new Object(); //or ... = {} and MyClass.prototype = Object; is? And if there is no difference in the result, which one is the best-practise-way-to-go? Thank you, m ...

document.selection in Javascript

I need to know what is the use of following code: var obj=document.selection.createRange(); obj.moveStart('character', count); From what I understand, obj will have the selected text. What is moveStart is used for..? ...

Handling elements generated by Javascript in Asp.Net

I have several elements in my web page generated by JavaScript. Here's an example of such content: <input id="uploadfile01" type="file" onchange="change(1);" /> <input id="uploadfile02" type="file" onchange="change(2);" /> My question is: How can I interact with these elements in the server side, (Asp.net) after a post? (Since the ele...

Retrieving xpath of the selected text in browser

I want to retrieve the xpath of the currently selected text in a browser. Using JavaScript I am able to get the selected text, but was not able to get the xpath. I can find the xpath manually using Firebug, but I want to do it programatically. Is it possible to do it? [EDIT] Okay, found a pointer to the solution in this thread. Modifie...

Access JavaScript variables with Selenium IDE

I'm wondering if it's possible to access page JavaScript variables with Selenium. I have an application that's using a variable attached to the window object. It has a global scope and I can access it either with window._myvar, window['_myvar'], _myvar, this['_myvar'], this._myvar depending on the context. So I tried to get Selenium to ...

javascript memory leak

Hi, I'm trying to solve a problem with a memory leak in IE with Javascript. Basicaaly I'm using javascript to add icons on top of an image then I need to refresh the icons periodically by deleting them and re-adding them. When I run the app through drip though (IE6 memory usage indicating tool), when I delete the images before redrawin...

Using a PHP as a Javascript file - Security?

What are the issues with using a php file instead of a .js file in a javascript include; <script type='text/javascript' src='myjavascript.php'></script> Obviously I will go through and plug register globals issues and such, but are there other vulnerabilities that could occur from this? Consider that 100,000+ people will be viewing th...

Problem with Select box Onchange event in html

<script> function options(){ alert("asdfasdf"); } </script> <select type="selectbox" name="crPaymentOption" id ="crPaymentOption"onchange="options()"/> <option selected="" value="--">--</option> <option value="Check">Check</option> <option value="Credit Card">Credit Card</option> <option value="Cash">Cash</...

How can I print a page in landscape in javascript

How can I print a page in landscape in javascript? ...

Google maps postback in IE when info window is maximized

I have an info window that I have 2 images on and i want to hide and show alternatively based on the user clicking an tag. This works fine when the window is in its normal state. When I put the same HTML in the Maximized content it cause a postback in IE only. Firefox works fine. Here is my js and markup. Can anyone suggest how to ...

Selecting elements in jQuery

In continuation of the question at this link I wanted to add some functionality in test.html The event trigger is 'clicking' on any <p class=""> tag. After clicking I wanted that particular <p> to disappear (which was fairly straightforward) but I also want that If out of the three either one or two <p> are hidden, then "Hide 'em" butt...

JavaScript/jQuery method to find base URL from a string

I'm trying to find a relatively easy and reliable method to extract the base URL from a string variable using JavaScript/jQuery. For example, given something like: http://www.sitename.com/article/2009/09/14/this-is-an-article/ I'd like to get: http://www.sitename.com/ Is a regular expression the best bet? If so, what statement could...

replace more than one characters in javascript

i having a string variable var text = "hello hw r u"; And i need to replace 'h' to '*' and 'l' to '-' hw to do that.. ...

how can i validate a url in javascript using regular expression

i want to validate a textbox who have some url value like blogs address or site adress how can i validate this textbox in js ...

Invoke Javascript on ValidationSummary ShowSummary

Hello, I am trying to invoke a javascript function when a ValidationSummary shows the errors on a page. Is this possible? ...

jQuery - Load/Inject a remote pages DIV and jQuery Script

The Scenario Using jQuery, I have a page that has a popup overlay containing locations marked using Google Maps. The overlay works using 2 pages setup as follows: The main page opens an overlay via a text link to a map. The complete map page is then loaded into the overlay. The map page itself contains Google's API and initialization...

javascript image uploading and text replacement

Weird to describe but here goes. I have a table with several rows. One of the fields in each row, is for an image. Now i dont want to show the image itself, but rather the filename of the image as a link. When i click that link, i want to popup a window that will let me upload or choose a new image from a list. The key is, when im don...

Overriding ACTIVE_CLASS in YUI

I a using the YUI tabs compontent: http://developer.yahoo.com/yui/docs/YAHOO.widget.Tab.html I am trying to override the default value of ACTIVE_CLASS which is 'selected' as I wish a different name class to be applied to each tab when active. Any pointers appreciated, thanks. ...

How to add a border on HTML5 Canvas' Text?

I can draw text using these code: myCanvas.fillStyle = "Red"; myCanvas.font = "30pt Arial"; myCanvas.fillText("Some Text", 10, 30); I want to add a border around "Some Text", any ideas on that? ...