var phoneBookTableValue = [];
phoneBookTableValue.push({ "key":"1", "value":["3396,Accounting ,CCH,,,,","1"]});
phoneBookTableValue.push({ "key":"2", "value":["3284,Acute Care ,CCH,,,,","2"]});
phoneBookTableValue.push({ "key":"3", "value":["3265,Acute'Care East ,CCH,,,,","3"]});
When running the javascript file I get the error "missing ] after element list. Can U help me? PLZ!
i have a set of hyperlinks with href = javascript:method('category1') and likewise category2 category3 ...
I want to select hyperlink with href containing category1 so i have written
jQuery(a[href*='category1']) but dont know why it also selects hyperlinks with category10 category11 category12 ... also
I understand that category1 is common in all of them but 'category1' should'nt be do i need to put ' with escape charaters.
jQuery is undoubtedly the best javascript framework available and its plugin base is also pretty awesome. I wanted to know which one is the best framework in terms of
Use Of Plugin
API Design
Ease Of Use
Documentation
Support and Bug fixes
etc...
In my view the best plugins I used so far are
Form plugin
Validation
Nyromodal
jQuery drag&drop, Sortable
EDIT: Made it a community wiki
Hi at all,
I want to know if this web app are using long polling or anything else "javascript trick":
http://typewith.me/2wicOjuefI
Is there a way to know that ?
Thanks ;)
Hi,
what is the best way to create MVC architecture in jQuery?
Should I use jQuery.extend()?
jQuery.extend({
View: function(){}
});
...or jQuery Plugin?
(function($) {
$.fn.model = function() { return this; };
})(jQuery);
...or just objects in JavaScript?
var model = {}
var view = {}
var controller = {}
Thank you!
I've been trying to teach myself JavaScript, and one thing I was reading on is the try/catch structure. Unfortunately, the tutorial doesn't provide much explanation on how it would be useful, just how to set it up. Can anyone offer some insight?
Hello!
I was confused in the problem of time zones. I am writing a web application that will contain some news with dates of publication, and I want the client to see the date of publication of the news in the form of corresponding local time. However, I do not know in which time zone the client is located.
I have three questions.
I have to ask just in case: does DateTimeOffset.UtcNow always returns the correct UTC date and time, regardless of whether the server is dependent on daylight savings time? For example, if the first time I get the value of this property for two minutes before daylight savings time (or before the transition from daylight saving time back) and the second time in 2 minutes after the transfer, whether the value of properties in all cases differ by only 4 minutes? Or here require any further logic? (Question #1)
Please see the following example and tell me what you think.
I posted the news on the site. I assume that DateTimeOffset.UtcNow takes into account the time zone of the server and the daylight savings time, and so I immediately get the correct UTC server time when pressing the button "Submit". I write this value to a MS SQL database in the field of type datetime2(0).
Then the user opens a page with news and no matter how long after publication. This may occur even after many years. I did not ask him to enter his time zone. Instead, I get the offset of his current local time from UTC using the javascript function following way:
function GetUserTimezoneOffset()
{
var offset = new Date().getTimezoneOffset();
return offset;
}
Next I make the calculation of the date and time of publication, which will show the user:
public static DateTime Get_Publication_Date_In_User_Local_DateTime(
DateTime Publication_Utc_Date_Time_From_DataBase,
int User_Time_Zone_Offset_Returned_by_Javascript)
{
int userTimezoneOffset = User_Time_Zone_Offset_Returned_by_Javascript; // For
// example Javascript returns a value equal to -300, which means the
// current user's time differs from UTC to 300 minutes. Ie offset
// is UTC +6. In this case, it may be the time zone UTC +5 which
// currently operates summer time or UTC +6 which currently operates the
// standard time.
// Right? (Question #2)
DateTimeOffset utcPublicationDateTime =
new DateTimeOffset(Publication_Utc_Date_Time_From_DataBase,
new TimeSpan(0)); // get an instance of type DateTimeOffset for the
// date and time of publication for further calculations
DateTimeOffset publication_DateTime_In_User_Local_DateTime =
utcPublicationDateTime.ToOffset(new TimeSpan(0, - userTimezoneOffset, 0));
return publication_DateTime_In_User_Local_DateTime.DateTime;// return to user
}
Is the value obtained correct? Is this the right approach to solving this problem? (Question #3)
I'm building a Drupal theme up and want to know if there is a Drupalish way to add a css file only if the user has js turned off.
This would ideally go in the theme.info file to keep it neat!
Something like this would be ideal:
conditional-stylesheets[if no javascript][all][] = nojs.css
If this isn't possible then I'm going to keep all the css that needs JS out of the css files, and add it dynamically using JS but this seems a bit messy...
Any ideas?
Hi all,
I have written a file using html and javascript.
In that Vertical scrolling should be there, but i want to stop horizontal scrolling.
How can I do that?
Apart from the legal issues..
I'd like to create a website that is the exact copy of another website (I do not own but I know will let me do this) where I change a few things, mainly swap images and hide some divs..
So my "website".. how should I build it? I thought something like an Iframe and javascript but I have no idea if this makes sense.. any idea?
TinyMCE not working in ie with this js code. How can I solve the problem. Thanks in advance
<script type="text/javascript">
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugin : "tinyBrowser, media",
file_browser_callback : "tinyBrowser",
});
function toggleEditor(id) {
if (!tinyMCE.get(id))
tinyMCE.execCommand("mceAddControl", false, id);
else
tinyMCE.execCommand("mceRemoveControl", false, id);
}
</script>
Assuming my conditions for building a RSS feed reader were I had to provide only a Javascript snippet. The RSS is cross domain and is only XML. What are my options and how can I implement them? thanks
Hi,
I was trying to do something like this: http://www.element-it.com/Examples/MultiPowUpload/AdvancedHTMLinterface.html
But in my search for information I found that is not possible to perform multiple file selection with simple HTML and JavaScript (and JSP in the server side). There is a way to do this without using Flash? A third party component you could recommend?
Thanks.
I have an HTML table that contains lots of rows and columns. Therefore, it has vertical and horizontal scroll bars.
How can I get the dimensions in pixels of these scroll bars in Javascript/jQuerys ?
In ASP.NET MVC there is Model, View and Controller.
MODEL represents entities which are stored in database and essentially is all the data used in a application (for example, generated by EntityFramework, "DB First" approach).
Not all data from model you want to show in the view (for example, hashs of passwords). So you create VIEW MODEL, each for every strongly-typed-razor-view you have in application.
Like this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MyProject.ViewModels.SomeController.SomeAction
{
public class ViewModel
{
public ViewModel()
{
Entities1 = new List<ViewEntity1>();
Entities2 = new List<ViewEntity2>();
}
public List<ViewEntity1> Entities1 { get; set; }
public List<ViewEntity2> Entities2 { get; set; }
}
public class ViewEntity1
{
//some properties from original DB-entity you want to show
}
public class ViewEntity2
{
}
}
When you create complex client-side interfaces (I do), you use some pattern for javascript on client, MVC or MVVM (I know only these). So, with MVC on client you have another model (Backbone.Model for example), which is third model in application. It is a bit much.
Why don`t we use the same ViewModel model on a client (in backbone.js or another framework)? Is there a way to transfer CS-coded model to JS-coded? Like in MVVM pattern, with knockout.js, when you can do like this:
in SomeAction.cshtml:
<div style="display: none;" id="view_model">@Json.Encode(Model)</div>
after that in Javascript-code
var ViewModel = ko.mapping.fromJSON($("#view_model").get(0).innerHTML);
now you can extend your ViewModel with some actions, event handlers, etc:
ko.utils.extend(ViewModel, {
some_function: function () {
//some code
}
});
So, we are not building the same view model on the client again, we are transferring existing view model from server. At least, data.
But knockout.js is not suitable for me, you can`t build complex UI with it, it is just data-binding. I need something more structural, like backbone.js.
The only way to build ViewModel for backbone.js I can see now is re-writing same ViewModel in JS from server with hands.
Is there any ways to transfer it from server? To reuse the same viewmodel on server view and client view?
I've seen similar questions posted and tried to change them to meet my needs but I don't know enough about javascript to do it.
I need that when a user change the dropdown select, the "titre text field" maxlength is dynamically changed
a, b c and d max maxlength should be 40
and e maxlength should be 2
my code is below, I don't know why but it is not working correctly:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>title page</title>
</head>
<body>
<script type="text/javascript">
function changeValue(dropdown) {
var option = dropdown.options[dropdown.selectedIndex].value,
field = document.getElementById('titre');
if (option == 'a' || option == 'b' || option == 'c' || option == 'd') {
field.maxLength = 40;
} else if (option == 'e') {
field.value = field.value.substr(0, 2); // before reducing the maxlength, make sure it contains at most two characters; you could also reset the value altogether
field.maxLength = 2;
}
}?
</script>
<form action="converter.php" method="post">
<h2>Feel all field below:</h2>
<div>
Title: <input type="texte" name="titre" id="titre" maxLength="40"/> Format:
<select id="format" name="format" onchange="changeValue(this);">
<option value="a">A</option>
<option value="b">B</option>
<option value="c">C</option>
<option value="d">D</option>
<option value="e">E</option>
</select>
</div>
<div>
<textarea name="texte" style="width: 415px; height: 155px;"></textarea>
</div>
<div>
<input type="submit" value="OK" />
</div>
</form>
</body>
</html>
Hi,
How do I detect change event on textarea using javascript?
I'm trying to detect how many characters left is available as you type.
I tried using the onchange event, but that seems to only kick in when focus is out.
Thanks,
Tee
Hello guys, i want to put an IRC client in my webpage, i know there are many clients but not opensource (i dont found any). So, do you know some free and open source proyects to implement an irc client on a webpage? and what do you suggests in term of the plataform, i mean, its a good idea to have one made on flash?, one made in html5?, one made on javascript/php?. Thanks for yours answers.
I am an amateur in JavaScript. I saw this other question, and it made me wonder.
Can you tell me what does the below regular expression exactly mean?
split(/\|(?=\w=>)/)
Does it split the string with "|"?
hi everybody,
I need to do a countdown clock, that counts down the days, hours, minutes and seconds that are left to a date of my choice,Using jquery or google app engine(Python).
I created a timer using Javascript,But in that i used system time.
I need to use server time.Can any body give me ideas to build up a count down Timer using server UTC time.
so this is really weird to me but my code works properly for getting the geolocation if I run my code locally in the simulator, If I have the code on my server it does not work in the simulator, yet the same url and code on my server works on my actual iphone? It seems to not pick up on the geolocation javascript when its on my server in the simulator?
I'm using CSS 3 features like "rounded corner" or "shadow box".
IMHO These are fantastic features for people like me with no graphics knowledge. But, i've noticed, IE 7-8 not support CSS 3.
So i'm asking you: is there a way to "enable" some features maybe with some javascript functions to include in my html file ?
Thank you!
Hi all,
I have a fairly simple question: In Javascript how can I return the boolean (if its found in the JSON) rather than the actual value?
Example:
var myJSON = {
"foo" : "bar",
"bar" : "foo"
};
var keyToLookFor = "foo";
var found = myJSON[keyToLookFor];
if (found) {
// I know I can test if the string exists in the if
}
// but is there a way I could just return something like:
return found;
// instead of testing found in the if statement and then returning true?