 |
 |
function GetEqrDataUploadFiles()
{
var upload=$("#files").data("KendoUpload");
var s = upload.wrapper[0].childNodes[2].childNodes.length;
var a = new Array();
for (i = 0; i < s; i++)
{
if (document.all) {
a.push(upload.wrapper[0].childNodes[2].childNodes[i].innerText);
}
else {
a.push(upload.wrapper[0].childNodes[2].childNodes[i].textContent);
}
}
return a;
}
|
|
|
|
 |
This means that upload.wrapper[0] is null. You'll need to debug it to figure out why.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
 |
javascript Run Time Error[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Hi,
I am new to javascript. How to increment the margin left value using javascript while mouseover time.
NalluJi
|
|
|
|
|
 |
In what way is a switch more efficient than an if statment?
|
|
|
|
 |
1. If your "if" condition is based on a single condition and single value.
2. If there is multiple "else if" conditions exists.
___ ___ ___
|__ |_| |\ | | |_| \ /
__| | | | \| |__| | | /
|
|
|
|
 |
If your condition has multiple if else statements then you should use if, if you can. For example,
if(ch == 'a')
{
...
...
}
else if(ch == 'b')
{
...
...
}
else if(ch == 'c')
{
...
...
}
is equivalent to
switch(ch)
{
case 'a':
......
...... break;
case 'b':
......
...... break;
case 'c':
......
...... break;
}
|
|
|
|
 |
In if conditions you have to give the variable every time and while in switch case , you just have to define cases no need to give variable name every time...
|
|
|
|
 |
I find lots of help in resolving the location of a JS folder. But no help on how to include a JavaScrip function in the head of the master page which can load a page in the root from a content page in a sub-folder. Any references or suggestions? And it also needs to open from a content page located in the root directory.
|
|
|
|
 |
I have parent dynamic HTML page with a form and random number of input fields in which I would like to insert predefined data from child help window.
I use Javascript to open child window, where I display possible values, which I send to parent window with a click. That works fine, if I have fixed field names in parent window - via window.opener.document.myFormName.Variable1.value I assign value to Variable1.
But now I have random number of variables, and therefore random names. I can send the name of the variable to my child window, but don't know how to use it, to assign specific data to that variable.
function Izbor(a, b) {
window.opener.document.Vprasalnik.a.value = b;
window.close()
}
b is the value, that I assign, and a is the name of the variable, that I want to assign this value to.
Is this even possible?
Thanks for the help,
Marcel
|
|
|
|
 |
please do not repost your question
|
|
|
|
 |
Hi,
I would like the javascript to show data from getData method (webMethod), when the page loads but when filter the data (categoryPicker control), using webMethod getData2.
This is currently my c# page.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
JavaScriptSerializer jss = new JavaScriptSerializer();
ClientScript.RegisterStartupScript(this.GetType(), "TestInitPageScript",
string.Format("<script type=\"text/javascript\">google.load('visualization','1.0',{{'packages':['corechart','controls']}});google.setOnLoadCallback(function(){{drawVisualization({0},'{1}','{2}','{3}');}});</script>",
jss.Serialize(GetData()),
"Name Example",
"Name",
"Type Example",
"Type Example",
"Type,"));
}
else
{
JavaScriptSerializer jtt = new JavaScriptSerializer();
ClientScript.RegisterStartupScript(this.GetType(), "TestInitPageScript",
string.Format("<script type=\"text/javascript\">google.load('visualization','1.0',{{'packages':['corechart','controls']}});google.setOnLoadCallback(function(){{drawVisualization({0},'{1}','{2}','{3}');}});</script>",
jtt.Serialize(GetData2()),
"Name Example",
"Name",
"Type Example",
"Type Example",
"Type,"));
}
}
[WebMethod]
public static List<Data> GetData()
{
SqlConnection conn = new SqlConnection("#####");
DataSet ds = new DataSet();
DataTable dt = new DataTable();
conn.Open();
var yesterday = DateTime.Today.AddDays(-1);
string cmdstr = "select top 500 Name, [Decimal price],Cover, UploadDate from [dbo].[database] order by UploadDate desc";
SqlCommand cmd = new SqlCommand(cmdstr, conn);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(ds);
dt = ds.Tables[0];
List<Data> dataList = new List<Data>();
string cat = "";
float val = 0;
string typ = "";
DateTime dat = DateTime.Now;
foreach (DataRow dr in dt.Rows)
{
try
{
cat = dr[0].ToString();
val = Convert.ToInt32(dr[1]);
typ = dr[2].ToString();
dat = (DateTime)(dr[3]);
}
catch
{
}
dataList.Add(new Data(cat, val, typ, dat));
}
return dataList;
}
[WebMethod]
public static List<Data> GetData2()
{
SqlConnection conn = new SqlConnection("#####");
DataSet ds = new DataSet();
DataTable dt = new DataTable();
conn.Open();
var yesterday = DateTime.Today.AddDays(-1);
string cmdstr = "select Name, [Decimal price],Cover, UploadDate from [dbo].[database] order by UploadDate desc";
SqlCommand cmd = new SqlCommand(cmdstr, conn);
SqlDataAdapter adp = new SqlDataAdapter(cmd);
adp.Fill(ds);
dt = ds.Tables[0];
List<Data> dataList = new List<Data>();
string cat = "";
float val = 0;
string typ = "";
DateTime dat = DateTime.Now;
foreach (DataRow dr in dt.Rows)
{
try
{
cat = dr[0].ToString();
val = Convert.ToInt32(dr[1]);
typ = dr[2].ToString();
dat = (DateTime)(dr[3]);
}
catch
{
}
dataList.Add(new Data(cat, val, typ, dat));
}
return dataList;
}
I am little unsure, how do I go about updating on the javascript side. Could any one provide some guideline or process in what I need to do, please.
function drawVisualization(dataValues, chartTitle, columnNames, categoryCaption) {
if (dataValues.length < 1)
return;
var data = new google.visualization.DataTable();
data.addColumn('string', columnNames.split(',')[0], 'name');
data.addColumn('number', columnNames.split(',')[1], 'price');
data.addColumn('string', columnNames.split(',')[2], 'type');
data.addColumn('datetime', columnNames.split(',')[3], 'date');
for (var i = 0; i < dataValues.length; i++) {
var date = new Date(parseInt(dataValues[i].Date.substr(6), 10));
data.addRow([dataValues[i].ColumnName, dataValues[i].Value, dataValues[i].Type, date]);
}
var dateFormatter = new google.visualization.DateFormat({ pattern: 'dd MM yyyy' });
var line = new google.visualization.ChartWrapper({
'chartType': 'AreaChart',
'containerId': 'PieChartContainer',
'options': {
'width': 1200,
'height': 500,
'legend': 'none',
'hAxis': {
'format': "dd-MM-yyyy",
'hAxis.maxValue': 'viewWindow.max',
'maxValue': new Date(2014, 05, 30), 'minValue': new Date(2014, 04, 05),
'viewWindow': { 'max': new Date(2014, 05, 30) },
},
'chartArea': { 'left': 150, 'top': 100, 'right': 50, 'bottom': 100 },
'tooltip': { isHtml: true }
},
'view': {
'columns': [{
type: 'string',
label: data.getColumnLabel(3),
calc: function (dt, row) {
var date = dt.getValue(row, 3);
return dateFormatter.formatValue(date);
}
}, 1, {
type: 'string',
role: 'tooltip',
calc: function (dt, row) {
return 'Name: ' + dt.getValue(row, 0) + ', Price: ' + +dt.getValue(row, 1) + ', Date: ' + +dt.getFormattedValue(row, 3);
}
}]
}
});
var categoryPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'CategoryPickerContainer',
'options': {
'filterColumnLabel': columnNames.split(',')[3],
'filterColumnIndex': '3',
'ui': {
'labelStacking': 'horizontal',
'allowTyping': false,
'allowMultiple': false,
'caption': categoryCaption,
'label': 'Date',
}
}
});
new google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker], [line]).draw(data);
table.draw(data, { showRowNumber: true });
}
Any help or guidance would be very much appreciated. Thanks in advance.
|
|
|
|
 |
