Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium







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

i have a problem
i just want to pass a variable in javascript to another php file here is my ajax code:
var gID=window.gorevid;
                  data: "a=" + gID,
                        alert('ID iletildi.');
                        window.location = "index.php?page=gorevYorumEkle";

and i retrieve it in another php file with it

$gID = $_POST["a"];

but always get an error :Notice: Undefined index: a in

please Help me:)
Hire Technology Freelancers with Gigs
LVL 11
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

On this template: https://p.w3layouts.com/demos/humanity/web/
There is a header that contains a logo (Humanity) and menu: class=header
There is a colored bar above it: class=head

I want the header div to be sticky when the page scrolls. The head div should disappear when the page is scrolled down.

What changes do I need to make to the css and/or javascript to make this happen?
Hi Experts,
I'm updating the records where the checkbox is selected. It is working fine when users select at least one checkbox. But when they don't select anything, I get this error message:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Incorrect syntax near ')'.
How could I add validation to my JavaScript to avoid this error message and remind users to select at least one checkbox.
This is my code:

<!-- Begin
function checkLikeMe($) {
    var x = document.getElementsByName('ID');
    for (var y = 0; y < x.length; y++)
        x[y].checked = $;

// End -->
<script type="text/javascript">
function validate_form ( )
	valid = true;
        if ( document.contact_form.DestQueueId.selectedIndex == 0 )
                alert ( "Please select environment." );
                valid = false;
        return valid;

<form name="contact_form" method="post" action="Recall_send.asp" onSubmit="return validate_form ( );">
<table class="border" align="center" cellpadding="0" cellspacing="0" width="500">

<th><input type="checkbox" onClick="checkLikeMe(this.checked)"></th>

rs.AbsolutePage = intPage
For intRecord = 1 To rs.PageSize
<td><input type="checkbox" name="ID" value="<%=rs("ID") %>"></td>
If rs.EOF Then Exit For
set rs = Nothing

Open in new window

JavaScript code text file is attached.

Right now when clicked, or hit entered the results display on the same window. Would like the results to open in new window or tab.

Hey all I have the following code and JSFiddle that I am trying to figure out why its doing the following:

Try this pattern:
•+Or (notice it does not place Or)
•+Or (notice it does not place Or)
•+Or (finally does place Or)

Try this pattern:
•+Or (notice it does not place Or)
•+Or (notice it does place Or)
•+Or (notice it does place Or)
•+Or (notice it does place Or)
•+And (notice it does not place And)
•+And (notice it does not place And)
•+And (notice it does not place And)
•+And (finally does place And)

var numAND = 0;
var numOR = 0;
var andOrBoxTopNum = 5;

    ___     _   __ ____     ____  ______ _   __
   /   |   / | / // __ \   / __ )/_  __// | / /
  / /| |  /  |/ // / / /  / __  | / /  /  |/ / 
 / ___ | / /|  // /_/ /  / /_/ / / /  / /|  /  
/_/  |_|/_/ |_//_____/  /_____/ /_/  /_/ |_/   
$(document).ready(function() {
  $("#ANDbtn").click(function() {
    var html = '<div id="ANDArea_' + numAND + '"> \
                        <label \
                            class="control-label" \
                            data-base="AMTdata" \
                            data-definedas="text" \
                            data-required="True" \
                            for="sqlANDbtn' + numAND + '" \
                            style="width: 0px; max-width: 

Open in new window

I am writing some javascript tests and I would like to do the below using jQuery, $('.parent .child'); can someone assist?

"has at least 1 entry after loadFeed function is called"

it(".feed container has at least 1 entry", function(done) { 
       var numEntries = document.querySelector(".feed").getElementsByClassName("entry").length;   //use jquery parent/child here

Open in new window

Good day
I have no experience is javascript whatsoever (this is my first attempt)  but my aim is to run excel macros on our server from a web based environment . This will enable me to only give the user what I want him to see.
I am trying to use the office.js API calls to change a value in the spreadsheet containing the macro and a private sub will then run the macro based on the change which occured.
The code below which I have copied from Microsoft I get the error "office is not defined" when I am trying to run the javascript in the Chrome console.
I would also like to know how can I change the code in order for the macro which will always run on the server to execute from any webpage. In other words how do I define the workbook location dynamically?
Office.initialize = function (reason) {
    $(document).ready(function () {
        switch (reason) {
            case 'inserted': console.log('The add-in was just inserted.');
            case 'documentOpened': console.log('The add-in is already part of the document.');
Excel.run(function (context) {
    var sheet = context.workbook.worksheets.getItem("Run macro");

    var range = sheet.getRange("B2");
    range.values = [[ 1 ]];

    return context.sync();
All of the sudden I seem to be have errors on my page loading my background video.  When I check the console I get the below errors, does anybody know how to correct this??:

Uncaught TypeError: Cannot read property 'play' of undefined
    at HTMLDivElement.<anonymous> (custom.js:683)
    at HTMLDivElement.dispatch (jquery.js:3)
    at HTMLDivElement.r.handle (jquery.js:3)
    at Object.trigger (jquery.js:3)
    at Object.a.event.trigger (jquery-migrate.min.js:2)
    at HTMLDivElement.<anonymous> (jquery.js:3)
    at Function.each (jquery.js:2)
    at a.fn.init.each (jquery.js:2)
    at a.fn.init.trigger (jquery.js:3)
    at n (ext.js:1143)

Open in new window


This is the code in the custom.js file the error is referencing:

var video_bg_mod = { };

      if( utils.exists('video-bg')  )
             var h = win.obj.height();
             var w =   h / (h/win.obj.width())  * 1.13  ;

                    "height" : h,
                    "width" :w

   video_bg_mod[jQuery(this).find('video').attr('id')] =  new MediaElement(jQuery(this).find('video').attr('id'),
                            features : [] , 
                         videoWidth: '100%',
                          videoHeight: '100%',

Open in new window

Example simplified/contrived for this question. Recently, I came across following code sample.
There is a Js helper file defined as function() JsHelper and there are bunch of other methods created and defined
as JsHelper.prototype.... .

In the view code under document ready function, a new helper is created --> helper = new JsHelper();

My understanding is JsHelper object is created (even though , it is a function but can be used as a object).
and when once created it will execute all the code within the JsFile, is this right?

and also, in the JsHelper function, a variable me is assigned to this? how does it work?

-----------razor view code ------------------
       $(document).ready(function () {
            helper = new JsHelper();

----------JsFile ---------------------
function JsHelper(){
    var me = this;
     meElements = $("#form").find("input");
      me.dosomething ();

JsHelper.prototype.dosomething = function (){
     var me = this;
       $("#div").each( function () {
             //do sth with the elements
I have a ASP textbox, that I scan a value into.

I want the form to Postback on the scan, currently I have to tab out of the textbox for the onchange event to fire.

Tried the same with JavaScript with the same result.

Any know how to do this?

Free Tool: Subnet Calculator
LVL 11
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Hi, Please see: https://techgardens.com/product-category/mrv  the customer wants me to change the wording on the button from Product Enquiry to Product Inquiry. I'm using plugin WooCommerce Email Inquiry & Cart Options LITE.

There doesn't seem to be a place in the settings to change that, but there must be some javascript somewhere?
I am in the process of upgrading CRM 2011 to CRM 2016 and want to know the feasibility/issues encountered of splitting a full server environment into front-end/back-end servers

The common wisdom has been that this is very difficult and not worth the time.  I would like some up to date information on this, however, since I have not encountered a full-server installation during the last five years.

This is not a highly customized or really large installation.  There are managed solutions from PowerObjects and a limited number of Jscript web resources and plugins.

I would like some advice from someone that has done this process recently and what they encountered, positive or negative.

HTML front-end development has its own limitations as it may be good for static pages but not much capable for dynamic applications. This is where a framework like AngularJS Development fits in – by enhancing the capability of HTML by several notches. And the end result is extremely functional as we
message:"initialize is not a function"
name :"InvalidValueError"

Open in new window

Here is the code:

 <script type="text/javascript">

       $(function initialize(){
  var myLatlng = new google.maps.LatLng(<?php echo $lat_long?>);
  mapOptions = {
    zoom: 15,
    // center: new google.maps.LatLng(10.3313405, 123.8999516)
    center: myLatlng
  map = new google.maps.Map(document.getElementById('map'), mapOptions),
  marker = new google.maps.Marker({
    // position: new google.maps.LatLng(10.3313405, 123.8999516),
    position: myLatlng,
    map: map,
google.maps.event.addDomListener(window, 'load', initialize);


    include '../../Controller/dbconn.php';
   // if(isset($_GET["id"]))
    function map(){
     $myID= $_GET['id'];
  $db = con();

  $sql = "SELECT restaurant_addr FROM restaurants WHERE restaurant_id = $myID";
  $stmt = $db->prepare($sql);
  $row = $stmt->fetch(PDO::FETCH_ASSOC);

   $geocode = file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address=".urlencode($row['restaurant_addr']));
  $lat_long = get_object_vars(json_decode($geocode)); //Store values in variable

  $lat_long = $lat_long['results'][0]->geometry->location->lat . "," . $lat_long['results'][0]->geometry->location->lng;

    // map();

Open in new window

Excuse my ignorance on this subject but is there a standard used when creating a JSON object as a data-layer for a web application from a web service?  The part I don't understand is if I have a web service that returns data and the end result is to create a JSON object used as a  data-layer, Is it usually the Web application takes the data from the web service and creates the data-layer or is it the web service returns the JSON object complete? Or could it be either way?

Can anyone please help or guide me on setting up  Angular  CLI  with Jenkins? I am  setting up  a Development environment for a new  Project
I am using SharePoint 2013.  

I am using Handlebars to display my SharePoint list into a table, which works.  But when I try to turn it into a dataTable, it does not transform into a dataTable.  I was able to do it in jsFiddle and it works.  Can you see what I am doing wrong?  

<!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">

<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Handlebar Js Template Starts Here --> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.min.js"></script>   
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://understandsp.com/spdev/SiteAssets/siteAdmins.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/css/jquery.dataTables.css" />
<script id="siteadmin-template" type="text/x-handlebars-template">
<table border=1 width="100%" id="example" class="display"> 
		<th>First Name</th>
		<th>Last Name</th>

Open in new window

I have a row object that I need to use the row.find method
and essentially go through every control and add an attribute on the control...or maybe even change the ID....

I am thinking attribute would be easier.

I guesss I would need to to through each tr/td in this table and find the id..then make the change.

This row object only has one tr....and only 6 td....each td only has one control  
label,  selectlist,selectlist, decimal input, button, button
Hi, I manage a WordPress website for a local motorcycle dealer and he'd like to integrate with iVendi's finance calculator widget.

All the calculator needs is a line of Javascript in order to generate the widget, with 3-4 fields pre-populated (e.g. URL, username, registration, mileage, value).

The widget works great when you manually paste the code in but I just wondered if it was possible to pre-populate the script based on the listings from the motorcycle's WooCommerce listing.

Below is an example of a sample script that works:

<script src="https://newvehicle.com/widgets/lib/finance-comparator/loader.js?username=www.motorcycledealerurl.co.uk&quoteeUid=UNIQUE-ID-STATIC-VALUE&class=Bike&condition=Used&vrm=AE60HDD&registrationDate=01/11/2010&capCode=&capId=&cashPrice=5295&vatIncluded=&currentOdometerReading=25897&vehicleImageUrl=http://www.motorcycledealerurl.co.uk/wp-content/uploads/2017/12/IMGP8321.jpg&cashDepositType=&cashDeposit=500&term=36&annualDistance=10000&dateOnForecourt=" async></script>

Open in new window

I need to have the following fields populated from the WooCommerce listing:


...ideally these need to be pre-populated for each motorcycle as opposed to manually typing these into the script each time...is this possible?

Thanks in advance!
What does it mean to be "Always On"?
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

I've been trying to get this ng-idle example working and got help yesterday from Leakim and Leonidas here  The answer helped but I have an issue now....

You can see it here

1. I first put the ng-idle on the front page as an example and that works. You see that it pops up.
    I did it by changing module.js and I have config with  run
          I also change loginController and added the popup code to index.cshtml

That worked but I want it inside the site itself so I did this  Please login with this admin@admin.test /Password321$

2. Changed "mainController.js" and added
        .module('lawApp', ['ngIdle', 'ui.bootstrap'])
        .controller('mainCntrl', mainController)
    .config(function(IdleProvider, KeepaliveProvider) {
    }).run(['Idle', function (Idle) {

Open in new window

3. Added the ng-idle code to mainController.js

4. Added the popup code to the razor code

The idle popup displays but look at console and now the other controllers are broken. "feedController" is not defined anymore. Click on "Forms" and FormController is not defined anymore either.

Things I tried:

I added 'ngIdle' to feedController but didn't work
Changed the order of the controllers I call but then mainController throws an error

I know adding .module('lawApp', ['ngIdle', 'ui.bootstrap'])  to mainController is making the other controllers not get initialized. I've read about it on a link Julian Hanson sent me once. I fixed them a while back and now running into it again because I added ng-idle.

Please don't suggest rewriting this in Angular 2

I need to create check off forms on iPads which need a date/time stamp for each item when it complete.  

A process that would work is using Excel with a 3rd party keyboard app like "TextExpander" which would have a script to output the date/time in a cell.  However, Excel is cumbersome to use for some end users, so I was hoping I could create a solution using PDF files.

However, it seems like PDF files need JavaScript to run code in them that would output the current time stamp when a check off box is activated, and it seems like no JavaScript is supported in iOS PDF readers...is this true?  Any ideas or alternatives?

I cannot show the message prompt properly, by the following. Why?

function showMsg0() {
        title: '信息',
        content: 'new或NEW是保护字,不可以选为名字简称!',
        buttons: {
            OK: {
                text: 'OK',
                btnClass: 'btn-green',
                keys: ['enter'],
                action: function () {
                    //$.alert('You clicked OK!');
    return false;
        protected void userabbr_post_change(object sender, EventArgs e)
            if (tb_userabbr.Text.ToUpper() == "NEW")
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showMsg0()", true);
                tb_userabbr.Text = "";

Open in new window

I have an html view...which has a template....
Note the use of display none.  
This template is used to inject a row into my datatable.

The problem with this is ....later on I have javascript that needs to find this control on the page...and it cannot because
Both template and the row added are rendered in html...

I need some way of appending an ID value to the controls when the row is added to the datatable...

Please help.

Here is template on my view:

<table id="new-row-template" style="display:none">
                   @Html.DropDownList("ddlRole", new SelectList(ViewBag.DDLRoles, "Value", "Text"), "")
                    @Html.DropDownList("selectdesignate", new List<SelectListItem>
                        new SelectListItem{ Text="", Value = ""  },
                        new SelectListItem{ Text="Primary", Value = "Primary" },
                        new SelectListItem{ Text="Secondary", Value = "Secondary" },
                   @Html.TextBox("txtAllocation", new { @class = "form-control", @type = "number" })         
                    <button type="button" id="btnInsertContactEntity" class="btn btn-primary btn-xs 

Open in new window

I have some code which pulls tweets from a database, removes any URLs and highlights the hashtag from the string.
I am getting an error on this 1 tweet, and im not sure how to fix it.

Hilarious!! “@kellyfurneaux: Which one is Jodie?! #Sony https://t.co/sAdxCv3bDe�

Open in new window

It appears to be the â character which is 3rd from the end, because when I remove that character it works

	String.prototype.parseURL = function() {
		return this.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) {
			return url.link(url);
	data.text = (data.text.parseURL());

	data.text = data.text.replace(/(\#[a-zA-Z0-9\-\_]+)/g,"<span class='hashtag'> $1 </span>");

Open in new window

Console Error
Uncaught TypeError: Cannot read property 'parseURL' of null
    at createTweet (createTweet.js:8)
    at Object.<anonymous> (twitterwall.js:127)
    at Function.each (jquery-3.1.1.min.js:2)
    at appendTweets (twitterwall.js:109)
    at Object.success (twitterwall.js:77)
    at i (jquery-3.1.1.min.js:2)
    at Object.fireWith [as resolveWith] (jquery-3.1.1.min.js:2)
    at A (jquery-3.1.1.min.js:4)
    at XMLHttpRequest.<anonymous> (jquery-3.1.1.min.js:4)

Open in new window

Could someone help here??
I have the below HTML and would like to change the display to block whenever the 'Reply' div is clicked on each of the them.
The Idea is that I want the div to show when I click on the reply.
I'm currently using a function called showCmt(), and I tried to get IDs from the html to the javascript. Below also is my Javascript. The issue I have is that I don't know how to get it working. Please I need a heads-up.

<div id="cmtreply_35" style="float:right; color:gray; margin-top:-18px; cursor:pointer; margin-right:10px;" onclick="showCmt(this)">Reply</div>
<div id="cmtRsp_35" style="display:none;">Response to this comment is shown only here!</div>

<div id="cmtreply_36" style="float:right; color:gray; margin-top:-18px; cursor:pointer; margin-right:10px;" onclick="showCmt(this)">Reply</div>
<div id="cmtRsp_36" style="display:none;">Response to this comment is shown only here!</div>

<div id="cmtreply_37" style="float:right; color:gray; margin-top:-18px; cursor:pointer; margin-right:10px;" onclick="showCmt(this)">Reply</div>
<div id="cmtRsp_37" style="display:none;">Response to this comment is shown only here!</div>

Open in new window

function showCmt(shocmt) {
    $(document).ready(function() {
        var resp_id = shocmt.parentNode.nextSibling.id;
        resp_id.style.display = 'block';

Open in new window







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.