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

Return Keyword in Javascript function.
I have the code below that runs and gets the results as expected:
var person = function(name,age,state){
var temp={};
	temp.name = name;
	temp.age = age;
	temp.state = state;

temp.printperson=function(){
	document.write(this.name);
};
[b]return[/b] temp;
};

var person1=person('Omar','25','CS');

person1.printperson();

Open in new window


I would like to know what the keyword "return" does in the code above.

Thank you
0
Cloud Class® Course: Microsoft Exchange Server
LVL 12
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

I'm trying to finish up a demo for a presentation at work and I'm stuck on how to get the calendar to display properly with the date selection added to the start date field.

I've zipped up the code for review - when you open the html file and click on the calendar icon, nothing happens. This was a copy/paste from Zoom.us on their Create Meeting page and only needed this part of the web page for my demo.

Any assistance is greatly appreciated!

zoom.7z
0
Why use AngularJS instead of NodeJs

I would like to know why you should use AngularJS instead of NodeJS seeing that NodeJS can  fetch the Data from the Database server and present it to end user browser. I have seen some AngularJs videos where they use arrays and some code to present data on the browser, I have not seen any example where the Angular connect to the Database...
I thought probably NodeJs can do the same thing Angular does, with easier code.

Reading online, I see Angular is described as Framework ,whereas NodeJs is a Library...but do they achieve the same thing ?

Thank you
0
Anyone can share an efficient script (Javascript or any other) that
does BitCoin mining?
0
On this page:
http://next.plnkr.co/edit/fGqwUnaVndzVavi5JCu3?

This code basically adds annotations to the ace edit.

Line 80 you can see that it adds some properties to the object lineannotations.

once this is done, how can I add some additional properties (in this case line number and comments), as I have logic elsewhere that I need to loop through, adding more annotations as I go.
0
Hello Experts,

I am trying to add an event listener "currentTime" when the video is playing so I can add/remove css styles to the relevant buttons e.g. #titlestadt.
How can I add it to my current script? Thanks!!!

var titlesVideo = $('#intro')[0];	
	
	$("#titlestadt").mouseover(function() {		
		titlesVideo.currentTime = 0;
		$("#intro").addClass("playing");
		titlesVideo.play();		
	}).mouseout(function() {
		$("#intro").removeClass("playing");	
	});
	
	$("#titleland").mouseover(function() {		
		titlesVideo.currentTime = 6;
		$("#intro").addClass("playing");
		titlesVideo.play();
	}).mouseout(function() {
		$("#intro").removeClass("playing");		
	});
	
	$("#titlefluss").mouseover(function() {		
		titlesVideo.currentTime = 10.5;
		$("#intro").addClass("playing");
		titlesVideo.play();
	}).mouseout(function() {
		$("#intro").removeClass("playing");		
	});

Open in new window

0
I am using Survey123 which is an arcgis product for storing the surveys and then using API to retrieve the values from esri portal into oracle database.  So in short i get the dates in the following format.

All i know is the following

Date :
7/16/2018 12:00 AM  is equivalent to 1531713600000
7/17/2018 12:00 AM is equivalent to 1531800000000
7/18/2018 12:00 AM is equivalent to  1531800000000

Now i need a date function in javascript which can convert the date in this format i.e. 1531713600000, 1531800000000, 1531800000000 into this format 7/16/2018 12:00 AM, 7/17/2018 12:00 AM and 7/18/2018 12:00 AM.

Can you please help it is kind of urgent. Your help is highly appreciated.
0
JavaScript Web Developer foundation Skills.

I would like to learn Web development (Front End/Back End) using JavaScript, however after reading online the skills that goes with JavaScript developer are numerous..
Initially I Thought you will have to know:
for Front End Development
HTML
CSS
JavaScript

for Back End Development
JavaScript
NodeJs

However, when reading online, they mention : Jquery ,Angular,Bootstrap,Json,AJAX , probably more than that....

What I would like to know is what are the main areas I should focus in learning to become either Front/Back end Developer

Thank you,
0
http://www.dropzonejs.com/examples/simple.html