Need more details inorder to understand your requirement. Can you please clarify little bit more in detail.
|
|
|
|
 |
Thank you for your response. I would like to be able to call (getData) query when the page loads and show the (getData) query results in a(using 'line method' -- see javascript code) line chart. When I use the data filters in javascript(categoryPicker), I would like to control filters (categoryPicker), to use (getData2) method query to filter the line charts' output.
for example:
when page loads, call query1(select top 100 * from data), then click/mouseover/search on filter(categoryPicker), filter the line chart results using qyery2(select * from data).
I hope the explanation above clarifies my problem.
Any help would be very much appreciated. Thank you for your time and help.
|
|
|
|
 |
hi
I want to put the script into a php page, then call it with a "includes", but in order to do that I will need to be able to change the code on this line
which wants the link to the image.
$('#puzzle-image').attr('src', 'content/images/avengers.jpg');
because I would like to keep using the same code, from the same php file, with different images, so I need to call for the image, from each page to go in the code above.
it's from this page
Jigsaws
|
|
|
|
|
 |
how to run event of asp contol by javascript code?
|
|
|
|
 |
Quote: Hi,
Please try the following code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="textBoxUserId" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
In the code behind :
protected void Page_Load(object sender, EventArgs e)
{
textBoxUserId.Attributes.Add("onkeyup", "hello();");
}
And put the script as:
<script type="text/javascript">
function hello() {
alert("do something somehting ")
}
</script>
Hope this helps.
Thanks,
Praneet
|
|
|
|
|
 |
