javascript

[Javascript] How to call JS to click a table element

Hi all: Assume I get a table element with ID="emTab", how do I call JS to click it? Thanks. ...

jQuery: Returns only part of a text

I want to write a jQuery function that will return only a part of a given text. For example, in the text: http://somesubdomain.somesite.com/ How can I write a function so that it returns the text "somesubdomain"? In other words, I want to "subtract" the text "http://" and ".somesite.com/". Thanks in advance ...

how to access the id of textarea in javascript

hi all, i have to acces the id of textarea in javasript.Please tell me how we can access the id of the textarea in javascript. ...

How to Implement Web Based Find File Database Via Text Search

I have series of files like this: foo1.txt.gz foo2.txt.gz bar1.txt.gz ..etc.. and a tabular format file that describe those files: foo1 - Explain foo1 foo2 - Explain foo2 bar1 - Explain bar1 ..etc.. What I want to do is to have a website with a simple search bar and allow people to type foo1 or just foo and finally return the gzipp...

How to check if object has any properties in JavaScript?

Assuming I declare var ad = {}; How can I check whether this object will contain any user-defined properties? ...

Javascript array value is undefined ... how do I test for that

I am trying to test to see whether a Javascript variable is undefined. You will see that I am not expecting the value of predQuery[preId] to be 'undefined' if I don't first get an alert saying "its unbelievable". But I often do, so I am guessing that my statement predQuery[preId]=='undefined') is not matching the undefined elements...

How to pass javascript function as a parameter in the route values of Ajax Actionlink

Hello experts, I need to pass javascript function as a parameter value to the ajax actionlink in asp.net mvc app. how can we achieve this? Thanks in advance. ...

How do i make a copy of an object? Javascript

I have a class in json format. I would like to make two instance. Right now (its pretty obvious why) when i 'make' two objects i really have 2 vars pointing to one. (b.blah = 'z' will make a.blah=='z') How do i make a copy of an object? var template = { blah: 0, init: function (storageObj) { blah = storageObj; r...

Javascript + PHP $_POST array empty

While trying to send a POST request via xmlhttp.open("POST", "url", true) (javascript) to the server I get an empty $_POST array. Firebug shows that the data is being sent. Here is the data string from Firebug: a=1&q=151a45a150.... But $_POST['q'] returns nothing. The interesting thing is that file_get_contents('php://input') does have...

How to include js file in ajax call?

Hi All, I am calling a ajax method to update a div. It contains links and functions which require java script files. But these methods and functions are not getting called properly as java script files are not getting included through ajax call. For example, i am trying to call a light box function, but it gets redirected to different p...

Jquery Basic Beginner Question: How do i make my function reusable?

I have spent the last few hours attempting to do this on my own, and using Google to find a solution but to no avail. So if you can help out i would super appreciate it! Basically I have a page which has 3 separate biographies in 'preview mode', which shows only the first paragraph of each bio. When you click on 'read more' for one bi...

Calling a javascript function from Page_Load in code-behind

How can I call a javascript function, that is in the aspx page, from the Page_Load method, in the code-behind? ...

Is there a way to jail in Javascript, so that the DOM isn't visible

I would really like to provide the user some scripting capabilities, while not giving it access to the more powerful features, like altering the DOM. That is, all input/output is tunneled thru a given interface. Like a kind of restricted javacsript. Example: If the interface is checkanswer(func) this are allowed: checkanswer( function ...

How do I pass values from grails back to a javascript function?

Hi, I have a feeling that the answer to this is easy but I can't seem to get it yet... I have a Javascript function that calls an action in a Groovy class via a remoteFunction. Now, I need to return the value from the action class back to the Javascript function for further processing. It looks something like this: // sample js functi...

How I can get logged in user's info like email id,name,city etc. in Facebook with uId

Hi all Can any one help me to get logged in user's info like email id,name,city etc. with the help of Facebook uId . " Long uid = apiClient.getLoggedInUser ();" Users_getInfo is not useful. It returns No of users connected to _User & according that there info gets. If user login successfully using fb connect, Facebook gives us ...

JQuery - Make my script work?

Hi, I have written a script. It does work! It's just a bit rubbish. Could someone tell me where I am going wrong. Basically, I have a 5 star rating box. When the mouse hovers over the various parts of the box I need the stars to change. Currently the stars only change when you move your mouse over and out of the element. I need the st...

Change Projection in OpenLayers Map

I want to set "EPSG:4326" as the projection of an OpenLayers map, but when I try it, I always get "EPSG:900913". function init() { var options = { projection: new OpenLayers.Projection("EPSG:4326") // ignored }; map = new OpenLayers.Map('map', options); var layer = new OpenLayers.Layer.OSM.Osmarender("Osm...

extending c# textbox control

I am extending the textBox control, and i want to call a javascript function on its OnLoad(EventArgs e). how can i do this? public partial class MyTextBox: TextBox { protected override void OnLoad(EventArgs e) { base.OnLoad(e); //call to a javascript function? } } ...

How to run code when elements are attached like jQuery's live() do with events?

I would like to run some code right after a certain set of elements are attached. jQuery.live() allows you to bind event handlers to elements, even if they are created later. But AFAIK there is no suitable method to do something like the following: $("some selector").live("attach", function() { $(this).whatever(); }); How can I accomp...

Extjs cache JSON request

Hi i'm using Extjs and i have built a grid with editable cells. One of this cells must be a combobox that takes its options from a script that generates the json data. The code for the grid and for the combobox-cell-editor works but i want that the json request to the script is cached after the first time, is it possible? I write some c...