javascript

validation on dropdown in javascript

i have dropdown named po_no with same id which is coming from ajax file in po_no getting two values in the format of 1025*3 when i put validation on that dropdown in javascript i write this code if(document.getElementById('po_no').value=="") { alert("Choose Purchase Order Number"); return false; } but this code does not work p...

Imagemap Rollover and Tooltip

<img src="http://www.w3schools.com/TAGS/planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap" /> <map name="planetmap"> <area shape="rect" coords="0,0,82,126" href="sun.htm" alt="Sun" /> <area shape="circle" coords="90,58,3" href="mercur.htm" alt="Mercury" /> <area shape="circle" coords="124,58,8" href="venus.htm...

How to get image id using jQuery?

Hi there, I have written code like this. <img id='test_img' src='../../..' /> I want to get the id of this image on image load like, $(img).load(function() { // Here I want to get image id i.e. test_img }); Can you please help me? Thanks. ...

jquery ui datepicker like input widget

i' like to make some jquery widget, which will have behavior like jquery ui datepicker: it should appears when focus on input tag and this widget and should be hidden when user mouse focus not in this widget and input tag, can you help me to say the right way to implement this behavior thanks ...

jquery: return html from div and not children

If I click on #parent I want to return the text inside it and not return the text inside nested layers (#child-parent, #child) <div id='parent'> this text is for parent <div id='child-parent'> this text if for child-parent <div id='child'> and this text is for child. </div> </div> </div>...

Alternatives to javascript Rich Text Editors

Hi, Having tried many javascript RTEs, I always seem to run into one or more showstopper issues. I was wondering if there were techniques other than the HTML designMode to build an RTE and work around these in a clean manner.. Maybe in Flash, or as a Java Applet or something? PS: Things that are usually problematic in javascript RTE...

Reference script container element?

I'm wondering if there is a way to get a handle on the DOM element that contains the script inside it. So if I had: <script type="text/javascript> var x = ?; </script> Is there a way that I can assign "x" a reference to the script element that contains "x"? ...

JavaScript to test for an object and child and grandchild objects (e.g.: HTML Frames)

I have a piece of JavaScript that's part of a library that I want enabled only if a certain frameset is available. What I wanted to do was just do: if (typeof(top.TableOfContents.frames.content)!=='undefined') { // stuff I want to do only if there's a frame named // TableOfContents with a frame named content } Now, I get erro...

How third party sites can check if user agreed/pass sth on my site, so they can let him pass sth on their sites?

How third party sites can check if user agreed to something(i.e. click ok)/pass some test on my site, so they can let him pass to some hidden resources on ther site? The problem is, user should not be asked to register on those third party sites, and i give those sites only javascript to paste into their code and merely button and some t...

Are there any good Silverlight/HTML file-upload with metadata libraries ?

I need to creating a solution in SharePoint 2010 to upload multiple documents and tag them with metadata. Does anyone know of an interesting/compelling file-upload control or solution that supports adding metadata to the files? The solution could be in Silverlight or HTML/Javascript. I've looked at the Silverlight Multi file uploade...

regex.test() only works every other time

Regex test() is giving me issues in Firefox and Chrome, yet it works flawlessly in Opera and Safari. troubled code: var pattern = /(\s+(?!\$\w+)|(^(?!\$\w+)))/g; if(pattern.test(String(id).replace(/\s+OR|AND\s+/g, ''))) { searchError("You suck."); return 1; } When you pass in white space, it blocks it every time. When you pass in s...

How to use jQuery to select this parent?

I have a recursive menu where I need the children items to effect the parent. In my example below, how do I add a "selected" class if any of the children have a "selected" class? <ul> <li class="administration first"> <a href="/administration.aspx"><span>Administration</span></a> <ul> <li class="users fir...

use # for nested jquery tab navigation

I am using JQuery tabs. One of my tabs contains another set of tabs. I can use http://site.com/page.aspx#tab2 and the page will load with the second tab being selected. However this second tab is the one that has another set of tabs in it. I want to do something like http://site.com/page.aspx#tab2#tab2 And have it select the second ...

Setting a field to a date in the future using jQuery or Javascript

I need to be able to set an input field to a date 365 days from the current date. This field sets the expiration date of a membership purchase. I have this javascript which does not work for some reason. <input type="text" name="ZoneExpiry" id="ExpiryDate" /> <script type="text/javascript"> function setExpiryDate( ) { var dat=new Date()...

Template method in javascript

Hi all, I want, in javascript, to implement the template method pattern. I have a PropertyDecorator with some subclasses: OpenButtonDecorator, SeeButtonDecorator and so on. I want to have in Property decorator the next function: var build = function(){ decorate(); //Abstract in PropertyDecorator, defined in subclasses return le....

http url for js file inside a war?

Suppose a WAR layout like so: foo.war -->/WEB-INF -->/classes (..) -->/js -->bar.js -->index.jsp -->web.xml Now suppose the WAR's virtual directory is /blah on server example.com (i.e. http://example.com/blah). What is the HTTP URL of bar.js, one that would be used in a <script src=""> tag that index.jsp might serv...

Prompting for download

Whats the best method to prompt a user to download something? In the past I've used window.open('file.pdf'); but I can see popup blockers having a problem with this. Of course I'll include a manual link aswel. I basically want something like the Microsoft Download page. So whats the script that prompts this? ...

Create 2d context *without* canvas

I am currently looking for a way to create a canvas 2d rendering context without actually having a canvas element on the page. I could dynamically create a canvas element and hide it, but then again I don't want to show the image directly to the user anytime, so there's no point of actually having a canvas element in the page. So I'm bas...

Show Hide using Javascript on a control, inside a ASCX control in a gridview. (ASP.NET + Javascript)

Hello, I have written a web usercontrol (ascx). Inside, there is a Panel that I want to show/hide on click of a hyperlink inside the usercontrol. Normally, this is easy just by doing something like this (the onclick attribute is added to the hyperlink on prerender): var PanelToShow = document.getElementById('<%=PanelInvoiceHasBeenCre...

jquery and java communication

I have jquery pop form to upload a file, after on submit (the page refresh and the pop close) i check something about the file and then if there's something wrong i need to pop up that form again (from the java code?), how could i do that ? ...