How to use modular script for different modules in website?(In General)
|
|
|
|
|
 |
<div id="a">
<div id="b">
</div>
</div>
In this scenario, write a common function to handle the click function on the elements without propagating the event.
|
|
|
|
 |
Please someone reply soon urgent requirement
|
|
|
|
 |
<div id="a" onclick="onClick(event)">
<div id="b">
</div>
</div>
function onClick(event) {
event.stopPropagation();
}
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
 |
Thanks Peter
|
|
|
|
 |
how I can use a variable passed by parameter in a javascript function in a lambda expression?
p.s: name of the variable = xyz
Code:
pendencias.push(@Model.Count(x => (x.FC_VH_OWNER_STATE_NM == "SP" && Convert.ToDateTime(x.FD_REQ_SERVICE_VALIDITY_DT) <= Convert.ToDateTime(System.DateTime.Now).AddDays(xyz))));
ERROR: Variable is not found
|
|
|
|
 |
I am having a little issue, with getting dates to show up in desired (dd-mm-yyyy) format, however they are displayed as 'NaN Nan' on the line chart x-axis. I have added in a 'parseInt' date format but I am not sure if this is a correct approach.
Please advice. Many thanks for your help and time.
function drawVisualization(dataValues, chartTitle, columnNames, categoryCaption) {
if (dataValues.length < 1)
return;
var data = new google.visualization.DataTable();
data.addColumn('string', columnNames.split(',')[0]);
data.addColumn('number', columnNames.split(',')[1]);
data.addColumn('string', columnNames.split(',')[2]);
data.addColumn('datetime', columnNames.split(',')[3]);
for (var i = 0; i < dataValues.length; i++) {
var date = new Date(parseInt(dataValues[i].Date.substr(6), 10));
data.addRow([dataValues[i].ColumnName, dataValues[i].Value, dataValues[i].Type, date]);
}
var dateFormatter = new google.visualization.DateFormat({ pattern: 'dd MM yyyy' });
var line = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'PieChartContainer',
'options': {
'width': 950,
'height': 450,
'legend': 'right',
'hAxis': {
'format': "dd-MM-yyyy",
'hAxis.maxValue': 'viewWindow.max',
'maxValue': new Date(2014, 05, 30), 'minValue': new Date(2014, 04, 05),
'viewWindow': { 'max': new Date(2014, 05, 30) },
},
'title': chartTitle,
'chartArea': { 'left': 100, 'top': 100, 'right': 0, 'bottom': 100 },
'tooltip': { isHtml: true }
},
'view': {
'columns': [{
type: 'string',
label: data.getColumnLabel(3),
calc: function (dt, row) {
var date = new Date(parseInt(dt.getValue(row, 3)));
return dateFormatter.formatValue(date);
}
}, 1, {
type: 'string',
role: 'tooltip',
calc: function (dt, row) {
return 'Name: ' + dt.getValue(row, 0) + ', Decimal Price: ' + +dt.getValue(row, 1) + ', Date: ' + +dt.getFormattedValue(row, 3);
}
}]
}
});
new google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker], [line]).draw(data);
}
|
|
|
|
 |
