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

Hi, I want to use fixed position and z-index to have one section scroll over another section like this:

http://jsfiddle.net/EWefL/

The issue is that my header has a responsive, variable height so I can't define heights of either the header or the section that needs to scroll over it.
0
See following code. Little bit of php, some Javascript & HTML.

$fname= "testersrpt/test" . date('Y-m-d') . ".pdf";
$pdf->Output($fname, "F");			
?>
<!DOCTYPE html>

<html>
<head>
<title>Untitled</title>
<script>
str = "<? print $fname; ?>";
	function on_load() {
		window.open(str);
		window.location = "gen_testers_by_city.php";
	}	
</head>
<body onload="on_load();">



</body>
</html>	

Open in new window


My intent is for the browser to open (in a separate window) the file called str (which is IN that folder) and to redirect to gen_testers_rpt.php (in the same forder we are presently in).

It does neither.

It shows several echos I have inserted for debug purposes & the rest a blank scree.

Why?

Why
0
I have researched the web for examples and can't find one in Coldfusion.

I have an HTML form with dynamically generated fields with checkbox values. I want to be able to click any combination of checkboxes and have a visual tally showing the sum value of the checked boxes. This will allow the user to know the calculated total of the check boxes as they click on them. The TOTAL value field does not need to be submitted necessarily as a form field, but can be.

Example:

[ ] Checkbox 1 (value=1)
[ ] Checkbox 2 (value=2)
[ ] Checkbox 3 (value=1)

If the user clicks boxes 1 and 3, I want a visual real-time display of the total of those two fields as "2".

Please provide working HTML code and Javascript as I suppose would be needed.
0
I have to validate a text field in which only numbers,dots and commas are allowed. Apart from these 3 if I input others then it should throw error.
Pls suggest
0
Can someone tell me why this ticker javascript is not working in IE11? Works fine in Chrome and no console errors. File attached.
0
On my blog page here http://ccdenver33.staging.wpengine.com/blog/ how can I make it so that the menu tab Blog Posts has a border around it but just when you're on that page?
0
Just getting to grips with the whole Service Worker JS concept.

Am I correct that a Service Worker is a  JS script, produced by a website, that resides locally on a browser. It then runs on a regular interval doing something?

For example the service worker could ping a server every minute when teh browser is open, even when a person is not on that site, checking for messages or something?
0
I have a table (screenshot below)

I click on "Add filter" and add a row using this

	$('.filterArea tr:last td:last', '#reportBuilder').text(' ' + text_And); //orig
		//$('.filterArea tr:last td:first', '#reportBuilder').text(' ' + text_And); 
		$('.filterArea tr:last td[name=removeX]', '#reportBuilder').append(' ' + '<span id="addNewFilterRowRemove" style="color: red" class="glyphicon glyphicon-remove"></span>');

Open in new window


But I want to remove the X in the first row. Tried this and a couple of other lines of code but can't get it right. How can I do this?

$('.filterArea tr:first td[name=removeX]', '#reportBuilder').remove(' ' + '<span id="addNewFilterRowRemove" style="color: red" class="glyphicon glyphicon-remove"></span>');

Open in new window


1.png
0
I'm looking for a PowerShell or command line script (or utility) that will query all Active Directory computers (or a list of the computer names I provide in a CSV or text files) that will create a text file listing the dates and times the operating systems on these computers were last rebooted or how long the operating systems have been running since the last reboot.

Are there any existing programs or utilities that will do this?

Or can someone write a script for me that will do this?
0
Hi, Experts, I wish to write something on the td of the table whos id is myProlist3. How could I make  it with the codes below?  In the codes below, I want to do something like this td:eq(1).html = b;

<script>
$(function() { 
  $(document ).on("click","#myProlist3 button.NewQty14",function(){
    let tr = $(this).closest('tr');
    let a = tr.find('td:eq(0)').html(); 
    let b = tr.find('input')[0].value; 
    //This is what i need
    td:eq(1).html = b;
  });
});

</script>

Open in new window

0
(I think Julian Hansen on EE said not to mix jQuery and Angular) but I have to ask again :) ....

