javascript

the best way to make a gallery page

hi, Just wondering if someone could tell me the best way to make a gallery page, cos at the moment I'm using images inside the html and as the page and images are getting more the page takes for ever to load, so I'd really appreciate it if you could tell the practice regarding different galleries on one page. thanks ...

Why does Firefox lose focus on page reload?

Hi I have two instances of Firefox running simultaneously next to each other. One window is in the front and the other one in the background. Both instances use the same target URL. Whenever I do a page reload in one of my instance the other instance loses the focus and gets minimized to the Windows taskbar. Has anyone ever experience...

Why is my application not working in IE?

I create a table programmatically in javascript like this and do a innerhtml on a div. It works fine in firefox but IE screws things up. Obviusly the sucker exists in IE. But when I inspect the thing in IE8 I see that a class and a id on link element is without ", but they should be there. Can these be the problem? var create_table...

Jquery Tablesorter sort same column after update

I have a table which is updated with ajax and after update it if sorted but I need to sort not a fixed column but the same column which was last clicked before update. function tableUpdated() { $(".tablesorter").trigger("update"); //alert($(".tablesorter").sorting); var sorting = [[7, 0]]; $("table").trigger("sorton", [sorting]); } In...

How to make js code invisible?

I have a php page, where at the bottom of the page I have some javascript code. I use php inside the javascript code, like this: alert ("<?php echo $variable; ?>"); If I put this in a separate file, this wont work for some reason. Is there anyway to make it work from a separate file without too much difficulty? Or is there another w...

problem regarding transition

How to put transition on a web page? I have tried, but it doesn't worked on internet explorer. how to add transition during opening page? transitions effects like fades,dissolves etc. same as in ppt's ...

How do I change button Text on Click MVC?

I have a toggle button, with a show/hide feature in javascript. How do I change the text when the button is clicked? <button id="ShowHide">Show</button> ...

how to hide a div in javascript with onblur - rails

i have a link_to_function that shows a hidden div. now i would like to hide this div if the user clicks out of this div(onBlur or onclick). when should i call this function and how? this is my function that shows the hidden div: <%= link_to_function "ShowHorse", "$('horsePic').show();" :class =>"links_02"%> shoud it be from inside thi...

unobtrusive javascript pain points to beware of

I have recently started learning unobtrusive JavaScript. Using JQuery its really fun. However with this thinking of writing JavaScript code has come a real long way from traditional ways. Also adding quick onclick="fun()" is helpful sometimes and as the application grows 100% unobtrusive code "sometimes" become difficult to write. Like ...

jquery passing a variable to a function

Hay guys, I'm making a simple preload function (function($) { $.fn.preload = function(settings) { var config = { before: function(){ return; }, end: function(){ return; }, after: function(a){ return; } }; if (settings) $.extend(config, settings); var limit = this.length - 1; var counter...

Using Visual Studio 2010 for AJAX?

I'm doing a short AJAX project, and I'd like to use Visual Studio 2010. It's just xHTML and JavaScript, with calls to a serverside .php file. What is the best way to set up a project/solution for this in VS? I see a lot of project templates having to do with ASP.NET. Also, when I choose to Add New Item, I get "Ajax Client Control", "Aj...

How to get redirected url in C# WebBrowser Control

I have a webpage that loads, does some calculations and then does a JavaScript redirect to another webpage. It looks something like this: http://www.mysite.com/startpage.html <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> $(document).ready(function() { window.location = "http://www.mynewurl.com"; }); </head> <bo...

How to call Struts1 Action from Ajax or JavaScript?

...

JQuery : Can you Ignore html in string While doing a Replace?

Is it possible to ignore the html elements when doing a replace? Sample code: $myText.replace(new RegExp( $searchString, 'gi' ), '<span class="highlight">'+ $searchString + '</span>'); $myText is a large string of html e.g. var $myText = "<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has ...

JavaScript: trouble assigning event handlers

I'm not sure what I'm doing wrong here: index.html <?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "XHTML1-s.dtd" > <html xmlns="http://www.w3.org/TR/1999/REC-html-in-xml" xml:lang="en" lang="en" > <head> <script type="text/javascript" src="scripts/eventInit.js"></script> </head> <body> <p id="javas...

How can I get the window in which an object was defined?

I would like to check if an object is an instanceof a certain built-in class. The problem is that my checking code might not be in the window where the object is defined, so x instanceof String would return false even though x is a String. What I need is something like x instanceof getWindowOf(x)['String']? But is it possible to define a...

Toggle text on button tag

I have a show hide table rows feature but would now like to change my text. <script language="javascript" type="text/javascript"> function HideStuff(thisname) { tr = document.getElementsByTagName('tr'); for (i = 0; i < tr.length; i++) { if (tr[i].getAttribute('classname') == 'display:none;') { if (t...

Javascript remove/addChild problem in IE

Hello. I've got an HTML page with a select and another control. I want the type of the second control to dynamically change depending on the value selected in the first control. Here's the html code: <form name="myForm"> <select name="tagName" onChange="changeControl(document.myForm.customControl, document.myForm.tagName.val...

How to uncheck Radio Buttons with regex?

How can i uncheck all radio button using jquery or javascript? The radio buttons i want to uncheck begins with the id=favoritepreferred12333 and the name favorite12333 the numbers 12333 can be different on other radio buttons, but they all begin with id=favoritepreferred{number} and the name=favorite{number} I think i have to use some r...

Setting One Drop Down after Selecting from Another

I have a couple select elements: <select name="empID" onchange='setSupervisor(this);'> <option value="111" sid="222">Eric Employee</option> ... </select> <select name="supervisorID"> <option value="333">Susie Supervisor</option> <option value="222">Stan Supervisor</option> </select> And a javascript function: functio...