javascript

UIWebView and Javascript from button

So I would like to run the following Javascript on an open webpage in a UIWebView: - (IBAction)pushDownoad { [webView stringByEvaluatingJavaScriptFromString: var myWin=window.open("","myWin","width=800,height=600,scrollbars,resizable,menubar"); var myStr=document.documentElement.innerHTML.toLowerCase(); myStr=myStr.re...

Cross Domain iframe problem (set parent location)

I have a page called "k.html" which is in domain A. This page will be used as an iframe by pages "a.html" in domain B, domain C, domain D, domain E. I want to set the parent location in this "k.html": Domain B's "a.html" page to Domain B's "b.html" page Domain C's "a.html" page to Domain C's "b.html" page Domain D's "a.html" page to Dom...

traversing dom in jquery find previous instance of class

I have the following repeating pattern of tables and buttons ---------------------- table 1 .inventory class ---------------------- [button 1 .add-row] ---------------------- table 2 .inventory class ---------------------- [button 2 .add-row] ---------------------- table 3 .inventory class ---------------------- [button 3 .add-row] ...

Javascript: set label text

I'm trying to implement a generic function for a form with several fields in the following format. <label id="LblTextCount"></label> <textarea name="text" onKeyPress="checkLength(this, 512, LblTextCount)"> </textarea> And the following JavaScript: function checkLength(object, maxlength, label) { charsleft = (maxlength - object.va...

window.open not working in firefox

alert(window.open('http://www.google.com')); i tried this on firefox, and i get null, no prob in ie. any idea why? ...

php and server side javascript

Hi All, I am dealing with a problem where I need to do few thing at the SERVER SIDE using JAVASCRIPT (I am using php + apache combination )- read source of url using curl run it through some server side JavaScript and get DOM out of it traverse and parse the DOM using pre-existing java script code.This code works fine in a browser. ...

Avoid multipart/form-data for file transfert

I wrote a light http server in C which can handle simple requests. So I totally control the server side and its future evolution. Now on my Web Application written in Javascript/ExtJS, I need to upload a file on my server. Am I forced to use multipart/form-data to upload a file? Is it bad to directly send the file binary contained in a...

Good resources for learning JavaScript

Hi, Can someone suggest good learning materials or websites to learn JavaScript and jQuery? Am pretty new to this and want to learn right from basics. Thanks in advance, Geetha ...

Which of these selectors is likely to be faster?

A couple of questions actually, Given that the following two will return the same result set $("#MyTable tr"); $("tr", "#MyTable"); is there any difference in performance between using the Parent-Child CSS selector convention or specifying a context to the selector instead? Also, given that I can guarantee a tr will be an immediate ...

jQuery - Cannot access my properties in function called by .animate complete:callback

I've got the following piece of code that shows a popup and then hides it after a short period of time: div.stop() .animate({top:'0px'},{queue:true,duration:this._speed}) .animate({opacity: 1.0}, {queue:true,duration:this._delay}) .animate({top:'-' + outer + 'px'},{queue:true,duration:this._speed,complete:this._myFunction}); Whe...

Simple JavaScript function with immediate invocation does not work... why?

Can anybody explain why this works: var sayHello = function (name) { alert("Hello there " + name + "!"); }("Mike"); While this does not: function sayHello (name) { alert("Hello there " + name + "!"); }("Mike"); Mike Peat ...

Javascript variable problem, simple question

var num = rez.data.length; for(var key=0;key<num;key++) { var marker = []; var point = new GLatLng(rez.data[key].latitude, rez.data[key].longitude); marker[key] = new GMarker(point, {icon: iconS}); GEvent.addListener(marker[key], "click", function() { marker[key].openInfoWindowHtml('xxxxxx'); }); map.getMap().addOver...

Anti-aliased text with css/javascript for Large font size???

I am using Large fonts in my website at a few places and they don't appear anti-aliased or smooth... I was wondering if their is any way to show large anti-aliased fonts for browsers on windows OS which has anti-aliasing switched off as default... Similar to something they have on this website here ...

How to stop a webpage from executing javascript that resides inside a textarea or as value to input (type text) ?

I have an anoying problem with a page. If I have a textarea or textbox with its value (set on serverside) to eg. "alert('hello');" that script is executed upon load of the page. Well why dont you encode the string before you set it as value to the textbox you ask? Then special characters like åäö will also be encoded and thats a solutio...

What is this google adsense code doing exactly?

Hey, I am trying to further my knowledge of javascript and was wondering if anyone could explain to me what exactly is happening in the script below: <– Begin Google Adsense code –> <script type=”text/javascript”> google_ad_client = “ad-client-code-goes-here”; google_ad_slot = “ad-slot-code-goes-here”; google_ad_width = 300; google_ad_h...

How do I stop a page from unloading (navigating away) in JS?

Does anyone know how to stop a page from reloading or navigating away? jQuery(function($) { /* global on unload notification */ warning = true; if(warning) { $(window).bind("unload", function() { if (confirm("Do you want to leave this page") == true) { //they pressed OK alert('ok'); } else ...

loading javascript file in ASP.NET for a single page

I'm using ASP.NET with a master page containing a script manager. I want to add a javascript file to only one page, but all pages inherit from the master. What is the proper way to accomplish this? thanks in advance ...

Prompt user for unsaved changes when leaving webpage

What options do I have preventing the user from just closing the browser or navigating to another site? (of course I can't prevent him pulling the plug on the computer, etc.: I just want to show him a warning) ...

how do I launch an ajax request after the prior on has finished ?

Hi, I need to launch serveral ajax requests. For some reasons, I want do this synchroneous. That is to say that before launching an ajax request I have to know if the prior request has been finished. The 'asynchronous : false" property of prototype's Updater object seems not work. // A loop to launch one after each other the reques...

javascript replace document.documentElement.innerHTML

in a html page, i have <html> <script> var cnt=''+document.documentElement.innerHTML+''; cnt=cnt.replace(......); </script> <body> something else</body> </html> how to use replace function above, so that my 'cnt' var content is like below <html> <body> something else</body> </html> ...