miss786 wrote: however they are displayed as 'NaN Nan' on the line chart x-axis. The reason is the value is not a numeric.
miss786 wrote: I have added in a 'parseInt' date format but I am not sure if this is a correct
approach. I think you're getting NAN because you're getting an empty string or null & parsing directly. Just check the result of parseInt("") or parseInt(null)
So check the value before sending to Date function. Debug there.
|
|
|
|
 |
Apology for the late response. Thank you very much for your feedback. I manage to get the date value pass the parseInt but however, now I am getting a blank screen on the client-end, with the following warning in the console debug of my chrome browser:
event.returnValue is deprecated. Please use the standard event.preventDefault() instead. --> warning
<script type="text/javascript">
function drawVisualization(dataValues, chartTitle, columnNames, categoryCaption) {
if (dataValues.length < 1)
return;
var data = new google.visualization.DataTable();
data.addColumn('string', columnNames.split(',')[0]);
data.addColumn('number', columnNames.split(',')[1]);
data.addColumn('string', columnNames.split(',')[2]);
data.addColumn('datetime', columnNames.split(',')[3]);
for (var i = 0; i < dataValues.length; i++) {
var date = new Date(parseInt(dt.getValue(row, 3)));
data.addRow([dataValues[i].ColumnName, dataValues[i].Value, dataValues[i].Type, date]);
}
var categoryPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'CategoryPickerContainer',
'options': {
'filterColumnLabel': columnNames.split(',')[2],
'filterColumnIndex': '2',
'ui': {
'labelStacking': 'horizontal',
'allowTyping': false,
'allowMultiple': false,
'caption': categoryCaption,
'label': 'Price Type',
}
}
});
var dateFormatter = new google.visualization.DateFormat({ pattern: 'dd MM yyyy' });
var line = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'PieChartContainer',
'options': {
'width': 950,
'height': 450,
'legend': 'right',
'hAxis': {
'format': "dd-MM-yyyy",
'hAxis.maxValue': 'viewWindow.max',
'maxValue': new Date(2014, 05, 30), 'minValue': new Date(2014, 04, 05),
'viewWindow': { 'max': new Date(2014, 05, 30) },
},
'title': chartTitle,
'chartArea': { 'left': 100, 'top': 100, 'right': 0, 'bottom': 100 },
'tooltip': { isHtml: true }
},
'view': {
'columns': [{
type: 'string',
label: data.getColumnLabel(3),
calc: function (dt, row) {
var date = new Date(parseInt(dt.getValue(row, 3)));
return dateFormatter.formatValue(date);
}
}, 1, {
type: 'string',
role: 'tooltip',
calc: function (dt, row) {
return 'Name: ' + dt.getValue(row, 0) + ', Decimal Price: ' + +dt.getValue(row, 1) + ', Date: ' + +dt.getFormattedValue(row, 3);
}
}]
}
});
new google.visualization.Dashboard(document.getElementById('PieChartExample')).bind([categoryPicker], [line]).draw(data);
}
Please advice, if possible. Many thanks.
|
|
|
|
 |