I'm working on an MVC/C#/jQuery project. Lots of Razor code with JavaScript in one section and I want to see if I can simply it using AngualrJS and making the code easier to maintain.

I'm looking into AngularJS because I'm familiar with it more. The current code was developed by a developer who's not at the company anymore. It has hardcoded sections, SQL is being built in the code. Hard to maintain.

1. The page I'm looking for recode is a dynamic Reports page.
2. This page has lots of Razor/C# code to build the controls dynamically. It builds dropdowns dynamically. Builds another section dynamically
3. SQL statement is built in C#. Stored proc is not used
4. I see a JS file to build the controls along with the C# code

This dynamic report page is going to be a major part of our site. I want to simplify the code... use stored proc, somehow streamline the dynamic creation of the controls ...maybe use less C#/Razor code.

So, should I introduce AngualrJS into my solution that now is C#/jQuery?

This is how the page looks like now. The sections that I've marked are the dynamic parts of the page.

1.png
0
I have a slider and when I click on a nav button, I want to put the class "active" on one element and "active2" on another one. I thought this would work, but it doesn't

<script type="text/javascript">
   $(document).ready(function(){
       $('input[name="slider"]').click(function(event){
           $('.top').removeClass('active');
           $('.bkg').removeClass('active2');
           $('.slider-wrapper').find('div').eq($(this).index()).find('.top').addClass('active');
           $('.slider-wrapper').find('div').eq($(this).index()).find('.bkg').addClass('active2');

       });
    });
</script>

Open in new window

0
I have numerous DIV's in my page which hold barcodes, for example:

<div id="wrapper">
<svg id="barcode1"></svg>
<svg id="barcode2"></svg>
<svg id="barcode3"></svg>
<svg id="barcode4"></svg>
</div>

Open in new window


