javascript

Insert an hidden character in text string using JavaScript

How to use an hidden character in text string using JavaScript.There is one text string which i read and writes back with the hidden character in it (so rewritten text looks same as the original text though it comtains the hidden character), so that next time i read the text i can come to know that this text is aleady read as it contains...

getting href value of from <a> tag

hi, I have below html: <div class="threeimages" id="txtCss"> <a> <img alt="Australia" src="/Images/Services%20button_tcm7-9688.gif"/> </a> <div class="text" id="txtLink"> <h2> <a href="/partnerzone/downloadarea/school-information/australia/index.aspx">Australia</a> </h2> ...

How do I get clientX and clientY to work inside my "drag" event handler on Firefox?

Mozilla firefox 3.x seems to have a bug when listening to "ondrag" event. The event object doesn't report the position of the object being dragged, clientX, clientY and other screen offsets are all set to zero. This is quite problematic as I wanted to make a proxy element based on the element being dragged and using of course, clientX an...

Can you add parameters inside a print() function in javascript

Hi guys i am looking for a way to add parameters on a print function, cause i have to print only the table and when i alert the table it shows me the correct value but when i am printing it prints the entire page. my code is aa = document.getElementById('tablename').innerHTML if i alert(aa) it gives me the write value then i print(aa...

How can I trigger an onkeydown event on html table on Firefox?

I want to capture the keystrokes on a table's cells. I have the following code that is working on IE but not on Firefox/Chrome. <table id="testing" onkeydown="alert('testing')"> <tr><td>testing</td></tr> </table> Any suggestion? ...

How to execute a Javascript function from a C# WebBrowser?

Hi, I'm doing some web automation via C# and a WebBrowser. There's a link which I need to 'click', but since it fires a Javascript function, apparently the code needs to be executed rather than just having the element clicked (i.e. element.InvokeMember("click")). Here's the href for the element, which opens an Ajax form: javascript:__d...

Is there a way to change the following VBScript into javascript?

I'm attempting to convert some VBScript to javascript, but I doubt it's possible because it seems to be specific to MS apps and code. I'd like help with either of the two possible outcomes: a) actually converting the code to javascript, or b) demonstrating that converting it to javascript is currently not possible. The specific VBScript...

Best way to detect browser closing/navigation to other page and do logout

I am writing an application in GWT and I need to detect when a user navigates away from my application or when he closes the browser window (onUnload event) and do a logout (session invalidation and few other cleanup tasks). The logout action is performed by a servlet. I am currently doing this by hooking into the onUnload() event and ...

jQuery and ASP.NET Control issue

If I have a custom ASP.NET control that renders as an html control with an ID, I'm trying to add an attribute to the input control with jQuery. However, I'm running into some issues: First, my jQuery is not able to select it. I have so far: $(document).ready(function() { $(client id of the input control).attr('onclick', function (...

progressive enhancement on the server side?

Hi, Currently many of the links on our pages get changed to href="javascript:void(0);" on pageload, but if you're impatient (as most users are) you can click the links before the page loads and land on the clunkier, non-javascript, non-ajax pages. I'm thinking about progressive enhancement a lot these days, and I predict the majority o...

Problems with JQuery selectors and "is"

I'm having difficulty understanding why a particular selector isn't working for me. Admittedly I'm a bit of a JQuery newbie. This correctly selects the first div.editbox on the page and colors it yellow: $('div.editbox:first').css("background-color","yellow"); However, this if ... is construct makes the highlighted border appear for ...

How to parse HTML from JavaScript in Firefox?

What is the best way to parse (get a DOM tree of) a HTML result of XmlHttpRequest in Firefox? EDIT: I do not have the DOM tree, I want to acquire it. XmlHttpRequest's "responseXML" works only when the result is actual XML, so I have only responseText to work with. The innerHTML hack doesn't seem to work with a complete HTML document...

Testing for undefined variables in Ruby a la JavaScript?

Hi, In JavaScript there's a useful way to test for a variable which has never been defined at any given point. For example, the following snippet of code will return true if the variable bob has not been defined: typeof(bob)=='undefined' How do I accomplish the same test in Ruby? edit: I'm looking for a test which is equally compact...

Javascript window.open is blocked by IE popup blocker

Hi there, Can anyone help, i have a popup that is being blocked .. it is a popup that is created because somebody has clicked on a Print picture on my site... I thought IE is not supposed to block these when the popup came via an onclick? Can anyone help? the child1 variable is always returned as NULL if popup blocker enabled... Mayb...

Detecting the autoproxy details in Javascript

Is it possible to detect and get proxy server name and port in javascript? ...

javascript : trouble passing value to alert from hidden tag or text

I have an html file which passes values into a java servlet to insert into the database. Here is my code: <html> <head> <script type="text/javascript"> function masinsert(id) { var currentTime=new Date(); var button = document.getElementById("m"+id); button.onclick=""; button.value="Inserting"; var partnumber = document.ge...

Javascript regular expressions - exec infinite loop

Hello, I'm trying to get a link text using regex. there are possibly several links that may match the pattern and I want to get the furthest one until the 4th. Here is my JS code: var level=1; while ( _match = /<a href="http:\/\/www.mysite.com\/x\/(?:.*)>(.*)<\/a>/img.exec(_html)){ if (level < 5) (_anchor_text=_match[1]); leve...

iframe load failure again

I have a question similar to that posed in the "Detect failure to load contents of an iframe" issue. I am putting together a web page that loads a Google calendar as an iframe. I know that a large number of the computers that will use my web page will have restricted internet access such that the Google calendar won't load into the ifr...

Do browsers compile and cache javascript?

I’ve noticed that after making a change to a javascript file, clearing the cache, and reloading; one function in particular runs in about 90ms, the next time I load the page, it runs in 40ms, the next time I run it, it runs in 20ms … then never gets faster. It kind of looks like IE is compiling my javascript and caching that compiled ve...

Two ASP.NET Postback related questions

Question 1) I have a control to which I add an attribute from the server side by using a sentence like: ControlName.Attributes.Add("myTestAttribute", "") From the client side I modify the value of this attribute by using the Javascript function: Document.getElementById(ControlName).setAttribute("myTestAttribute", “Hello Server!!”); ...