javascript

Are Javascript date/time functions dependent on the client machine?

I was wondering if Javascript date/time functions will always return correct, universal dates/times or whether, Javascript being a client-side language, they are dependent on what the client machine has its date set to. If it is dependent on the client machine, what is the best way to get the correct universal time? ...

Creative ways to converting a Collection of objects to a javascript array in c#

Hi, I have a List of users List<Users> and I need to make a javascript array of all the UserID's. I know I can manually build this using a stringbuilder and loop through and then save it to a variable and show it on my asp.net-mvc view page. Any other more creative ways to do this? ...

rotate a set of images in an ellipse

How can I rotate a set of images in an ellipse without using jquery? how to get each point on a ellipse at some center(x,y)point ...

Draggable+Sortable & Scrollable Divs

I have a container with a list of draggable items and container with a list of sortable items. The draggables & the sortable list is connected, allowing the user to drag clones of the draggables to the sorted list. The draggable items appear in a vertical list, however the sortable items appear in a horizontal list, achieved by floating...

Whats the advantage of using a constructor function in a JavaScript object?

What's the advantage of using a constructor function like so: var MyLibrary = new function(){ var self = this; self.MyLibrary = function(){ // init code } } Instead of simply writing code inside the object? var MyLibrary = new function(){ // init code } ...

Open new browser window on click of a form button

I want to open a new browser and load a page from the file system (which will be created on clicking that button). My app is a java servlet. Basically I am allowing users to change some HTML on their website. On clicking the button the user get's to see a preview page, that shows what the page looks like with the changes made. What woul...

Restrict Textarea for not accepting 250 character.

Dear All, I have a textarea in C#, please see below code: <asp:Label ID="lblQuestions" runat="server" CssClass="addinfo"> Question & Comments</asp:Label> <asp:TextBox ID="txtQuestions" Rows="5" Columns="5" TextMode="MultiLine" runat="server" MaxLength="250"></asp:TextBox> Now I want that textarea should not accept...

Converting .NET DateTime to JSON

Hi, My webservice is returning a datetime to a jQuery call. The returned data is /Date(1245398693390)/ How can I convert this to a javascript friendly date? ...

How to show url address bar for safari using MM_openBrWindow()?

Hi! I am using function MM_openBrWindow() to open new window. Here is the javascript. function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); return false; } This is how the function is called. <a href="index.php" onclick="MM_openBrWindow('index.php','','scrollbars=yes,menubar=0...

How to implement the functionality of autoscrolling page if the element is below page fold in javascript?

Hi, I want to implement a similar functionality like Template Monster's menu. I am trying to create a feature list which slides down when the user clicks on the feature. But if the link is at the bottom of the page and the user clicks on that link, the feature list is shown below the view area and the user doesn't know that it is open u...

Dynamically set value of a file input

Is there a way to set the value of a file input (<input type="file" />) or is that all blocked for security? I'm trying to use google gears' openFiles to make a simple multi-uploader. ...

Disable dropdownlist based on the selected value of another

Hello, This may be a stupid question, but I'm still learning so do forgive me if the answer is obvious :) I have a test page with the following on: <select name="ddlRoles" ID="ddlRoles" OnChange="DisEnableDDL();"> <option value="-1">Fresh Milk</option> <option value="2">Old Cheese</option> <option value="3">Hot Bread</option> </select...

Pass vars to JavaScript via the SRC attribute

In my HTML file I have linked to the JS with: src="myscript.js?config=true" Can my JS directly read the value of this var like this? alert (config); This does not work, and the FireFox Error Console says "config is not defined". How do I read the vars passed via the src attribute in the JS file? Is it this simple? ...

UTF chars retrieved with AJAX are not shown in Safari

Hi, I have problem rendering content retrieved via Ajax into my HTML page under Safari (v.4). The page is stored in UTF-8, Ajax response is also UTF-8 encoded. The loaded content is parsed and then different types of lists are populated with the parsed data. One of them is simple < select > element where the text of the option is set u...

Google Maps GDirections - Not Centering/Zoomimg in IE7

Best way to describe this problem is with a link. Please visit this page: Ruby International | APOAds.com In FireFox, everything works fine. In IE it load the directions but does not center on them. Perhaps it's only my PC, does it work on yours under IE? Here's the javascript doing the brunt of the work: $(function() { // panoram...

window.opener in safari and chrome

I have a page that creates a popup window, then in the new window i created a new button element and attach a onclick event then attach it to the parent window. var openerDoc = window.opener.document; var newButton = openerDoc.createElement('button'); newButton.onclick = function(){ window.opener.fn(); return false; } var anElement...

insertCaret using javascript

I found some code using google search: function insertAtCaret (textarea, icon) { if (document.getElementById(textarea).createTextRange && document.getElementById(textarea).caretPos) { var caretPos = document.getElementById(textarea).caretPos; selectedtext = caretPos.text; caretPos.text = caret...

ThickBox Problem on firefox (overflow:hidden no work)

Hi, i need a help with thickbox. I use it in my website, but a function of overflow:hidden, dont work in firefox, just in IE. Someone can helpme? thanks... html and css no problem, my problem is thickbox, becausa it work in IE 6 or 7, but no in mozilla(all versions). look the code; function tb_show(caption, url, imageGroup, leg, ttlTb)...

javascript reference in xslt

I have a javascript file. how can i reference that file from within XSLT. ...

Finding JS error - "Stop running this script?"

I am working on a ASP.NET webpage that is rather complex with ajax, callbacks, javascript etc. I encounter this error intermittently: Stop running this script? A script on this page is causing IE to run slowly... Any help in finding the culprit is really appreciated. ...