I use above webpage to attach the file. but how to remove the file that already uploaded?
0
https://datatables.net/
https://datatables.net/extensions/keytable/
https://github.com/JasonAlanSmith/qualityops
https://github.com/JasonAlanSmith/qualityops/blob/master/qops/templates/test_case/test_case_single_steps.html
http://dev.qualityops.io/
http://dev.qualityops.io/testcase/profile/1/steps


Good evening,

  I could use your help.  :)

  The Problem:  With a data table from datatables.net I want my users to be able to tab through the cells in a row and if tabbing through the last row in the table then when tabbing out of the last cell of the last row then the system should add a new row at the bottom of the list and focus the first cell in this new row.  Tabbing in reverse ideally should take you to the previous row if you reverse-tab out of the first cell in a given row, as long as there is a previous row present.

  Notes:  The first cell in each row contains a number which is a sequence value of each row.  All subsequent cells after that first cell will contain a <textarea> HTML element.  Each row shall hold to this pattern.

  The Code:  Code can be reviewed at the links provided above.  I provide a link to the project and to the specific file in question.

  What I've Tried:  My present attempt is to dynamically generate an ID value for each <textarea> and attempt to track this and set focus to the first cell in the last row.  However, this attempt is not yet working.  In addition, I feel this problem must have been …
0
Cloud Class® Course: CompTIA Cloud+
LVL 12
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

I've been trying to figure this out all afternoon and finally got it working but not sure why it works this way.

1. You can see the code here https://drive.google.com/open?id=1rrIeSnG5orRGi5ftTb14jEhUJfg88Oy1
Just download, unzip and click on page.html

