javascript

How to: jQuery cycle lite plugin (image rotator plugin) manually set images by ID

Hello I am using jQuery cycle lite plugin (image rotator plugin), and I want to use the middle example (click triggers) but instead of setting the IDs of the prev and next button, I'd like to manually set the image ID. My aim is to have a list of thumbs on the bottom of the page, and when thumb clicked set the large image in the 'slides...

How to turn a String into a javascript function call?

I got a string like: settings.functionName + '(' + t.parentNode.id + ')'; that I want to translate into a function call like so: clickedOnItem(IdofParent); This of course will have to be done in javascript. When I do an alert on settings.functionName + '(' + t.parentNode.id + ')'; it seems to get everything correct. I just need t...

How to Raise Events from VB.Net ClassLibrary/UserControl (ActiveX) to JavaScript?

I've created a VB.Net ClassLibrary with a UserControl in it. I can load it from an HTML page and call the methods that I created. This works as expected. I've tried several examples for how to raise an event from the VB code to the js caller, and none of them seem to work (I'm using IE7). What I'm doing: Public Class ctrlABC Public ...

JQuery to load Javascript file dynamically

I have a very large javascript file I would like to load only if the user clicks on a certain button. I am using jQuery as my framework. Is there a built-in method or plugin that will help me do this? Some more detail: I have a "Add Comment" button that should load the TinyMCE javascript file (I've boiled all the TinyMCE stuff down ...

Include JavaScript file in partial views

I am wondering what the best practice is for including javascript files inside partial views. Once rendered this will end up as a js include tag in the middle of my page's html. From my point of view this isn't a nice way of doing this. They belong in the head tag and as such should not prevent the browser from rendering the html in one ...

Importing a JSON feed from an external source in Javascript

I'd like to load a JSON feed from an external source using Javascript; what's the best method? I've been working a lot in PHP where it would be easy to do so with file_get_contents or cURL. Is there a related function or process in Javascript? ...

Write content from server if JavaScript is not enabled

I am working on a project that by default loads content via AJAX. I want it to check if the user (or SE bot) has JS disabled, and if so display the content statically via PHP. Is there a way to do this? I don't think noscript tag would work here, as the page would be empty to the non JS users or bots. Also doing a redirect to a differ...

getting containing div of an iframe

I've got this structure: <div id="source1"> <iframe src="foo.html"></iframe> </div> <div id="source2"> <iframe src="foo.html"></iframe> </div> If I've got some js code inside foo.html, is there a way to tell which div it's in (without adding a parameter to the iframe code)? ...

How can I find the position in the page of an element using jQuery?

I'm aware of the position method, but that retrieves the position relative to the offset parent. Do I just throw in a loop to transverse up the document nodes? I guess that I'm surprised that it isn't part of the core, and I'm wondering if it's tucked away somewhere that I don't know about. ...

Can Javascript toggle frameborders?

I'm trying to use JS to toggle a frame's frameborder attribute. Here is my test case: <html> <head> <script type="text/javascript"> function off() { var f1 = document.getElementById("f1"); var f2 = document.getElementById("f2"); alert ("before, frame f1 had frameBorder=" + f1.frameBorder); f1.frameBorder ...

Comparing two fields in a form in Javascript - Not working

Can anyone tell me what I am doing wrong? my comparePasswords() is not working... <script> function comparePasswords() { if (post-form.password.value != post-form.password2.value) { $('passwordShow').innerHTML = ''; } else { $('passwordShow').innerHTML = 'Passwords d...

How to give a page focus again so that the space bar pages down in FF?

I have an ajax script with a "get more posts" button that inserts a couple screens/viewports worth of information. In doing this, the document looses focus at some point and thus the default behavior of the space bar (page down) doesn't work in firefox. How can I focus the document again to regain the default behavior? What components c...

jQuery Ajax grid

Hello, We are starting a new ASP.NET MVC application and want to use an jQuery Ajax grid. I came across following options: - jqGrid (better than Flexigrid because it supports editable cells) - Flexigrid (looks better than jqGrid) - tablesorter - Ingrid - jqGridView - OTHERS? Which is the best choice for jQuery Ajax grid ? W...

Problem using jQuery cycle plugin as image rotator and a pager

Hi all! I am trying to use jQuery in order to make a pager for tumbs and large images and I don't succeed. I am using this example from jQuery's site, I think I followed the direction but it doesn't seem to be worknig. I do see only the first image and not all of them, but no pager. Am I missing something? So here is my HTML: <!DOCTY...

Passing info from JS to ASP server side

Hello all, I've been trying to somehow get my javascript function (which I have in the head section of the aspx page) to set a value in a hidden item, then some how have the server-side (trusty 'ol ASP) read that data so I can do some work depending on what it is. I have my entire page wrapped in an update panel, and my drag 'n drop woe...

Javascript match and replace with unicode

I have some javascript which reads some cookies, and does some matching. I am using groupings to catch parts of a regular expression and use them later. I am having an issue with unicode characters though. If I have a character like \u25BA ►, when I find this character in a grouping, it returns the string '\u25BA' instead of the unicode ...

How to simulate JavaScript in a client C# Applications

Hi Guys. I'm writing a web crawler (web spider) that crawl all links in a website. My application is a Win32 App, written in C# with .Net framework 3.5. Now I'm using HttpWebRequest an HttpWebResponse to communicate with the web server. I also built my own Http Parser that can parse anything I want. I found all link like "href", "src", "...

DRY jQuery for RESTful PUT/DELETE links

I'm putting together PUT/DELETE links, a la Rails, which when clicked create a POST form with an hidden input labelled _method that sends the intended request type. I want to make it DRYer, but my jQuery knowledge isn't up to it. HTML: <a href="/articles/1" class="delete">Destroy Article 1</a> <a href="/articles/1/publish" class="put">...

Why execution time is longer after the first try? (javaScript performance test)

While doing some JavaScript performance tests I came up with the following piece of code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Performance Test</title> <script...

What are some methods to disable or correct for backward browsing in web apps?

Some web apps 'by design' don't function well when user's hit the back button in the middle of a procedure. What are some ways to disable or correct for users hitting the back button in vulnerable app sections? ...