javascript

JavaScript getElementsByCustomTag('value')?

Hi, I know getElementsByName('something') that returns the elements with name="something", but I want to return a list of elements where custom="something", how would I do that? ...

Replace selected text in Firefox.

How can I replace the selected text with another text using PURE javascript, in Firefox? This I use to get the selection: var sel = this.getSelection(); var range = sel.getRangeAt(0); And also this important issue: I want to keep the original format of characters (of course the new string will have the right format ) The selection ca...

Variables going beyond scope?

my code: <html> <head> <script type="text/JavaScript" src="jquery-1.3.2.min.js"></script> <script type="text/JavaScript" src="jquery.center.js"></script> <script type="text/JavaScript"> $(document).ready(function(){ $('a').click(function(){ popup_AskYN("Want me to tell you what 1 + 1 is?",function(){ ...

javascript framework for JSON communication and DOM manipulation?

Hello, I am java developer, (using Spring-MVC) never worked much on javascript, But I would love to have ajax features like auto-complete, ajax-form-validation, 'server-backed-pagination for catalog (or grid)' in my applications.. And there are lot of frameworks like Dojo, prototype, YUI, jquery, etc. etc. so My question is.. which fra...

jquery animating multiple elements

Hi, I'm trying to do the following: I have two sets of DOM elements on a page. All elements in the first set carry the class display-element, and the second set of elements carry the class edit-element. Now I have a button (id=edit-button). When I click this button, I want all the display-elements to fade out, and all the edit-element...

jQuery ajax output as return of a function

I created a small php script that returns a mysql result depending on given post/get parameters. With this file I can now use the jquery.post or .get command to retrieve something from my database. The script always returns 1 value. So I tried to make a javascript function that returns the retrieved value from the database. This is wha...

Get <select> text using 'this' keyword

I am using following code: <select class="element select medium" id="inDistrict" name="inDistrict" onchange="setCookie('lastvalue',this.value,1);"> It is not taking: this.value. What else to use to get the DropDown selected text? ...

How can I attach "meta data" to a DOM node?

Sometimes I want to attach some kind of meta data to a HTML node and I wondered, what's the best way to do this. I can imagine the following: Non-standard attributes: <div myattr1="myvalue1" myattr2="myvalue2" > (Breaks validation) Re-use an existing attribute <div class="myattr1-myvalue2-myattr2-myvalue2"> (Requires parsing and some...

Multi-line elements in JSON?

Hi, I would like to use JSON for sending multiple variables like status, error-message and content to a Javascript function via Ajax. The problem I'm having is that I fetch the content from a database and almost all data that is sent back to the browser is multi-line. And because of that it seems like my JSON is not validated. An exam...

How to insert external stylesheet in JavaScript (dynamically)

...with right path. For example. I have script called foo.js. I'd like to insert stylesheet declaration which I can do with following instruction: $('head').append('<link rel="stylesheet" href="/template/foo.css" type="text/css" />'); Problem: I have to put full path to the stylesheet file. So instead of /template/foo.css I have to p...

Moving a div into another div

i have 2 main div: <div id="div1"> <div id="minidiv1">a</div> <div id="minidiv2">b</div> </div> <div id="div2"></div> I want move the minidiv1 into the div2 with jquery how can i do? ...

How do I wait for the slideToggle to complete before executing code?

I want to wait for the slideToggle effect to complete before executing the if statement and the fadeIn effect. div_to_move = $(this).parents("div.kind_div"); div_to_move.slideToggle(); if ($(this).html() == "+") { $(this).html("-"); $("div.kind_to", td).append(div_to_move); } else { $(this).html("+") $("div.kind_from", ...

Call AS3 MouseEvent function from JS

Is there any way to call MouseEvent function in as3 from JavaScript? I have HTML button and swf object, I need to sent a POST request from swf by clicking on HTML button. ...

How to execute random Javascript code on a web page?

Hello. I'm using htmlunit to test some pages and I'd like to know how can I execute some javascript code in the context of the current page. I'm aware that the docs say I'd better emulate the behavior of a user on a page, but it isn't working this way :( (I have a div which has an onclick property, I call its click method but nothing hap...

How to use this with JQuery

hi, how do i use this code with jquery, i know it's easy but it doesn't work for me. document.getElementsByTagName('html')[0].innerHTML.replace(/<!--|-->/g,'') ...

MooTools JSONP request not works with invalid password

I make a JSONP request using MooTools: var username = 'hsz'; var password = 'pass'; var req = new Request.JSONP({ url: 'http://api.blip.pl/profile.json', method: 'get', headers: { 'Authorization' : 'Basic ' + Base64.encode(username + ':' + password), 'Accept' : 'application/json', 'Content-Type...

How well is Objective-J documented? Is the documentation good enough to start using it seriously?

I consider going with Objective-J, instead writing plain JavaScript. But I wonder if the documentation of the language and the frameworks is good enough, since it seems like a very young development. ...

can i call one js file from another . .

i have an asp.net mvc app and i am trying to move all of my javascript out into js files. right now i have one called sharedfunctions.js which is used all over the place. the issue is that if i move some code into a js file that is calling a method in the sharedfunctions.js file, it no longer seems to work. what is the best way to be ...

HTML Javascript Rich Text Box (IDE)

I am hoping to build an IDE in javascript that behaves much like gmail except the style will change automatically based on what they type as they type. The logic for this isnt where im struggling. Its how gmail achieves the ability to edit in a rich edit format in html. As far as I know the textarea control does not work this way, so how...

Rotating Product images so they look like there merging into a differnent view

Imagine a page with three thumbnails on of differnent product views. When you click on a view the main image div would quickly transition into the new view. Say it was a shoe i was photographing and it had a sole view, top view and side view. My question is is there any way of giving the illusion of a spin e.t.c from one view to anot...