2. Page loads and the dropdown is set on "Weekly". You see the "selected"
d1.png
3. I change the dropdown value to something else. I had to do this to make the new selected value stick. You can see it in
$(document).on('change', '#scheduleArea .schedule select.typeSelector', function () {  
  line 375

	       $(this).find('option[value="' + value + '"]').attr("selected", "selected");
		$(this).find('option[value="' + value + '"]').prop("selected", "selected");

Open in new window


d2.png
Why did I need to do both? any other way of doing this?
0
Hello everyone.

I am working on a website which currently has a page full of background images that currently have a parallax effect.

I don't want to use parallax effects on this site.  

However I am looking for effects to add to a background image that gives them a subtle animation - triggered by up and down scrolling.

For example, I am thinking of a background image that zooms a little bigger that is triggered when the visitor scrolls DOWN the page, and then is triggered to zoom back to "normal" size when the visitor scrolls UP the page.

The zooming in and out should be subtle. Perhaps approximately 15 pixels zoomed in -- and then when scroll up zoom 15 pixel out,

There may be other effects, but I think if I could get the code for the above effect it just might do the trick -- and get my client's approval :)

I would like to see a demo of whatever solution is suggested. Either though Fiddle or Codepen to a web site that has some examples.

Looking forward to your suggestions.

Best
Rowby
0
Hello

I am using class asp and in the IE i am getting this error "Object doesn't support property or method 'startRequest'". on further looking into the code, i found it that the error is from RS.HTM page , which is  a java applet....can any one help me out.
0
Hello

I am working on a site that has some background images.  The background images are created by css.    I would like someone to review the css and confirm that it is indeed a true background image.

I am asking because I want to use some javascript effects on the image -- but they only work with "background images".

Here's the link to the page  Link to page

Here's the image link:  Image file via url

And here's the css I find via firebug related to the above image.  
div#shopify-section-1489283919239.featured-collection-section .parallax_image {
    background: url(//cdn.shopify.com/s/files/1/0008/6940/0623/files/goldenbannernew.png?v=1529908976) no-repeat scroll;
        background-attachment: scroll;
        background-size: auto auto;
    background-size: cover;
}

Open in new window

BTW in order to attach some javascript effects to the backgorund image I realize I will have to remove some of the existing css, such as
 background-attachment: scroll;
        background-size: auto auto;

Open in new window



So with all this "evidence" I am 99 percent sure that it is indeed a traditional background image (even though it's created via css and  not embedded directly in the HTML).

Just an Expert confirm that it is indeed a background image -- and that there are no warnings that I have not thought of == as I try to add some special effects to that image.

Such a long winded question for such a simple request!  :)

Best
Rowby
0
Does Angular.js or Ember.js the better choice for JavaScript frameworks?
0
I am using google.script.host.close() twice on my client html page for closing both dialog and sidebar in Google docs using this JS snippet:

   
   function CloseAll() {
      google.script.run
        .withSuccessHandler(google.script.host.close) //for dialog
      google.script.run
        .withSuccessHandler(google.script.host.close) //for sidebar
    }

Open in new window


This is resulting in closing only the dialog.
I also noticed that after the dialog closes, the focus shifts to Google docs Editor, and I presume that this may be the reason that sidebar is not closing as it has no focus.

I am also unable to change focus back to the sidebar, except when I reopen the sidebar. (But reopening the sidebar does not work for my scenario).

How can I close both the dialog and the sidebar together?
0
How to Detect Traffic From China language hu-hu (reported in google analytics) and divert to a not available in your region page

I notice traffic with language hu-hu in my google analytics with a high bounce rate.

What is the best way of detecting traffic from China -   with language hu-hu?

I have a cold fusion 2016 site.  Thank you
0
I have this HTML code (generated by php). This produces a blank screen:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <script src="//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="simpleLightbox.min.css">     
<script src="simpleLightbox.min.js"></script>
<title>IND Lakos Configurator - Modify Trade Price</title>
<style>
.nopadding {
   padding: 0 !important;
   margin: 0 !important;
}
.wrapper{
  max-width:1100px;
  min-width:900px;
  margin:0 auto;
  
}
#dialog { text-align:center; }
.custom-overlay { background-color: black; background-image: none; opacity: 0.4; } 
</style> 
 <style type="text/css">
        .contentInPopup { padding: 2em; max-width: 40em;}
		.contentInPopup p { font-size: 1.3em; font-family: Arial, Helvetica, sans-serif; }
        </style>
<script type="text/javascript">
$(document).ready(function() {
            $('#click').click(function() {
                $.SimpleLightbox.open({
                    content : $('#myContent').html(),
          

Open in new window

0
This is intersting that I didn't know. The thing is per this https://api.jquery.com/visible-selector/  the element should be visible. I see it in the DOM

 1. I have a page and I changed the design to have tabs
2. Original code didn't have tabs. It's one long page.
3. It does this

	var visibleSchedules = $(document).find('#scheduleArea .schedule:visible');

	if (visibleSchedules.length > 0) {...

Open in new window


4. With tabs (my redesign, when I'm not the corresponding tab... ".schedule:visible" is not visible

This is how I have it now:

t1.png
5. I thought instead of "visible", I should drill down to the dropdown in the div and check the selected value from the dropdown. If at least one not set to "select"...then I can loop thru this div like the old code. So, not look for "visible" because user might be on another tab

t2.png
I tried these but I get black for the what's selected in the dropdown

var visibleSchedules = $(document).find('#scheduleArea .schedule:visible');

         //********* tried this
	//var visibleSchedules2 = $(document).find('#scheduleArea .schedule').find('#Schedules[0].Type:selected').val();

       //******** tried this
	//var t = $('#Schedules[0].Type:selected').text()

	if (visibleSchedules.length > 0) {

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 the code below and what I am trying to accomplish is the field tType has a dropdown with company1 and company2

if company1 is selected Action="https://sharepointex3.dcs-xxx.com/sites/GSSTA/TA/LOAD/Lists/Opportunities/OppDetail.aspx"
if company2 is selected Action="https://sharepointex3.dcs-xxx.com/sites/GSSTA/TA/LOAD/Lists/Opportunities/OppDetail2.aspx"

<form id="form1" Action="https://sharepointex3.dcs-xxx.com/sites/GSSTA/TA/LOAD/Lists/Opportunities/OppDetail.aspx" method="GET">
<span class="style1"><strong>Opportunity Search Tool</strong></span><br />
&nbsp;<table style="width: 100%">
<tr>
<td style="width: 20%" class="style1">Enter the opportunity ID:</td>
<td><span class="style2"><span class="style3">
<input name="tOppID" id="tOppID" type="text" value="OPP-" style="width: 147px" /></span></span>&nbsp;</td>
</tr>
<tr>
<tr>
<td style="width: 20%" class="style1">Enter the opportunity ID:</td>
<td><span class="style2"><span class="style3">
<input name="tType" id="tType" type="text" style="width: 147px" /></span></span>&nbsp;</td>
</tr>
<tr>
<td style="width: 20%" class="style1">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td style="width: 20%" class="style1">
<input type="submit" value="submit" />
</td>
<td>&nbsp;</td>
</tr>
</table>
<br />
</form>

Open in new window

0
Hi

After researching heavily on why the delete query was failing in MS Access FE/SQl Server BE over the net and reading other IT books, it seems like the foreign key is cantered on the issues below:
INSERT and UPDATE Specification Category
I expanded the node to show information for the Delete Rule and the Update Rule for the relationship.
Delete Rule
It says specify what happens if a user tries to delete a row with data that is involved in a foreign key relationship:
•      No Action An error message tells the user that the deletion is not allowed and the DELETE is rolled back.
•      Cascade Deletes all rows containing data involved in the foreign key relationship. Do not specify CASCADE if the table will be included in a merge publication that uses logical records.
•      Set Null Sets the value to null if all foreign key columns for the table can accept null values.
•      Set Default Sets the value to the default value defined for the column if all foreign key columns for the table have defaults defined for them.
Update Rule
It says specify what occurs if a user tries to update a row with data that is involved in a foreign key relationship:
•      No Action An error message tells the user that the update is not allowed and the UPDATE is rolled back.
•      Cascade Updates all rows that contain data involved in the foreign key relationship. Do not specify CASCADE if the table will be included in a merge publication that uses logical records.
•      Set Null Sets the value to null if all …
0
Hello Experts,

I am trying to use browser back button to go to a specific URL. I used PlatformLocation in Angular to detect the popstate event. When I press the back button to go to the URL, it shows the previous angular route for fraction of seconds and then redirects me to the URL. I would like to eliminate that fickle from back button. So, it directly goes to the desired URL, without going to the previous angular route.

Thanks in advance.
0
Hello guys I'm having trouble sending data via aJax post to other page.
my code explain it all how might it supposedly works.

I want to send data from test.php to page.php while page document loads and dispaly also page.php to test.php if it really works.
To make it short how can I echo data:{tablename:tablename} to page.php

Here is my code
test.php
<?php
include ('include/head.php');
?>
<html>
<body>
<div class"showme" id="showme"></div>
</body>
</html>
<script>
$(document).ready(function(){
var tablename = "tbl_released";
{
	$.ajax
				({
					url:'page.php',
					method:'POST',
					data:{tablename:tablename},
					success:function(data){
					
					 }    
				});
				$("#showme").load("page.php");
			}
});
</script>

Open in new window

page.php
<?php
if(isset($_POST["tablename"])){
echo $_POST["tablename"];
}
?>
<html>
<body>
<h1>I am page.php</h1>
</body>
</html>

Open in new window

0
1. in javascript, how to get 15 from this url ? http://localhost:29792/Home/test/15
and
2. in javascript, how to get rid of "#' sign when I have http://localhost:29792/Home/test/15# ?

Thanks
0
Hi, I am populating a table using php. How can I get the value of 'JOB' from the table where the user clicks the checkbox. I have tried to add a class like previously suggested, but I cannot make it work.  I am attaching my code

while($row = $result->fetch_assoc()) {
        printf("<tr><id='traba'><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td><input class='boxtocheck' type='checkbox' id='editar' name='editar' value='".e."' ><td></tr>",$row["fecha"], $row["job"],$row["tipo"],$row["valor"],$row["dinero"],$row["editar"]);
        $total=$total+$row["valor"];
        $total2=$total2+$row["dinero"];
        $jobs=$jobs+1;
    }
} else {
    echo "0 results";
}

Open in new window



<script>    
$(document).ready(function()
{
$('.boxtocheck').change(function() 
  {
    if(this.checked === true)
    {
// I am trying to see if the correct value is posted        y1 = document.getElementById('traba').value;
//                                                                                           console.log(y1);
         alert('Load page to edit');
    }
  });   
});    
</script>

Open in new window

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.