javascript

manipulating embed src tag in javascript

i want to handle embed tag in java script here is my code but the pdf doesnot appear and i don't know why function showbook(Object) { switch(Object.id) { case "a": document.getElementById("em").src="majorSins_2.pdf"; break; } } and in html document <embed id="em" src="" width=600 height=600 border="2"/> ...

Strange issue with jQuery and integration between xsl and javascript

Hallo all I got this piece of html code generated from a xsl file. <html id="lista_movimenti"> <head> <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta content="text/css" http-equiv="Content-Style-Type"> <meta content="text/javascript" http...

Load ajaxdata in HTML or JSON-format?

What's a better practice? Load data in HTMLformat or JSON-format? When I load HTML i'm able to keep all the html in my php view-file. When i load JSON I have to put it in html elements clientside with javascript. I know that a 'best-practice-question' isn't suitable for stackoverflow. So a better answer to my question is a list of benef...

JavaScript: Replace hexadecimal character

I have a string such as "%2Fu%2F2069290%2F" in JavaScript (extracted from a web page). How do I get the human-readable version of that string? ...

onclick get thumbnail url id value

hopefully someone can help me. i want to get a thumbnail id value when an onclick event happens, but no luck, any ideas? thanks <a href="test.ca/images/image-1.jpg?id=1"; onclick="swap(this); getVa(); return false;">this is a small thumbnail image</a> Here is the js for swapping the thumbnail: function swap(image) { document.g...

Shape tween in javascript

Is there a way to do a shape tween in javascript? Using canvas maybe... ...

js/jquery coverflow effect

Hey, I try to archive a certain effect with js/jQuery: The Apple Mac OS X Coverflow effect which you can choose within finder. Can you point me to a gently & smooth working plugin? I love #roundabout for jquery but unfortunately they don't support that effect. I also tried some of the linked plugins of this post: http://stackoverflow.c...

javascript cross browser scripting help

Hi Guys, I have a tiny function I use to only allow numeric input. It works great in IE, but I cannot get it to work in FireFox or Chrome. I have this js file loaded in my script tag of my HTML page. var numberOnly = function(evt) { var theEvent = evt || window.event; var key = theEvent.keyCode || theEvent.which; key = String....

Deserialize complex JSON object using ASP.NET?

Hi! I've successfully created code that serializes a complex javascript object and posts it to an ASP.NET page. I can get the JSON string using Request.Form and the result looks like this (I've added indentation for readability): { "gasterPerStolPerVecka": { "name": "gasterPerStolPerVecka", "keyValue_id": "2", ...

how to handle download pdf from the web page using javascript

i want the user be able to download pdf from my web site using java script can any one help me or write me the code or how can i do this ...

[DOJO] Problem after Update to 1.41 (dijit.Dialog)

Hi there! If got a lil problem with dijit.Dialog ... I want to open a Flash Audio player inside the dijit.Dialog via an iframe! It all worked perfect with Dojo 1.37, but after the update, I canÄt see the Flash player! :( It actually works because you can hear the audio track playing, but the player is somehow covered so you cant see it!...

XSS security. Communication between 2 iframes from the same domain.

Domain abc.com has a page with 2 iframes. Both of them are loaded from domain xyz.com. Will XSS security block JavaScript access/communication/interaction between those two iframes? ...

wrap long text in a div

i am querying text from a DB. if the text ends to be too long, I want to be able to wrap the text after, say, 400 characters and display a "..." at the end. how can it be done? ...

JS: Most optimized way to remove a filename from a path in a string?

I have strings formatted as follows: path/to/a/filename.txt Now I'd like to do some string manipulation which allows me to very efficiently remove the "filename.txt" part from this code. In other words, I want my string to become this: path/to/a/ What's the most efficient way to do this? Currently I'm splitting the string and reconnect...

Is it always safe to change line breaks type (i.e. LF, CR+LF, CR) in javascript source ?

Can swapping newlines (e.g. by some text editor) break javascript code ? ...

Problem placing ContentPlaceHolder within <script> tags.

I have this in an ASP.Net Master Page: <script language="javascript" type="text/javascript"> <asp:ContentPlaceHolder ID="scriptContentHolder" runat="server"></asp:ContentPlaceHolder> </script> But when I try to view the content page in design mode it tells me there is an error in the associated Master page because "script...

Help with JS and functions parameters

Does JS support two functions with the same name and different parameters ? function f1(a, b) { // a and b are numbers } function f1(a, b, c) { // a is a string //b and c are numbers } Can I use those JS function for IE7, FF, Opera with no problem? ...

jquery ui dialog - button click event handlers

I'm a js noob. I'm using the jquery FullCalendar plugin which exposes an eventClick(calEvent, jsEvent, view) event which is called when you click on an event on the calendar. In my event handler I want to pop up a dialog asking if the user wants to edit just one occurrence of a recurring event or the whole event. The problem is that the ...

Javascript convert data from utf-8 to iso-8859-1

Hi, I work on a website which is all done in iso-8859-1 encoding using old ASP 3.0. I use Yahoo YQL to request data (XML) from external websites but which I request to be returned as JSON-P (JSON with a callback function so I can retrieve the data). The problem I am facing is that YQL seems to always return data encoded in utf-8, which...

Drop list options and submitting php page to self...

I have a php "add classified" page where users may fill in details in several drop-lists. At the bottom, I have a picture upload tool, which requires the page to submit to itself, and then preview that image. Problem is, whenever this is done the drop lists values are resetted, so the users have to re-select everything. I have asked th...