JavaScript

121K

Solutions

41K

Contributors

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.

Share tech news, updates, or what's on your mind.

Sign up to Post

Guys,

I need Help i am trying to add my failed Exchange Server 2010 to a DAG but when i ran the command in the image and getting the error. Please for your assistance.Adding-to-Cluster.JPG
0
Cloud Class® Course: Python 3 Fundamentals
LVL 12
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Hi, I have a javascript countdown clock that throws this error:
TypeError: Cannot read property 'append' of undefined
 /micore/core/info/content_headlines.asp:832

Code:
    <script language="javascript" type="text/javascript">   
    var ringer = {
  countdown_to: "04/01/2019",
  rings: {
    'DAYS': { 
      s: 86400000, // mseconds in a day,
      max: 365
    },
    'HOURS': {
      s: 3600000, // mseconds per hour,
      max: 24
    },
    'MINUTES': {
      s: 60000, // mseconds per minute
      max: 60
    },
    'SECONDS': {
      s: 1000,
      max: 60
    }
   },
  r_count: 4,
  r_spacing: 20, // px
  r_size: 82, // px
  r_thickness: 10, // px
  update_interval: 11, // ms
    
    
  init: function(){
   
    $r = ringer;
    $r.cvs = document.createElement('canvas'); 
    
    $r.size = { 
      w: ($r.r_size + $r.r_thickness) * $r.r_count + ($r.r_spacing*($r.r_count-1)), 
      h: ($r.r_size + $r.r_thickness) 
    };
    


    $r.cvs.setAttribute('width',$r.size.w);           
    $r.cvs.setAttribute('height',$r.size.h);
    $r.ctx = $r.cvs.getContext('2d');
    $(".countdownwrap").append($r.cvs);
    $r.cvs = $($r.cvs);    
    $r.ctx.textAlign = 'center';
    $r.actual_size = $r.r_size + $r.r_thickness;
    $r.countdown_to_time = new Date($r.countdown_to).getTime();
    $r.cvs.css({ width: $r.size.w+"px", height: $r.size.h+"px" });
    $r.go();
  },
  ctx: null,
  go: function(){
    var idx=0;
    
    $r.time = (new Date().getTime()) - 

Open in new window

0
Usage of Bootstrap

I have done some reading online about Bootstrap, it states that Bootstrap includes HTML and CSS, and makes the web forms generated in easy and faster way.
I am not sure what they mean by that. DO they mean that when we open Bootsrop text editor we can write HTML and CSS on the same page ?
Another thing that I want to know is How does Javascript interact with Bootstrap ?

Thak you
0
I'm rewriting and improving some jQuery code that I have inherited from a developer who's not here anymore.

I got help from Leakim and Julian here and I'm using the same method (using Template) Previous question - long thread

1. I uploaded my sample code here https://drive.google.com/file/d/1d2Gn8UDfeHfXvn560b114i-5Ob2ZP8rJ/view

Just download, unzip and click on "page.html". The corresponding JS file is "Reporting.js"

2. When page loads, you'll see one row of dropdowns. Click "Add" and now you'll see two

e1.png
3. In the first row, select something from the first dropdown. The second dropdown in the first row is enabled. This is correct.
But, the second dropdown in the second row also is enabled. This is not correct. Why is this happening?

e2.png
4. There's some existing code that the ex-developer has in this section of
$(document).on('change', '#reportBuilder select.filterField', function () {...

Open in new window

of Reporting.JS.  I think something might be off in that section now that I'm using Template and divs. I'll debug that. I wonder if I need to have an ID on these dropdown? somehow say... if user selects something on this row...only make this row enable/disabled. All that code in the 'change' event is even needed? can it be simpilfied


EDIT I fixed it by changing the below code because I don't have "tr" and "table" anymore. Can that "change" function be simpilfied?
var operatorSelect = $('select.fieldOperator', $(this).parentsUntil('tr').next());

Open in new window


to this

var operatorSelect = $('select.fieldOperator', $(this).closest('div').next());

Open in new window

0
Hello,
I am creating a basic user authentication using nodejs, express.js and Passport.js.
I follow this example and it kind of works for me:
https://github.com/passport/express-4.x-local-example/blob/master/server.js

BUT, I would like to modify this demo to not have routes and not a template engine (ejs)

I have a folder with a bunch of static html files I would like to protect.
admin/
         /login.html
         /page1.html
         /page2.html
         /page3.html

I would like to password protect access to all html file under admin using basic authentication, but without routes.

In other words, I would like to access wepage.com/page2.html or any other html page and be redirected to login page, after logging in, I would like to be redirected back to page2.html and after that I could access the rest of the html pages without having to login. wepage.com/page4.html, wepage.com/page3.html, etc

The reason I don't want to have routes is because new html pages are added all the time and I don't want to keep creating routes for new ones or remove routes when deleting html pages.
Also, I don't really need a template engine since my pages are static html and I would like people to access the html directly. wepage.com/page1.html

The only requirements I have is nodejs, express.js and Passport.js.

Can someone please guide me or point me to an example to accomplish this?

Thanks
EMimi
0
My ASP.Net MVC web application have the following Javascript errors:
Uncaught SyntaxError: Unexpected token <
Uncaught ReferenceError: Sys is not defined
Uncaught ReferenceError: WebForm_AutoFocus is not defined

Open in new window


This is how it looks like in Firefox console:
Error
And these are the source code view of the relevant references and javascript.
Source
Source - javascript 1
Source - Javascript 2
How do the errors happen and how to fix them?
0
I have a php page and am trying to set the focus to a specific text input box when the page opens using this mechanism:

<script type="text/javascript" language="JavaScript">
	function jsSetFocus(){
		document.forms["OrderDetail"]["ProdnOrder"].disabled = true;
		document.forms["OrderDetail"]["VECode"].focus();
	}
	jsSetFocus();

Open in new window


my problem is that the focus event only fires intermittently - the ProdnOrder input is disabled but the focus is on the path in the address box which is highlighted. but occasionally the focus event works as it should.

How can I force the focus onto the VECode input box everytime?
0
i have some documents uploaded to the server , now i download each document alone
but i want to download all documents in just one click , any one can help .
using asp classic.
0
In Angular, Can I Create a Dynamic Table using Static and Dynamic Column header?


 
From the above example- Name and department are static content(hardcode values), 01.01.2015 , 01.02.2016, 01.03.2016 are dynamic content to be iterated using ngfor.
 
please provide solution in Angular 5
0
In Angular, I need to create a Modal Window which contains a TextBox and a Button. But when i put some value in the text box of the modal window it's value is not updating?

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script>  
    <script type="text/javascript">  
    var app = angular.module('myApp', []);  
    app.controller('myCtrl', function ($scope) {  
    $scope.firstName = "";  
    $scope.valSubmit = function () {  
    firstName = $scope.firstname;  
    alert(firstName);  
    $("#myModal").modal('hide');  
    };  
    });  
    </script>  
    </head>  
    <body ng-app="myApp" ng-controller="myCtrl">  
    <form id="form1" runat="server">  
    <div class="row">  
    <div id="myModal" class="modal fade" role="dialog">  
    <div class="modal-dialog">  
    <div class="modal-content">  
    <div class="modal-header">  
    <button type="button" class="close" data-dismiss="modal">×</button>  
    <h4 class="modal-title">Modal Header</h4>  
    </div>  
    <div class="modal-body">  
    <input type="text" placeholder="enter first name" id="name" ng-model="firstname" class="form-control" />  
    </div>  
    <div class="modal-footer">  
    <button type="button" class="btn btn-success" ng-click="valSubmit();">Ok</button>  
    <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>  
    </div>  
    </div>  
    </div>  
    </div>  
    </div>  
    <div 

Open in new window

0
Ultimate Tool Kit for Technology Solution Provider
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

I have a simple mvc razor view webpage. and javascript.
my question is why below code is not working.
I try to get all of the <input type=text> that has id prefix start with 'cost'.
However, when I take out substring, i can read the entire string.


if (id_name.substring(0,4) == "cost") {
                        alert(id_name);
                    }

@model List<Domain.FleetEventPricing>
@Html.AntiForgeryToken()
@{ int totalcount = 0;}
@foreach (var i in Model)
        {
            totalcount = totalcount + 1;
        <div class="row with-forms">
            <!-- Status -->
            <div class="col-md-8">
                <input type="text" placeholder="@i.eventname" value="@i.eventname" id="eventname_@i.eventId" readonly />
            </div>
            <!-- Type -->
            <div class="col-md-3">
                <input type="text" placeholder="@i.cost" id="cost_@i.eventId"  value="@i.cost">
            </div>
            <div class="col-md-1" style="vertical-align:middle;">
                <a href="#"><i class="fa fa-trash" style="font-size:25px;"></i></a>
            </div>
        </div>           
}
<input type="hidden" value="@totalcount" id="totalcount" />
<div class="col-md-12">
    <a href="#" onclick="UpdateEventCost()" class="button preview">Update Now <i class="fa fa-arrow-circle-right"></i></a>
    <br /><br />
</div>
<script>
        function Validator() {
            return true;
        }
        function UpdateEventCost() {
          

Open in new window

0
I made some changes in my meta file and now my bootstrap datepicker doesn't work.  Here is what I have in the header:
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="GENERATOR" Content="Microsoft Visual Studio 6.0">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="alternate" href="http://gopherstateevents.com" hreflang="en-us" />

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<link rel="shortcut icon" href="/assets/images/g-transparent2-351x345.png" type="image/x-icon">
<link rel="stylesheet" href="/assets/web/assets/mobirise-icons/mobirise-icons.css">
<link rel="stylesheet" href="/assets/tether/tether.min.css">
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap-grid.min.css">
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap-reboot.min.css">
<link rel="stylesheet" href="/assets/socicon/css/styles.css">
<link rel="stylesheet" href="/assets/dropdown/css/style.css">
<link rel="stylesheet" href="/assets/theme/css/style.css">
<link rel="stylesheet" href="/assets/mobirise/css/mbr-additional.css" type="text/css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.0/css/bootstrap-datepicker.css">

<script src="/assets/web/assets/jquery/jquery.min.js"></script>
<script 

Open in new window

0
You can see my example here. Download and click on page.html.  https://drive.google.com/file/d/1Kt2CQwvTAdY0uojPf8sf7krVu6sEz61f/view

1. When page loads, I have one row with "And" and the "X" delete.
2. I can click on Add and keep adding divs

What I want to do is:
1. The first row, remove the X
2. When on the last row ( I can have as many rows as I want)...remove And

f1.png
I thought about finding the # of divs that has X and AND. If only 1, hide "X". But that's not going to work.

I think I need to drill down these divs but still not sure how to hide X and AND

f2.png
0
Hi, I have a question of react js:  I need change the value of this.props.sortClick  like below:
if (this.props.sortClick === true)
      {
      this.props.sortClick =false; //How can do it?  can't do this ay, since I can't modify the vaue
          return true;
      }
      else {
          return false;
}
  

    },

Open in new window



Thanks
0
Ajax Success callback doesn't work.
Hello this is my second question i have problem with success callback of my ajax function... it doesn't reload my data table after deleting rows... how can I correct it my code is
<script>
        $(document).on('click', '.delete', function() {
            var that = this;
            swal({
                title: "Are you sure?",
                text: "You will not be able to recover this imaginary file!",
                type: "warning",
                buttons: true,
                showCancelButton: true,
                confirmButtonColor: "#DD6B55",
                confirmButtonText: "Yes, delete it!",
                closeOnConfirm: false
            }).then(function(yes) {
                if (yes) {
                    var id = $(that).attr("id");
                    $.ajax({
                        url: "delete.php",
                        method: "POST",
                        data: {id: id},
                        success: function (data) {
                        dataTable.ajax.reload();
                        }
                    });
                }
                else {
                    return false;
                }
            })
        });
    </script>

Open in new window

my success code
                        success: function (data) {
                        dataTable.ajax.reload();
                        }

Open in new window

How Can I correct this guys?
0
Hello guys good evening, is there anyone willing to help me. This is about ajax function and sweet alert using php pdo connection... I just want to replace javascript alert which is this
if(confirm("Are you sure you want to delete this?"))

Open in new window

with sweetalert ...my code is in below...

I want to add sweetalert to my ajax function...anyone knows how to add that?
AJAX
$(document).on('click', '.delete', function(){
		var id = $(this).attr("id");
		if(confirm("Are you sure you want to delete this?"))
		{
			$.ajax({
				url:"delete.php",
				method:"POST",
				data:{id:id},
				success:function(data)
				{
					$('#alert').html(data);
					$('#alert').show().delay(2000).fadeOut();
					dataTable.ajax.reload();
				}
			});
		}
		else
		{
			return false;	
		}

Open in new window

SWEETALERT
swal({
            title: "Are you sure?",
            text: "You will not be able to recover this imaginary file!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "Yes, delete it!",
            closeOnConfirm: false
        )},

Open in new window

0
I have a table with rows that I hide and show using the jQuery functions show() and hide(). I have some css rules that display the table with alternating row colors by doing something similar to the following:

tr:nth-child(odd) {
    color: #000000 ;
    background-color: #F8F8F8 !important;
}

Open in new window


and something similar for the even rows.

My problem is that the style is applied to all rows even the hidden ones so as a result my table does not have alternating row colors when some of the rows are hidden. I have tried doing the following but that did not work:
]tr:visible:nth-child(odd) {
    color: #000000 ;
    background-color: #F8F8F8 !important;

Open in new window


I am hoping someone can help me with this
0
Hello, I want to make localization for my electron app. It works, if I use the second countryCode, but if I require the countryCode it the first 3 .text function dont work. The .val-s working everytime.

const $ = require('jquery');
const {app, remote, ipcRenderer} = require('electron');
const fs = require('fs');

// var countryCode = require('electron').remote.getGlobal('sharedObject').cc;
var countryCode = 'en';

fs.readFile('localization/' + countryCode + '.json', function(err,data) {
  if(err) throw err;
  var json = JSON.parse(data);

  $('#localization--navbar-store').text(json.Store);
  $('#localization--navbar-library').text(json.Library);
  $('#localization--navbar-community').text(json.Community);
  $('#tray--exitAllWindowBTN').val(json.Exit);
  $('#tray--openClientBTN').val(json.Open);
});

Open in new window

0
Please see attached image. This is the output of a php program. The display uses bootstrap & the left half is displayed first (based on the flow of the php program), the right half after that.

The issue is this. When a user enters a markup value (a number > 0 and < 10), that number is used as a multiplier on the the total price and that is displayed, as you can see. I entered 1.1 and it displayed as $16,109.50.

What we also want to have happen is that the prices change in the lower left to say Modified Trade Pricing & each item to be multiplied by 1.1, the total then being identical to the total on the right after New Modified Total Trade Price.

The way I am now making work what you see is when the Confirm button (a submit element), the corresponding Javascript calls another php program. The Javascript is like this ( the variable ac is set to "co":
if (ac == "co") {
			if (!isnumeric(document.st.markup.value.trim())) {
				alert("Invalid markup value.")
				return false;
			}
			val = document.st.markup.value;
			valok = false;
			if (val > 0 && val <= 10) {
				valok = true;
				document.st.action = "apply_markup.php?fr=" + fr + "&em=" + em + "&ddocs=" + ddocs + "&ps=" + ps + "&nosumm=" + nosumm;
				return true;
			} else {
				alert("Invalid markup value. Must be > 0 and less than or equal to 10.")
				return false;
			}	
		}	

Open in new window


The apply_markup.php looks like this:
<?php
// apply_markup.php
ini_set('session.cache_limiter','public');
	

Open in new window

0
Cloud Class® Course: Microsoft Windows 7 Basic
LVL 12
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

JavaScript,PHP,Python, XML

I have read that JavaScript is Front End, but what does that mean in a development standpoint?.  Does the Developer change the Webpages in an automation way on the web server?
I am not sure how Javascript is used in the business world ,whether it is installed on the Server(windows server or Linux) or on a workstation( windows 7)
Let's say we have Javascript installed on Windows Server , then web server is installed on the same box(windows server), then JS will automate the web pages that got generated in the web server. is that the Front End

Back End, probably they mean the Program language used such as PHP or Python or Java, will use  the Web Server as well as the Database( MSSQL,MySQL,SQLLITE.etc...)

I threw in this question XML, because I am not sure if it gets created automatically or a developer has to manually write it like he/she will write HTML

Thank you
0
Please Help!!!

I have a page with a ComboBox.
I want to trigger a Postback when the ComboBox is updated.

Am I on the right track with the following code?

----------------------------------

 <Script> 
function ComboChange(obj) {
var comboValue = document.getElementById('MktReportSelectDate').value;
__doPostBack('MktReportSelectDate', comboValue);}
</Script> 


<TR>
   <TD  ALIGN="RIGHT">Reporting Period:&nbsp;&nbsp;</TD>
   <TD  ALIGN="LEFT"><SELECT NAME="MktReportSelectDate" ID="MktReportSelectDate" OnChange="ComboChange()" >
<OPTION VALUE="Custom Date Period" SELECTED>Custom Date Period
<OPTION VALUE="First Quarter">First Quarter
<OPTION VALUE="Second Quarter">Second Quarter
<OPTION VALUE="Third Quarter">Third Quarter
<OPTION VALUE="Fourth Quarter">Fourth Quarter
<OPTION VALUE="This Year">This Year
<OPTION VALUE="Last Year">Last Year
<OPTION VALUE="This Month">This Month
<OPTION VALUE="Last Month">Last Month
</SELECT>
</TD>

</TR>

Open in new window

----------------------------------

The ComboBox is displayed properly. But the Postback is not triggered when a new value is selected.

I am new to HTML and have a project that I need to complete ASAP. Any help would be greatly appreciated.

Many Thanks,

Nelson
0
So i have a user schema like this:

var user_schema = new Schema({
   username:{type:String,required: true, unique : true, trim: true},
   college:{type:String,required: true},
   password:{type:String,required: true, trim: true},
   email:{type:String,required: true, unique : true, trim: true},
   phone:{type:Number,required: true, unique : true, trim: true},
   dp:{type:String},
   tag:{type:String},
   description:{type:String},
   friends:[{type:String}],
   pending:[{type:String}],
   skills:{type:String},
   bucket:[{type:String}]
  });

Open in new window

and my objective is, to search the all the documents in the collection to get people based on the following conditions:

1. They should not be in the users' "friends" array.
2. They should not be in the users' "pending" array.
3. They should have the same "tag" (a string value) as the user.

So, basically I have to compare the users' fields ("friends","pending" and "tags"), with fields of all documents in the whole collection.

How do I do it, using mongoose (nodejs mongodb library)
0
I need to pass two variables via ajax to a php program. So far, the ajax looks like this:
if (val > 0 && val <= 10) {
				valok = true;
				str = document.getElementById("vsid") + "&val=" + document.getElementById("markup");
				<!-- ajax goes here --!>
				 var xmlhttp = new XMLHttpRequest();
					xmlhttp.onreadystatechange = function() {
					if (this.readyState == 4 && this.status == 200) {
						document.getElementById("mkup").innerHTML = this.responseText;
            }
					};
					xmlhttp.open("GET", "markup.php?v=" + str, true);
					xmlhttp.send();
				return true;
			} else {
				alert("Invalid markup value. Must be > 0 and less than or equal to 10.")
				return false;
			}	

Open in new window


I'm thinking that str is not right, since I'm coding it like I would at the end of a url & retrieve the info on the other end with $_GET[]'s.

But the examples I have seen in php use $xx = $_REQUEST['parm'];
Do I use $_REQUEST['str'] and break it out myself or can I do $_REQUEST['str'] to get the first one and $_REQUEST['val'] to get the 2nd one?

Thanks
0
I want to open a information popup and then have it close when focus is lost.
I find that the window closes, or I should say that focus is returned to the parent page, but  the
is still open in the background and you can be tabbed to it as a window.  I want it to be gone.



Here is my test case:
----------------------------------
<button onclick="myFunction()">Open</button>

<script>
function myFunction() {
    var myWindow = window.open('W4_tech_detail.php?Part_no=SGCU1CH','','scrollbars=yes,resizable=yes,width=700,height=600');
    myWindow.focus();
    myWindow.onblur=mywindow.close;    
}
</script>
------------------------------------------

Here is my test URL :        https://www.eshowerdoor.com/test-window.html
0
Looking for a Best IDE for developing web application using MEAN.JS or MEAN.io

Pls suggest a few
0

JavaScript

121K

Solutions

41K

Contributors

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and  in almost every mainstream web browser.