miss786 wrote: event.returnValue is deprecated. Please use the standard event.preventDefault() instead. --> warning That's warning, possibly you're using new jQuery version. Try previous(your project's) version.
|
|
|
|
|
 |
Hi, How to disable JqueryDateTime Picker Image button . But textbox i can disable ,I can't do Image button. here code i am try it. function disableDate() { debugger; document.getElementById('txtStartDate').disabled = true; $get('txtStartDate').style.color = "gray"; $get('txtStartDate').disabled = true; $('txtStartDate').datepicker('disable'); $('txtStartDate').datepicker('setDate', new Date()).datepicker('disable').blur(); $('txtStartDate').disableSelection = true; }
<input id="txtStartDate" runat="server" class="TextBox DatePicker" style="width: 125px" /> <style> .ui-datepicker-trigger { position: relative; top: 4px; right: -3px; height: 17px; } </style> <script language="javascript" type="text/javascript"> var Dformat = ""; $(document).ready(function () { var selectvalStartDate = $("#txtStartDate").val(); var sVal = document.getElementById('hdnPORTALID').value; Dformat = GetDatePickerFormat(sVal); $(".DatePicker").attr("placeholder", "Select date").datepicker({ showOn: "both", buttonImage: "../images/datepicker_enable.png", buttonImageOnly: true, changeMonth: true, changeYear: true, dateFormat: Dformat }); }); </script> thanks, Karthikeyan,
|
|
|
|
 |
Hi,
I am not sure whether this would work, but,
can you try this ?
<input name="date" id="datepicker" disabled="disabled" />
$('#datepicker').datepicker();
For further could you please check this link:-
https://forum.jquery.com/topic/disabled-datepicker[^]
Regards,
Praneet
|
|
|
|
 |
$("txtStartDate").datepicker({
disabled:true
});
modified 9-May-14 14:36pm.
|
|
|
|
 |
Can anyone provide me design or flow to create application for formula builder or expression builder using java-script. just like a calculator but little advanced. which can read any mathematical expression.
ex:
(a+b)/c
5*LOG(1000)* -2/3
MAX(4, 6%7)
(-2*(4*5)+4)/2 -6
|
|
|
|
|
 |
You can use Javascript method eval().
It can evaluate functions and expressions as a string.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
 |
Hi ,
I have an html page for showing google maps. It is showing fine in chrome and firefox, but not in IE. How to fix this ?
Here is the page I used
<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Google Maps Multiple Markers</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 10,
center: new google.maps.LatLng(-33.92, 151.25),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var marker, i;
for (i = 0; i < locations.length; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(locations[i][1], locations[i][2]),
map: map
});
google.maps.event.addListener(marker, 'click', (function(marker, i) {
return function() {
infowindow.setContent(locations[i][0]);
infowindow.open(map, marker);
}
})(marker, i));
}
</script>
</body>
</html>
|
|
|
|
|
 |
please embed your code with < pre > tags. (the code button in the toolbar when editing/writing a post)
like this...
Code here. You can choose between different language settings HTML / XML / ASP and javascript is what you should use here in your case ...
hope this helps.
|
|
|
|
 |
