javascript

How to use jQuery prevAll() to select nearby text nodes?

I'm getting a text node (node.nodeType == 3) returned from the getSelection range, eg.: var selectionRange = selection.getRangeAt(0); var startContainer = selectionRange.startContainer; This startContainer usually is a text node, eg the following html: <p>Paragraph in <u>parag</u>raph.</p> Would result in the text node with text "r...

C# Javascript Beautifier

Hi, I am wondering if anyone knows of an open source c# library for beautifying javascript. I would like to make use of such a library within my asp net website to make debugging messy javascript easier. There are currently many online websites for this (ie. http://jsbeautifier.org/) however I would like to have access to such a utilit...

Is it possible to delete elements completely using jquery?

I have got a list of elements that im trying to delete using the .remove() from jQuery.It does delete the elements while viewing the page on the browser but I was wondering if its possible to delete the elements in its entirety from the page? So when i open the file in an editor later on, those elements shouldn't appear. And one thing ...

How to set multiple css style properties in Javascript

I have the following dynamic variables: var fontsize = "12px" var left= "200px" var top= "100px" The variables may differ, it may be also others like color, line-height... I know that I can set them to my element like this: document.getElementById("myElement").style.top=top document.getElementById("myElement").style.left=left ...bu...

Parsing JSON query (and xml)

I would need to parse some data that i get from JSON query. I get the data with $.getJSON(JSONquery, function(data){ $.each(data, function(i,item){ $('#output.... }); The data I get from it something like this (sorry its messy and longish): [{"name":"139930 blablabla","id":599,"contentobject_id":599,"main_node_id":565,"modified":...

Use Javascript to find text within DIV, insert into HTML form?

I'm currently working on a Safari Extension to create a printable form based upon information provided within a website. A custom CSS stylesheet wouldn't be ideal, instead I was hoping that it would be possible to do the following... If I were to have the following DIV on page called name.html <div id="name">John</div> Is there a way...

Javascript Changing the selected Menu items class

Hello, Assume that I have such menu <ul id="leftMenu"> <li class="selected">Foo1</li> <li>Foo2</li> <li>Foo3</li> <li>Foo4</li> <li>Foo5</li> <li>Foo6</li> </ul> Now via javascript, I want to change the highlighted one thus remove the "selected" from the current one and add to the next one What I ...

Problem with email validation in Opera and Chrome.

I use simple js email validation like: function validation(email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; return reg.test(email); } function check(){ if ($("#subemail").hasClass("bad")) { var subemail = $("#subemail").val(); if((subemail!=0)&&validation(subemail)) { ...

How to detect all change/click events of HTML select that still has focus?

How can I reliably detect all events that cause the the value of an HTML select to change, while that element still has the focus? For regular mouse input, either the click or change event works fine. For keyboard input (and for mouse input using the scroll wheel), however, the change event doesn't fire until focus is lost. I get around...

CSS problem with visibilty

I have the following code: var d = document.createElement("div"); d.id = "d_1"; d.style.backgroundImage = "url(img/lr.png"); d.style.backgroundRepeat = "no-repeat"; d.style.width = "150px"; d.style.height = "25px"; d.style.position = "absolute"; d.style.left = "460px"; d.style.top = "385px"; d.style.visibility = "visible"; document.docu...

Post form into dialog window by clicking a link

Hi, everyone. I'm trying to make this piece of code work. <form name="myform" onsubmit="alert('1');"> </form> <a href="javascript: void(0);" onclick="document.myform.submit();">ok</a> However nothing happens when I click "ok". Where have I mistaken? ...

Resizable table columns

Hi I'm developing a web app and am looking for a way to create my own datagrids. I know that there are lots of fantastic scripts out there with all the bells and whistles, but I need my own specific functionality, css styling, and the ability to use my own ui controls in it. Really, the only thing I need is the ability to resize the co...

javascript - find range value between two floats

I have a string like so: (999.08) - (1025.67) I need to be able to find the range between these two values as a floting point even if they are negative values so (-999.08) - (-1025.67) would also be in scope. Assume i would need to use a regex and join the two in some sort of array? ...

How do I externally call a method within a jQuery plugin?

Is there a way to call a method defined in a jQuery plugin directly in my script? update (function($){ $.fn.myPlugin = function (options) { return this.each(function() { function doSomething() { // do something } function doSomethingElse() { // do something else } doSomething();...

What is wrong with this functions recursion? (setTimeout issue)

Hi guys, I am writing a marquee script because I do not like the fact that with most marquee scripts when the marquee reaches the last item (thinking using a ul, so last item is the last li), it waits till that item is off screen, and then resets the position of the ul, and starts the scrolling all over agian. My approach is to create ...

Populate password on the login page using MVC

I am implementing single sign on and i have the login name and password from the parent site and would like to insert this values in the login and password field of the child site. How can i do this in C#, MVC. as of now i am able to populate the login name using viewdata but i m unable to populate the password. ...

Can you force focus on a calling IE window on the close of a child IE window in Windows CE?

Hello, I have a struts application being used on handheld devices running Windows CE 4.2/5.0. We needed the functionality of another app in this one, and the solution was to pop up a window to the other app (using window.open()), run the process, and then close the window to return to the original app. Normally our apps always focus on...

Evaluate the string as object (javascript)

Here is the problem string: $.ajax(...... ,success:function(msg){ var obj = eval('['+msg.d+']'); }, .... } msg.d contains something like: new Person(2, 'Name Surname','This is just string came from Par'is at Sat'urday'); How can pass the javascript problem ? ...

How do I get the value of the input field?

Hello everybody, this is my input field:$("<td class='testclass'><input id='field-search' value='' type='text'></td>") How do I get the value of the input field? I tried it this way: var mytest =$('#field-search').val(); alert(mytest); The result is that I get an alert being undefined though the input field has got a value e.g. 10....

How to first use javascript to validate form data before triggering onServerClick for HTML Input button?

So right now it all looks pretty with ... <button type="submit" runat="server" name="subscribe" id="Button1" class="link-button" onserverclick="saveListing"> Until it is time to validate the data before calling saveListing function codebehind (in VB .Net). How can true/false be return so that when true saveListing will be called, oth...