Is it possible to call a JavaScript function from the IMG SRC tag to get an image url?
Like this:
<IMG SRC="GetImage()" />
<script language="javascript">
function GetImage() {return "imageName/imagePath.jpg"}
</script>
This is using .NET 2.0.
...
I am trying to bind an event to a "method" of a particular instance of a Javascript "class" using JQuery. The requirement is that I in the event handler should be able to use the "this" keyword to refer to the instance I originally bound the event to.
In more detail, say I have a "class" as follows:
function Car(owner) {
this.owner =...
Documentation can be found here
It says in the example:
onDrop:
Called whenever a Draggable is released over the Droppable and the Droppable is accepts it. The callback gets three parameters: the Draggable element, the Droppable element and the Event. You can extract additional information about the drop – like if the Ctrl or Shift key...
My website makes a lot of requests. I often need to cancel all current requests, so that the browser is not blocking relevant new requests.
I have 3 kinds of requests:
Ajax
inserted script-tags (which do JSONP-Communication)
inserted image-tags (which cause the browser to request data from various servers)
For Ajax its no problem as...
There are two ways (that I know of) to create a JavaScript object. Which way do you prefer and why?
/* METHOD 1 */
function Foo() {
this.Bar = function() {
alert("FooBar");
}
}
/* METHOD 2 */
function Foo() {
}
Foo.prototype.Bar = function() {
alert("FooBar");
}
I use the first method when I create my own obj...
I got this bad feeling about how I insert larger amounts of HTML.
Lets assume we got:
var html="<table>..<a-lot-of-other-tags />..</table>"
and I want to put this into
$("#mydiv")
previously I did something like
var html_obj = $(html);
$("#mydiv").append(html_obj);
Is it correct that jQuery is parsing html to create DOM-Objects ? ...
I know you can just use CSS to hide the DIV or Silverlight Plugin, but is there a way to instantiate a Silverlight Component/App using JavaScript that doesn't show any UI element at all?
There is alot of great functionality in Silverlight, like MultiThreading and compiled code, that could be utilized by traditional Ajax apps without usi...
For example, see the MySQL website. It's only going to be used to rotate through about 3-5 "ads" to noteworthy areas of the site. I'd like to have some kind of link control to backtrack to the other content (again, like the MySQL site). Google gives me a bunch of very easy to implement stuff for the rotation itself, it's the link control...
I'd like to use Javascript to calculate the width of a string, is this possibly without having to use a monospace typeface? If it's not built in my only idea is to create a table of widths for each character but this is pretty unreasonable especially supporting unicode and different type sizes (and all browsers for that matter).
Thanks...
I'm using Webkit-sharp to embed Webkit into an application and I need to hook certain links to perform actions in my app rather than their normal action.
I've considered using Javascript to iterate over the anchor tags and replace the ones that match with the proper link, but I'm wondering if this is the best way. Is there a preferred ...
I have Drupal 5 site where a button is clicked and it calls a JavaScript function. The function basically builds a string, and then redirects to another page on our site. After clicking the button, sometimes the user gets logged out and sees the "Access Denied" screen, even though they were previously logged in. The page where they are b...
Say I have a web service http://www.example.com/webservice.pl?q=google which returns text "google.com". I need to call this web service (http://www.example.com/webservice.pl) from a JavaScript module with a parameter (q=google) and then use the return value ("google.com") to do further processing.
What's the simplest way to do this? I a...
My question is possibly a subtle one:
Web services - are they extensions of the presentation/web layer? ..or are they extensions of the biz/data layer?
That may seem like a dumb question. Web services are an extension of the web tier. I'm not so sure though. I'm building a pretty standard webform with some AJAX-y features, and it se...
Dynamically creating a radio button using eg
var radioInput = document.createElement('input');
radioInput.setAttribute('type', 'radio');
radioInput.setAttribute('name', name);
works in Firefox but not in IE. Why not?
...
The following question has been eating at me for the last couple months. After witnessing the quality of the replies here, I'm hopeful that I'll get some great responses here.
I'm TAing a course in the ECE department entitled "Exploring Digital Information Technology", intended for non-majors to get their feet wet with the whole "how c...
I have noticed that some browsers (in particular, Firefox and Opera) are very zealous in using cached copies of .css and .js files, even between browser sessions. This leads to a problem when you update one of these files but the user's browser keeps on using the cached copy.
The question is: what is the most elegant way of forcing the...
I've been trying to figure out how to print in Adobe AIR. I know the standard javascript functions don't work. The AIRforJSDev guide says:
"The window.print() method is not supported within Adobe
AIR 1.0. There are other methods available via the exposed AIRAPIs that give you access to printing within the runtime"
But I can't find thos...
Hi
Im running a ASP.NET Site where I have problems to find some JavaScript-Errors just with manual testing.
Is there a possibility to catch all JavaScript-Errors on the Client Side and log them on the Server i.e. in the EventLog (via Webservice or something like that)?
Thanks for your answers!
...
I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text:
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</p>
<p>
Quisque bibendum sem ut lacus. Integer dolor ullamcorper libero.
Aliquam rhoncus eros at augue. Suspendisse vitae...
I need to write a java script. This is supposed to validate if the checkbox is selected in the page or not. The problem here is that the check box is inside a grid and is generated dynamically. The reason being the number of check box that need to be rendered is not know at design time. So the id is know only at the server side.
...