I'm having an issue with the legend options of JQPlot.
I can do some things with the legend like defining the labels (array legendlabels), showSwatches and placement and location.
But any attempt in changing the background, textColor or fontSize, ... doesn't work. The plot shows, the legend shows, but none of these options work. I've been up and down the provided samples and they work. I compared them with my prototype here (also all the css and js includes), but still no dice.
The code doesn't seem wrong as the plot (and legend) show, but some of the options don't seem to do anything.
legend: {
show: true, labels:legendlabels, location:"n", rendererOptions: {
placement:"outsideGrid", textColor: "rgb (255, 100, 100)", fontSize: "18pt" }
},
has anyone encountered this issue? How can I solve this?
(google's results didn't yield solutions for me either)
thanks!
[SOLUTION]
You need to add the correct javascript file at the bottom of the page:
<script class="include" type="text/javascript" src="./Scripts/JQPlot/plugins/jqplot.enhancedLegendRenderer.js"></script>
and use the
renderer:$.jqplot.EnhancedLegendRenderer,
option in the json definition.
then you place any css styling properties in the
rendererOptions: {}
object.
[/SOLUTION]
modified 23-Apr-14 9:27am.
|
|
|
|
 |
I have been trying to add the salutation string to p id="salutation" I can't figure it out. I have to use a html and a script separate this is what I have for the HTML.
<html>
<head>
<title>Invitation</title>
<meta charset="utf-8">
</head>
<body>
<p id="salutation">
</p>
<p id="image"></p>
<p>You are invited to my house for a Cynco de Mayo party May 5, 2014.
</p>
<p>Sincerely,</p>
<p id="closingname"></p>
<script type="text/javascript" src="script\letter.js"></script>
</body>
</html>
And this is what I have for the .js:
"use strict";
function greeting() {
var textOne = "Dear";
var name = "John";
var punc = ",";
document.write(textOne + name + punc);
}
function complete() {
var yourName = "Gerald Blackmore";
var img = "<img src='image/partyimage.jpg'>";
greeting();
document.write(img);
document.write(yourName);
}
complete();
These are the teachers instructions:
Create the following web page and name it letter.html.
<!DOCTYPE html>
<!-- Author: your name here -->
<!-- Date: date submitted here -->
<html>
<head>
<title>Invitation</title>
<meta charset="utf-8">
</head>
<body>
You are invited to my house for a Cinco de Mayo party May 5, 2014.
Sincerely,
</body>
</html>
Download an image that is appropriate for a Cinco de Mayo celebration and save it in an appropriate place on your web site.
Create an external JavaScript file and name it letter.js. Add the appropriate <script> tag to letter.html to include this external JavaScript file.
In the external JavaScript file you are to create two functions and invoke them. The first function should:
Accept three arguments: a greeting, e.g. "Dear", "Hello", or "Greetings", first name, and any appropriate punctuation, such as "," or ":".
The function should return a single string that is the full salutation in greeting, first name, punctuation order, e.g., "Dear Mark:".
The second function should:
Accept three arguments, the salutation returned by the first function, the sender name which will be your name, and the image file name of your downloaded Cinco de Mayo image.
The function should then add the salutation string to the paragraph.
The function should then add the downloaded Cinco de Mayo image to the paragraph.
Finally, the function should add your name to the paragraph
|
|
|
|
 |
You have got the wrong idea. This is a forum to answer specific programming problem, not to do someone's homework/assignment. We are not helping you if we do it for you. The assignment is meant to gauge your understanding of what you have learned, if we do it for you, we get the grade, not you. How are you going to pass your test/exam subsequently,let alone graduating. Remember, no effort no gain, and study hard.
|
|
|
|
 |
As Peter said, we're not going to do your homework for you. However, it sounds like you just need a hint to push you in the right direction.
document.write [^] will write the string to the document at the point where the function is called. You want to insert the string into a specific element, which means you need to get that element by ID, and update its inner HTML.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
 |
Thank you so much. a push the right way was exactly what I was asking for.
|
|
|
|
|
 |
Thank you. That was very helpful.
|
|
|
|
 |
is it possible to get a value from another page using JavaScript language?
|
|
|
|
 |
how is the value stored in the other page? e.g. In a label or textbox?
|
|
|
|
 |
|