javascript

Preventing JavaScript Injections

What's the best way to prevent javascript injections in a VB.NET Web Application? Is there some way of disabling javascript on the pageload event? Recently, part of the security plan for our vb.net product was to simply disable buttons on the page that weren't available to the specific user. However, I informed the guy who thought of ...

Javascript date picker for displaying one week only?

Hi, I am looking for a Javascript-based date picker that would allow me to display one week only (instead of the current month). Ideally it should be one that can be expanded to a full month view if necessary and back again. Also, (css based?) design customizability would be a plus. A jQuery solution would be preferred. I've had a...

set focus on a pop-up with music playing

hi, again trying to do music in a homepage. The music should play on load ... this is how i try to do it. setting up a "window.open" like function Audio() { MyWindow = window.open('mp3/mp3player.html', 'mp3player', "width=130,height=120,left=0,left=100,top=100,location=no"); MyWindow.focus(); } and an Now the music plays ...

Just when I think I finally understand Javascript scope....

I run in to something that illustrates how I clearly don't get it yet. Can anyone please explain why the value of "this" changes in the following? var MyFunc = function(){ alert(this); var innerFunc = function(){ alert(this); } innerFunc(); }; new MyFunc(); ...

How to Prevent an Applet from Unloading across web pages?

I have a large applet that takes some 40 seconds to initialize (cabs are cached so ignore download time for this question). The issue is, if the user goes to Page A which launches the applet (single window) and then navigates to page B, the applet is unloaded. If the user goes back to Page A, they incur the 40 seconds init time once ag...

Vim style folding for CSS/javascript in Visual Studio

Is anyone aware of a way to have VIM style folding in Visual Studio? I use #region blocks in c# class files and they're great, but unfortunately there's no equivalent functionality for javascript and css. The site/app I'm currently working on has a rather lot of css selectors and javascript and navigating the monolithic files is becoming...

How can I embed a scrollable text box to output text on my web page?

Is it possible to embed a scrollable text box to output text on my web page, in HTML or JavaScript? I am trying not to use any Java libraries if possible. ...

Mixing Asp.net default validation with a custum submit action

I have a page whose submit buttton does dot submit at all. It rathers has a some javascript in OnClientClick that employs some logic and redirects the user to a calculated URL. The thing is I want to use ASP.net default validation in this setup. I need to be able to query the state of the client side validation in the javascript. How do ...

iPhone-like (slot machine) 'picker' select box for the web?

I'm looking for a iPhone-like "picker" control that I'm able to use on the web. Accessibility is not a concern. JavaScript will be available on all clients and the web app will be run on an environment provided to the user. If the solution could gracefully degrade to a select box though, that would be great. Flash & Silverlight are not...

I want to get diff Controls Id through java script?? as any control can be added on form script will return the type of Control and its ID

I want to get diff Controls Id through java script??any control can be added by user on form java script will return the type of Control for ex textbox,label and its ID ...

How to do with pointing the target html when doing xml transformation?

Hello everyone. I want to generate a treeview from xml by xsl. In the output html, there are 2 frames: treeframe for the treeview and contentframe for displaying the content of the nodes when I click on the tree. I wrote a tree.xsl to generate the tree from the xml, a result.html who constructs the frameset and has js function, popul...

Save and Run JScript function into ActiveXObject field

Hi, I'm using ActiveXObject writted on C# and hosted in Internet Explorer: <object id="exControl" classid="http://localhost:81/excontrol/ExpandoControl.dll#ExpandoControl.ExpandoControl"&gt; </object> My exControl has NormalField property of object type (but I've tried to use JScript.FunctionObject class as well). So I'm trying to r...

jQuery animate problem

I have this jQuery code that slide an "em" tag up, on hover, and down on blur: $(".entries a").hover( function () { $(this).find("em").animate( { height:"100%"}, 500 ) }, function () { $(this).find("em").animate( { height:"0%"}, 500 ) } ); html code <div class="entries"> <a href="http://www.website.com"&gt; <em>Descri...

Passing a boolean value in my .net MVC view to a javascript, but JS doesn't accept True, wants true

Hi, I am passing a boolean value to a javascript function in my .net mvc action page. problem is, it is outputting the value True and javascript apparently only accepts 'true' (in lower case). I don't want to hack the variable and make it a string and convert it to lower case in my action, but it looks like I have no choice? ...

Declaring a boolean in JavaScript using just var

If I declare a JavaScript boolean variable like this: var IsLoggedIn; And then initialize it with either 'true' or 1, is that safe? Or will initializing it with 1 make the variable a number? ...

Call URL before closing of Browser Window

I want to call an URL in the unload-Function of a Webpage but in the unload-function the get request is not working. My code looks like this: $(window).unload( function () { jQuery.get("someurl") } ); We want to be informed about the closing of the window for some logging of user actions. Is it possible somehow? If i add an alert...

Where would I use a bitwise operator in JavaScript?

I've read this (http://stackoverflow.com/quest...), so I know what bitwise operators are but I'm still not clear on how one might use them... Can anyone offer any real-world examples of where a bitwise operator would be useful in JavaScript? Thanks. Edit: Just digging into the jQuery source I've found a couple of places where bitwise ...

Jquery UI Tabs & jcarousel conflicting in IE

I've both the UI Tabs & jcarousel plugin in my webpage, all works good in all browsers apart from IE where i assume there's some sort of confliction as if i take out the jcarousel JS then the tabs works fine. Has anyone got any suggestion on this issue or how to fix it? Thanks <script type="text/javascript"> $(document).ready(function...

How do you detect support for VML or SVG in a browser

I'm writing a bit of javascript and need to choose between SVG or VML (or both, or something else, it's a weird world). Whilst I know that for now that only IE supports VML, I'd much rather detect functionality than platform. SVG appears to have a few properties which you can go for: window.SVGAngle for example. Is this the best way to...

Assigning a stylesheet in JavaScript creates good html, but does not show the styles.

I have some Javascript that is opening a blank window, assigning it with a stylesheet and then writing some text to it. This is all working fine except that the content is not having the styles applied to it. The code looks like this: var newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0'); var style = newWindow.document.c...