javascript

Ways to make Javascript code hacking / injection / manipulation difficult?

Are there ways to prevent, or make it difficult enough, for someone to inject Javascript and manipulate the variables or access functions? A thought I had is to change all var names randomly on each reload so the malware script would need to be rewritten every time? Or are there other less painful ways? I understand that eventually some...

Javascript:parent in jquery

onmouseover="javascript:parent.DivColorHover(this)" i have a div in which values are created dynamically, i use this div as popup so that it will be used as dropdown list elements. onMouseOver of each value i am changing background color using the above line of code in javascript. how do i achieve the same in jquery ...

dojo dojo.data.ItemFileWriteStore slow....?

Hi all, I've got some code that requests some data from a servlet, and renders it in a dojox.grid.DataGrid. This seems to be rather slow though! I'm stuck on how to make it faster. Can anyone help out? I'm testing with Dojo 1.34 FF & Chrome. My code remove all items in the dojo.data.ItemFileWriteStore, then adds new ones that come b...

Calling javascript function from HtmlAgilityPack

I want to use HtmlAgilityPack in a form application to read some pages content but on the page search subpage I need to invoke the javascript and the link looks like this: <a href="javascript:__doPostBack('lnkbtnNext','')" id="lnkbtnNext">Następny >></a> How can I Call this function from my C# desktop application? ...

Scrolling to the top of a page in a gwt application

I've got a gwt application and I want to scroll to the top of a page using this method: public static native void scrollTop() /*-{ $wnd.scroll(0, 0); }-*/; The method is called in the onClick-method of a TreeNodeListenerAdapter: new TreeNodeListenerAdapter() { @Override public void onClick(Node node, EventObject e) { scroll...

Jquery Showcase how not to return to the first item on finish

I have a bunch of images being shown using JQuery Showcase. Everythin works just fine except one thing - I need it continue sliding when after it shows last item - so it keeps going from right to left showing the first item etc after last item shown. Now it visualizes all the previous items sliding them from left to right to the first it...

jQuery : Animate Widths of Adjacent Floating Divs

I'm playing around with a little jquery animation and trying to achieve a very specific effect. If anyone remembers the old Xbox menus with the panes or 'blades' as they called them, I'm going for something like that using a series of left floating divs. When the page loads, one pane is active and has a large width, displays some inform...

What's the ultimate way to embed Flash (swf) files to HTML (and XHTML) documents?

Like most people I use SWFObject to embed Flash (swf) files to my Web projects. As you know SWFObject offers 2 ways to embed Flash: Static publishing and Dynamic publishing. Static publishing uses regular markup to embed the file to the document and also do checks with JavaScript that you can't make with regular markup alone. This is g...

jQuery - hidden input value from select inputs

Hi I have something like this: <select class="bla"> <option value="1">...</option> <option value="2">...</option> </select> <select class="bla"> <option value="1">...</option> <option value="2">...</option> </select> <select class="bla"> <option value="1">...</option> <option value="2">...</option> </select> <input class...

Jquery - How do you pass a variable into a function to use?

Hi, I am stumped by a problem which i'd assume is a common Jquery occurence, but i've no idea how to fix! I have 5 variables - var pubtimed var toolstimed var newstimed var mylinkstimed var partnerstimed Which are used to store on and off states. I then have a script that checks cookies for recent states and updates the va...

Google Maps doesn't work when inside a div

I'm trying to use the Google Maps API and the div that is going to contain the map works only when not inside another div. I've created a little sample code with two maps, the first works the second doesn't. If I remove the doctype of this piece of code, both work. Any ideas why? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ...

How to alert when url contains[...]

How can I disable an input-field with jQuery using GM if the url contains text? I tried $(document).ready( function() { if($("url:contains('text')")){ $(".input[id=field-owner]:disabled"); } else { $(".input[id=field-owner]:enabled"); } }); I don't know what I did wrong. And I also don't know whether u...

getElementById won't work.

Hi guys, I'm just starting to learn JavaScript and can't figure out why getElementById won't work? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <meta http-equiv="Content-Type" content="text/html; charset=...

Where does Appcelerator Titanium Mobile cross-compile JS to native code?

From the question "How Does Appcelerator Titanium Mobile Work?" I know that the JS is cross-compiled into native code. But where does this happen? I couldn't find any code for this in the open source Titanium code. The website of Appcelerator also is quite sparse on the cross-compilation part of the process. ...

How to set JQuery .show / .hide without repeating Div selectors.

I want to pass this function a True or a False and have the elements listed show (true) or hide (false) on this input. I am currently using this function... function SetElementVisibility(visible) { if (visible) { $("#Div1").show("slow"); $("#Div2").show("slow"); $("#Div3").show("slow"...

Regular Expression help

I apologize, but I'm terrible at understanding regular expressions. Could anyone help me with a simple problem? I need one regex to match everything before and one to match everything after a certain character, like a colon. foo:bar Something to match 'foo' and something to match 'bar'. ...

Register Javascript file to aspx page from WebReousrce

How do i add my javascript file as an embeded resource to the page after the ajax javascript already on the page? NB want to do this part dynamically to have code wrapped up in usercontrol. in aspx page: scriptmanager Code: Assembly: WebResource("Functions.js", "text/javascript") Code: onPreRender: ScriptManager.RegisterClientScrip...

Write a file with Prototype or plain Javascript

Hi dear Stackers, I know the question has been asked thousands of times, but I'll ask it again: is there a way (even patchy) to write/read a dumb text file with Javascript or Protoype ? This is only for debug purposes, and is not designed for production. The thing is I need it to work with (at least) both Firefox and IE (preferably un...

ASP.NET drop down list filtered by JavaScript + button postback error

I have an asp.net drop down list that has a number of items, users are allowed to type some text into an asp.net textbox and javascript will filter the data in the drop down list. This all works perfectly until the user enters text that matches no item. When this occurs I create a new option in javascript with "no XXX found" with a value...

how to pass array variables based on condition to php using post method

I have an array: $k[23]='something'; $k[44]='something more'; If a user enters 2,3 and presses 'go' in a virtual 10 digit keypad (will look like a calculator), I need to pass 'something' to browse.php. If the user press 4,4 and press go, then i have to pass 'something more' to browse.php. Any ideas? I am new to javascript/php ...