JavaScript

121K

Solutions

42K

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

need to call a javascript file.js (html5shiv and html5shivprint) if user open a web page from a specific browser like IE
 also need to make ulter way to use audio player if browser not support html5 audio player.
  thanks
0
Angular Fundamentals
LVL 12
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

I'm trying to create a bookmarklet in chrome that will modify a form's input data.

One of the fields looks like this:
<input type="text" id="shipping:firstname" name="shipping[firstname]" value="John" title="First Name" maxlength="255" class="input-text required-entry" placeholder="First Name*" onchange="shipping.setSameAsBilling(false)" autocapitalize="off" autocorrect="off" oldautocomplete="remove" autocomplete="off">

Open in new window


Yet when I click my bookmark, it just pops up the new user's name in a blank page...
code is simply:
javascript:  let first = document.getElementById('shipping:firstname');  first.value='John';

Open in new window


What am I doing wrong?
1
Is there a way to monitor and then kill a server request for an image (preferably in JavaScript) if it is taking too long? The image comes from a 3rd party server so I'd have to kill it on the request side. I'm asking due to us firing 3rd party marketing pixels on our web app. Sometimes they take extreme amounts of time to respond.
1
Hi,
I have 3 apps that are operating within ms/access (split beck end) and need to (i) integrate them in a single unique app and (ii) migrate to a web-based environment (i.e. accessible through a browser)  or client/server with the database on the back-end. I recognise that I really must quit ms/access as its restrictions on the GUI are starting to really show and its cracking all over (e..g. it launches explorer to accede to a dynamic net page to show GIS stuff, but the inverse path (from explorer back to ms/access is, simply, impossible).

The back-end database is open but I am able to use any common databases, ODBC databases as I will limit both the field types and the functions, but I need to process images (I have been doing it with bought controls).

My first idea is to go with NetBeans or IntelliJ or Azure but I am terribly hesitating. If its desktop based, the final app needs to run on many platforms or then be web-based. Running on IOS/Android would also be a requirement.

can anyone help?

(in total I gave roughly 300 forms and 150 reports and about 450 columns... (not counting roughly 200 queries over 150 tables).

Can anyone help to coach me on a convenient path?

all hints will be cheerfully accepted

joao

PS I am able to pay for a licensed platform. My current MS/Access "bloat" came from the extraordinary EE sopport...
1
I need help writing a Javascript function which will take a string as an arugment and then filter out an array of strings starting with the string I pass as an argument.
So if I have the following array:
let words = ['simple', 'single', 'side', 'sacked', 'apple', 'orange']
I need a javascript funtion that will look at every string in this array, and give me a second array called myFilteredWords which start with the letters 'si" - assumuming that I pass 'si" as an argument to the funtion.
1
Trying to display the day of the week in the Philippines on my website no matter where the user is located. I am in the USA, no idea where the server is. below code only returns the browsers local day:
<script>
        var weekArray = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
        var week = weekArray[new Date().getDay()]
        document.write(week);
    </script>
1
Hello Experts,

This issue is concerning an ASP.NET webpage that's currently used in our contact center.
It's a personalized launch page for users, with links they need to do their jobs.
But recently some of the tools used by our colleagues have changed.

The problem is, some links now work faster in IE and some faster in chrome.
And the difference in speed is rather dramatic in some cases.

I need a way to force the individual links to open in the fastest browser.

Many Thanks!
Maurice
1
does google webmaster tools require javascript on every website page for tracking

where is javascript code in google webmaster tools
1
Talking to several people, it seems jquery has started to become a little less popular. I am curious if there is a technical reason for this, or if it is more of a it is just a little less popular?  Thoughts?
0
Hello Experts,
I have a Onclick event attached to button which should open a window (on Javascript), which is working just fine.  But, when I click on another URL same window opens up, which is not related to the URL at all.  Any idea what could be going on?  Please try to help.  Thank you in advance.

Note:  Due to company's restrictions I will not be able to post the code here.

Thank you!
0
Big Business Goals? Which KPIs Will Help You
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

I am looping within a radio group, getting the selected radio and then using it's order to get the data from a listbox, so if the selected radio is number 5 then  textbox1 must contain item 5 of the listbox1, here is my code (which is not working)

<script>
    function myFunction() {
        var AllListItems = document.getElementById("ListBox1");
        var WantedRadio = document.getElementsByName("CheckedRadio");
        var RadioGroupLength = WantedRadio .length;
       
        for (var i = 0; i < RadioGroupLength ; i++) {        
            if (WantedRadio[i].type == 'radio' && WantedRadio[i].checked == true)
                document.getElementById("TextBox1").value = inputfields[i].value;  //this line works fine
                document.getElementById("TextBox1").value = AllListItems.options[i].value;  //this line does not work

    }
}    
</script>
0
Any Recommendations on where to look to re order a list based on input, i have a list that has switches and what i am trying to do is some filtering to display checked switches

$("#check-sort-list").on('change', function() {
       var get_selected = $(this).val();
        
        alert(get_selected);
        
        if(get_selected == 1)
            {
                console.log(get_selected);
            }
        
        else if(get_selected == 2)
            {
                console.log(get_selected);
            }
        
        else if(get_selected == 3)
            {
                console.log(get_selected);
            } else 
                {console.log("No selection");}
    });

Open in new window



my list is just a normal html list with a label and a checkbox.
0
Hi I am selecting data from mysql database in node red: -

my database value are as follows:-
dbtime.png
Code in node red as follows: -
 msg.topic ="Select DeviceId, Line, outPIN, count,Time FROM mytab LIMIT 1"

Open in new window


In debug node i do get the time in different format and unable to store in different location of database.

9/17/2018, 4:59:29 PMnode: 4f250b1.97196f4
INSERT INTO mytable1 (DeviceId,Line,outPIN,count,Time) VALUES (?,?,?,?,?) : msg.payload : array[5]
[ 2, 1, "7", 1, "2018-09-16T13:28:24.000Z" ]
9/17/2018, 4:59:29 PMnode: d00874f1.76f388
msg : error
"Error: ER_TRUNCATED_WRONG_VALUE: Incorrect datetime value: '2018-09-16T13:28:24.000Z' for column 'Time' at row 1"

Open in new window



How i can format the time back to normal 'yyyy-mm-dd hh:mm:ss'
0
I am trying to send a text message (SMS) using email by using the telephone number, and the carrier specific suffix. For example, to send to a Boost Mobile customer, you would simply send an email to: 8135551212@myboostmobile.com - and it will send a text message to that number. Each carrier has its own suffix.

I have a list of carrier information:

Carrier            SMS gateway domain      
Alltel            [insert 10-digit number]@message.alltel.com      
AT&T            [insert 10-digit number]@txt.att.net      
Boost Mobile      [insert 10-digit number]@myboostmobile.com      
Cricket       [insert 10-digit number]@mms.cricketwireless.net
Project Fi      [insert 10-digit number]@msg.fi.google.com
Sprint            [insert 10-digit number]@messaging.sprintpcs.com      
T-Mobile      [insert 10-digit number]@tmomail.net      
U.S. Cellular      [insert 10-digit number]@email.uscc.net      
Verizon            [insert 10-digit number]@vtext.com      
Virgin Mobile      [insert 10-digit number]@vmobl.com      
Republic Wireless[insert 10-digital number]@text.republicwireless.com


Our C# driven site already has code set up to send an email.  We call the c# controller from Javascript like this:

var objToSend = {
     Email: "john@gmail.com",
     Body: "This is the body of the email",
     Subject: "Hello from our site."
}

// Call controller to send the email
$.post('/Contact/NotifyAdmin', objToSend);

Open in new window


So what I want to do is, re-use our existing code to send a text message.

Assuming I have the carrier and phone number available to me, how would I use our existing code?

var phoneNumber = "8135551200";
var carrier = "Verizon";

// Somehow I need to "build" the phone number in its correct format and pass as the "Email" property

// Then.. call our controller as normal

Open in new window


I think this is an ARRAY problem, isn't it? Can anyone help me get me going?

Thank you for looking.

Regards,

John
0
Problem:

Encountering Reference Error/.JS file unable to load. The goal is to have input from the user displayed in another text field.  Then reset the first input field so that new info can be put in. The code is 97% complete with all HTML requirements including methods and variables in the .js file. The code is in vanilla javascript and HTML. Located below and saved as a .txt for upload compatibility to the site.

Attempted solutions: Initializing the anonymous function to a variable did not work. Looking for a solution ASAP. Plugins/extra frameworks/Jquery cannot be used.
THECURRENTASSIGN1CODE91518.txt
0
How to have textbox regular expression validation on asp.net?


I will have to allow 3 digits and units in the text box. Decimal units should not exceed more than 2 units.

How to handle that?
0
I'm trying to learn the syntax to call a JavaScript function from code behind and passing a string parameter to the JavaScript function.

I tried similar syntax passing an integer function and that worked fine

But something is not working when I try to pass a string parameter.

Below is my code.

What am I doing wrong?

When I click the button it should show the string "John Smith"  in the alert window.


CallJavaScriptFunctionFromVB.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CallJavaScriptFunctionFromVB.aspx.vb" Inherits="JavaScriptsEventsVB.CallJavaScriptFunctionFromVB" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
   <script type="text/javascript">
       function employeeFunction(strparam1) {

           // show string parameter in alert window
           alert(strparam1);
       }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <h4>
        Call JavaScript function from code-behin in Asp.net</h4>
    <div>
        <asp:Button ID="btnServerSide" runat="server" OnClick="btnServerSide_Click" Text="Call Function" />
    </div>
    </form>
</body>
</html>

Open in new window


CallJavaScriptFunctionFromVB.aspx.vb

Public Class CallJavaScriptFunctionFromVB
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnServerSide_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnServerSide.Click

        Dim testparam1 As String
        testparam1 = "John Smith"

        ' ----- call a JS function from vb code and pass a string parameter to it -----
        ScriptManager.RegisterStartupScript(Me, [GetType](), "TestFunction", String.Format("employeeFunction({0});", testparam1), True)

    End Sub

End Class

Open in new window

0
Explain how TypeScript fits into Angular?

I coded Angular 4 and am pretty sure I used TypeScript. But, I can not recall exactly where.

Please refresh my memory.

Thanks
0
Advantages of Tensorflow.JS?

What are the benefits of using Tensorflow.JS in comparison to other Javascript frameworks?

Does it transpile like Angular?

What other frameworks are similar?

Is there any benefit to using Tensorflow.JS with a .NET back-end?

Thanks
0
Determine the Perfect Price for Your IT Services
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

I need help writing javascript

In English here is what I need converted to java script, please

If the Feild "Term" is null or is <= 12 then = 1 else
If the Feild "Term" is >= 13 & <=24 then = 2 else
If the Feild "Term" is >= 25 & <=36 then = 3 else
If the Feild "Term" is >= 37 & <=48 then = 4 else
If the Feild "Term" is >= 49 & <=60 then = 5
0
I'm looking for a  Javascript regx that will detect a-z (case insensitive)  or 09 as a group and then a hyphen followed by any group  of a-z or 09  etc. Always will start/end with (a-z or 09) For example:

a12dd3-23-fff-11n3N33n3-988
9fkr-rtt488-344-45
r5999999Rrp-4-yei388dfi3-3444-fjj577-23
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1234-567-8-922-222222-2-1111
0
Hi: I have a website that I use to store pdf's of safety documents  at our company. I have a flash movie (flash5 !) that navigates from the factory to the department to the workcentre to the role ; and from there launch a php/mysql table that lists and accesses the pdf's appropriate to that role. THe problem is navigation; when I am on the 'php' page I have left the flash movie. If a user wants to go back into the navigation they have to restart the flash movie from the beginning, which kind of disrupts navigation.
 Soooo my question is - it it possible to launch a flash movie AT A SPECIFIED FRAME?  I think the answer lies in javascript of which I know next to nothing......
Thanks!
0
How to enable or disable radio button based on check box selection in Jquery ?

Check box click function is written inside the ready. function.

 $("#Other").on("click", function ()
    {
        if ($("#Other").is(":checked"))
        {   
            document.getElementById('Yes').disabled = false;
            document.getElementById('No').disabled = false;
        }
        else
        {
            document.getElementById('Yes').disabled = true;
            document.getElementById('No').disabled = true;
        }
    });
    $("#Other").trigger("click");

Open in new window

0
I'm trying to call a JavaScript function from VB on button click.

Below is my code.
Why is the alert message not coming up when I click the button?

Call_JSFunctionFromVB1.aspx

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Call_JSFunctionFromVB1.aspx.vb" Inherits="TelerikWindow3Level.Call_JSFunctionFromVB1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function HelloFunctionVB1() {
            alert('Hello you called a JS function from VB')
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         <asp:Button ID="Button1" OnClick="Button1_Click" runat="server" Text="Button" />
    </div>        
    </form>
</body>
</html>

Open in new window


Call_JSFunctionFromVB1.aspx.vb


Public Class Call_JSFunctionFromVB1
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load



    End Sub

    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        ' ----- call JavaScript function -----
        Dim script As String = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(HelloFunctionVB1);</script>"
        ClientScript.RegisterStartupScript(Me.[GetType](), "showWindow", script)
        ' ----- call JavaScript function -----

    End Sub


End Class

Open in new window

0
I have an interesting question

So i have an array build up of inputs like 10.

i need to display it on my front end correctly

here is the test sample frontend -

 <div id = "mobile-user-details" class="user-details__user-data border-top border-bottom p-4">
                      <div class="row">
                        <div class="col w-50">
                          <span>Mobile</span>
                          <span><?=$v_item['CONTACT_PHONE'];?></span>
                        </div>
                        <div class="col w-50">
                          <span>Landline</span>
                          <span><?=$v_item['CONTACT_LANDLINE'];?></span>
                        </div>
                      </div>
                        <div class="row">
                            <div class="col w-50">
                              <span>Email</span>
                              <span><?=$v_item['CONTACT_EMAIL'];?></span>
                            </div>
                            <div class="col w-50">
                              <span>Email</span>
                              <span><?=$v_item['CONTACT_EMAIL'];?></span>
                            </div>
                        </div>
                    </div>

Open in new window


here what outcome

fontend outcome
So what im trying to do is generate this from an array. the issue is im not sure how i can add a new div row wrap after every 2 results.
0

JavaScript

121K

Solutions

42K

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.