I need to print each barcode on a new page (per client request - I don't know why)

My question is, when the user clicks the PRINT button ( a jquery button I made with a click handler) on page, how do I only print whats in my wrapper, and also how to make sure each one is on own page?

Thank you for looking.

Regards,

John
0
This is a code which will display a map according to the selection of the country from Select box
<!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"
      xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Google Maps JavaScript API Example: Geocoding Cache</title>

    <script src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=AIzaSyDxexZDrPusqY36snWHfW7gBrzozeNWUYE"
      type="text/javascript"></script>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">

<style>	
   .searchBox{
     position: relative;
    top: 650px;
    z-index: 

Open in new window

0
Do you have a Android spinner (drop down list) example?
0
There is a drop down list and a text box. Basically the ddl has 5 options and tb will show the date for the first 2 options and then if next 3 options is selected, tb shows 'NA'.

Problem: By default it will show the date in tb. If i select the THIRD option and then back to the FIRST option, it still shows 'NA'. How do i get the ddl to show back to the date after filtering options 3/4/5.

Script code
  <script>
          $(document).ready(function () {
              $('#ContentPlaceHolder1_Choose).change(function () {
                  // Filter ddl w/ date
                  if ($(this).val() == "Friend of IPS") {
                   $('#ContentPlaceHolder1_datetime').prop( "disabled", false);
                  } else if ($(this).val() == "") {
                      $('#ContentPlaceHolder1_datetime').prop("disabled", false);
                  }
                  else {       
                      $('#ContentPlaceHolder1_datetime').prop("disabled", true);
                      $('#ContentPlaceHolder1_datetime').val("NA");
                  }
              }); 

        });
        
    </script>

Open in new window

Html code
    <div class="form-group">
    <label for="lblChoose"> Choose:</label>
    <select runat="server" class="form-control" id='Choose' style="width:350px; left: -1px; top: -2px;">
      <option value="">Select</option>
      <option value="A">A</option>
      <option value="B">B</option>
      <option value="C">C</option>
      <option value="D">D </option>
    </select></div>

  <div class="form-group">
    <label for="lblExpiryDate">New Expiry Date:</label>
      <input runat="server" type="text" class="form-control" style="width:350px;" id="datetime" />
  </div>

Open in new window


cs code
(How i got the date to show by default basically)
 datetime.Value = DateTime.Now.AddYears(1).ToShortDateString();
0
Contractor came in and set up a Production SP site.  A duplicate site was set up for staging.  They have 2 different pool#s.  
If a .wsp file is created does it automatically update both sites?    
There are several sites on the farm.  If it does affect both sites then why doesn't it affect the other sites on the same farm.

There's 1 server 1 farm.

JS
0
How can i replace replace ':' with '>' using jQuery

<!Doctype html>
<html lang="en">

<head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <link rel="icon" type="image/x-icon" href="favicon.ico">
    <script
    src="https://code.jquery.com/jquery-3.3.1.min.js"
    integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
    crossorigin="anonymous"></script>

    <script>
        var ret = "data-123".replace('data-','');
        var test = $('#unselShortList');
        var verificaHorario = $("#unselShortList").find("#value");
        console.log(verificaHorario);
        console.log(test);
        console.log(ret);   //prints: 123
    </script>

</head>

<body>
    <div id="UnselectedSection" class="ms-ref-unselSec" >
        <div id="unselShortList" class="ms-ref-unsel-shortList">
            <div id="Value" name="Item">
                <a id="FilterLink" class="ms-displayBlock" onclick=""
                    href="javascript:{}" title="Presiser etter: Intern:IT og sikkerhet">
                    <div id="RefinementName" class="ms-ref-name ms-displayInlineBlock ms-ref-ellipsis"> Intern:IT og sikkerhet </div>
                </a>
            </div>
            <div id="Value" name="Item">
                <a id="FilterLink" class="ms-displayBlock" onclick=""
                    href="javascript:{}" title="Presiser etter: NL:Finansiering">
   

Open in new window

0
Hi All,

We are developing a application primarily using web api, entity framework, angular js, sql server and C# and hosted on dedicated server running single web site on IIS
Once we have done the data migration (loaded about 150K records)  we have noticed application performance was deistically reduced.
Eg. Service call takes about 15 -20 second (GET) and post is about 20 – 30 seconds.
To overcome this issue I thought of converting some of the codes into stored procedures.

Apart from doing so what we can do in IIS to gain performance boost.
0
Would you recommend dropping IE11 support in favor of using ECMAscript 6 advances. IE11 apparently still has approx 10% market share across a mix of corporate and individual users. This is according to stats from https://analytics.usa.gov/, which I like because it's not so weighted toward power users. I would like to use arrow functions, for example, but 10% seems big. Our client's are corporate, but their audience is mostly individuals.
0
You can download the code from here. Just click on page.html and you'll see the example I've setup.

Code is here https://drive.google.com/open?id=1tCSk98rvfPQ-bmTViZuXxmYb0Mby678s

1. In the right hand side list, I want to be able to move the items up and down. Items can move all the way to the last item in the list. This works
1.png
2. I want to move "Asset Tax" all the way to the top and it won't move.
3. I want to move "Billing address 2" to be the second in the list but when I move it, it goes to the last place.

4. You can double click on the items from the left list and add more to the right list and try this with more items.

Moving an item to the last place works but moving up and down is flaky. Doesn't work correctly.

What am I missing?
0
I have a web app made in PHP and JavaScript that is showing a mix of graph (made with D3 and C3) and text.

The goal is to allow the user to share what he sees with a simple button; this includes, in this stage, to:
 - convert the whole page into a PNG/JPEG image
 - share the image to some social media (facebook/twitter).

Next step would be to give the user the possibility to choose which part of the sreen he wants to share.

I DONT want to add extra layer like Angular (and other similar frameworks) and try to stick to pure PHP + Javascript code.

Any suggestion how to do it
0
I have developed a list filter page which updates using ajax. Everything works well until I have discovered that search engines do not see this content!

Is there anything I can do to make this content visible to search engines using ajax, before I start a redevelopment?
0
i have a node that contains (america-germany) and  another node contain (america&#x02010;germany),when i check for this node are equals or not it say it is not Equal, i am using java with dom parser ,but when i put entity value(&#x02010;) in both node it say Equal,why can anyone help me
0
How can I retrieve all active tabs content (DOM) developing a Google Chrome Extension?
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.