Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x

JavaScript

120K

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

Hello,

I have two rather dated reaction time javascripts. They work fine however each have slight issues.
Please tell me if there are any quick fixes for:

1.
http://reflextest.net/reaction/color.htm

When viewed from an android tablet and android media box, the popup box that returns the user's result has the following extra language a the top: "the page at http://reflextest.net says:"

Is there any way around this, because it's bothersome. The browser on my tablet is FF and the browser on the android box is the generic android browser.

2.
http://reflextest.net/reaction/average.htm

Is there a way to add a reset button to the existing script so that the previous scores are deleted before the user plays again?
0
Hi

Although I've moved forward I'm  Using the https://www.experts-exchange.com/questions/29053802/Javascript-Binding-data-after-clicking-OpenLayers-2-map.html as a start point I have a couple  of further questions

1 Why isn't the icons / markers blue I've tried using relative path and absolute but the  marker stays the default red
My point is I can't change the marker.

2 how do I ensure only 1 popup box is open at once
 
<!doctype html>
    <html>
    <head>
    <title>OpenLayers Click Event Example</title>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>    </head>
    <body onload="init()">
      
    <div class="wrapper">
      <header>
        <div class="container">
        <h1 >OpenLayers Click Event popup</h1>
        
        </div>
      </header>
      <div class="container">

    <div id="mapdiv" style="width: 800px;height: 500px " ></div>
      <h2>Custom Data for clicked item</h2>
      <pre id="result"></pre>
      </div>
    <script src="https://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
      //Set up a click handler
      OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, {                
        defaultHandlerOptions: {
          'single': true,
          'double': false,
          'pixelTolerance': 0,
          'stopSingle': false,
          'stopDouble': false
        },
     
        initialize: function(options) {
          this.handlerOptions = 

Open in new window

0
i want to export HTML/CHART to PDF and excel
how can i do?.
0
Hello guys,

I have this code bellow that is created by my system:

<html>
   
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=11">
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"> </script>
    <script type="text/javascript">

    function matriz(indice, geocoder, nomeCidade, cor, latlng, info, qtdLoja, checkbox) {
        
        this.indice = indice;
        this.geocoder = geocoder;
        this.nomeCidade = nomeCidade;
        this.cor = cor;
        this.latlng = latlng;
        this.info = info;
        this.qtdLoja = qtdLoja;
        this.checkbox = checkbox;
    }

    //cria variáveis globais a serem usadas
    var map;

    var aCliente = new Array;
    var aGeocoder = new Array;

        aGeocoder[0] = new google.maps.Geocoder();
    function geocoderCallBack0(point) {if (!point) {} else {map.addOverlay(createMarker(point,0)); }};
    aCliente[0] = new matriz(0, aGeocoder[0], "SAO PAULO", "yellow", "-14.2350040,-51.9252800", "4 - BARCLAYS<br/>FATURAMENTO,40<br/>SAO PAULO - SP<br/>Fone: (55) 5555555",
    "{qtdLoja}", "{checkbox}");


    aGeocoder[1] = new google.maps.Geocoder();
    function geocoderCallBack0(point) {if (!point) {} else {map.addOverlay(createMarker(point,1)); }};
    aCliente[1] = new matriz(1, aGeocoder[1], "SAO PAULO", "yellow", "-23.5871900,-46.6752099", "5 - BANCO BNP PARIBAS BRASIL S.A.<br/>AV PRESIDENTE JUSCELINO 
KUBITSCHEK,510<br/>SAO PAULO - SP<br/>Fone: () ",  "{qtdLoja}", 

Open in new window

0
Hello!

I am implementing a Web page in JavaScript with Angular.JS & ionic. A page generator is one of the menu items that has a header field where the user can load a file. With the [Save] button, the result is sent to the relational database.

The page generator is saving the whole generated HTML object in the database like

	<div class="hero-image" ivm-bg-axis="y" ivm-bg-drag="" ivm-bg-disabled="disabled" ng-style="imageOptions.style" ngf-background="ngModel" style="background-image: url(&quot;blob:null/3dfb1617-e1c8-45e8-9c0e-5f772129d2cb&quot;);"></div>

Open in new window


where the image is denoted with style="background-image: url(&quot;blob:null/3dfb1617-e1c8-45e8-9c0e-5f772129d2cb&quot;);. This is probably the unique key of the cached browser object, is it? If so, I want to save this image as a BLOB object, say, in another field of the same database record.

Question: How is it possible to get this image out of the browser? Is there a difference getting out this information between different browsers?

Thank you for your reply!
0
I have the javascript where I am trying to do a simple show / hide of the div. but it does not work . please advice

http://jsfiddle.net/p51dytok/4/
0
Hi - I have the below line in my jsp and i am getting error saying
unterminated &lt;

 
var myString = "<img src='images/clear.gif' width='8' height='5'><mytags:dropdown  fieldID=" +"'"+ extDataID+ "'"+" category= " +  '<%=com.test.myString.GET_VALUE_TEST%>' + " selectedOption='' style='InputFields'/>";
			

Open in new window


so what is wrong in the above syntax is javascript not accepting <%= %>

I can pinpoint the error to this line because when i replace the above line with the below line no issues
var myString = "<img src='images/clear.gif' width='8' height='5'><input type='text' name=" +"'"+ test+ "'"+" maxlength = '40' size='64' value='' class = 'InputFields'>";

Open in new window


Thanks,
0
I have what seems impossible.

Note these code sections. First, a form field called "agency", done like this:
<div class="row">
	<div class="col-sm-6 col-xs-6 text-right" style="padding-top:3px;">Agency:&nbsp;</div>
	<div class="col-sm-6 col-xs-6 text-left"  style="padding-top:3px;"><select name="agency" onChange="set_form();">
	<option value="">-- Select Agency -- </option>
	<? for ($i = 0; $i < $nf; $i++) {
		$f = mysqli_fetch_array($resf,MYSQLI_ASSOC);
		$sel = "";
		if ($_SESSION['form'] == $f['agency']) {
			$sel = "selected";
		} ?>
		<option value="<? print $f['agency']; ?>" <? print $sel; ?>><? print $f['agency']; ?></option>
	<? } ?>	
	</select></div>
</div>	

Open in new window


Next, the javascript function set_form(), like this:
function set_form() {
		t = document.st.asstyp.value;
		if (document.st.agency.value != "Houston") {
			if (free == "FR") {
				jj = confirm("This form requires subscription fee. Continue?");
				if (! jj) {
					document.st.agency.value = "Houston";
					return false;
				} else {
					alert("going to subscriben.");
					document.st.action = "subscribet.php?fr=f&ag=" + document.st.agency.value;
					document.st.submit();
				}
			}
		}		
		document.st.action="save_form.php?t=" + t;
		document.st.submit();
	}	

Open in new window

Finally, the code in subscribet.php:
?php
echo "entered subscribe test<br>";
exit;
?>

Open in new window


Note  the alerts in the function set_form(). When I pick a value other than Houston from the dropdown, the alerts display, but but NEVER goes to subscribet.php.

Obviously I have tried to break this down to it's simplest elements. The "real" subscribe.php program does much more.

The result is that it jumps to another version of the first program called form.php.

If it drops through to the end of set_form(), it will go to save_form.php which will have the effect of what is happening. The way I see the logic, that is impossible.

I am probably just missing the obvious. I have tried running this in Firefox with Firebug turned on & Chrome with F11. They show nothing.

Can someone see what is wrong?

Thanks
0
I need to align the menu at the bottom under manufactures in a way where it has a grid like pattern or at displays the names even.  As you can see the some of the names of the companies are longer than the others and it's making the grid uneven.

Thank you anyone who can help?!
0
Trying to find the simplest/best solution for a scrolling banner, right to left,  that i can control the speed.  I have 7 brand logos I want to display, horizontally, and would like them to be linkable.  Any suggestions?  I have been looking around, but nothing is quite what I am looking for.
0
I have a script that has an on state and off state that are represented by images. What I would like to have is a 3rd image  state that is displayed when the user hovers, to show that the images are clickable, currently there is a div that changes content depending on the image that is selected.

Here is the current script

<script type="text/javascript">
            var preIndex = 0;
$("#divNavigate .imgNav").click(function() {
  var ix = $("#divNavigate .imgNav").index($(this));
  console.log(ix);
  $("#divContent .tab:eq('" + preIndex + "')").hide();
  $("#divContent .tab:eq('" + ix + "')").show();
  $("#divNavigate .imgNav:eq("+preIndex+")").attr("src","images/tab_"+preIndex+"_off.png");
$("#divNavigate .imgNav:eq("+ix+")").attr("src","images/tab_"+ix+"_on.png");
  preIndex = ix;
});

$("#divNavigate .imgNav:eq(0)").click();

        
        </script>

Open in new window

0
Hi - I have a table with default 10 rows and now i had a button to add 10 more rows, so when i click on that button new 10 rows must be appended to the table at the bottom.

The table has 4 columns
Label - simple label
integer - shows the count
dropdown - dropdown values to select
textbox

Now i wrote the javascript function for this as below but it has one problem
I am not able to assign unique id to each dropdown select - for example by default we have 10 rows so dropdown id fro those 10 rows are id1,id2,id3,.... id10
now when i click on add 10 rows button the new rows should have id's id11, id12, id13.... id20
so it depends on table length

function addDataRows(divname) {
   var tabObj = document.getElementById("detailTable");
var tableSize = tabObj.rows.length+1;
var strid = "id"+(tableSize+1);
   var newDiv=document.createElement('div');
   var html = '<select id = "<%=strid %>" ' + 
		'<option value="volvo">Volvo</option>' +
		'<option value="saab">Saab</option>' +
		'<option value="opel">Opel</option>' + 
		'<option value="audi">Audi</option>' + 
		'</select>';
   newDiv.innerHTML= html;
   document.getElementById(divname).appendChild(newDiv);
}
function addLRows(divname) {
   var newDiv=document.createElement('div');
   var html = '<input type="text" name="firstname" value="Mickey" maxlength="40" size="64" ><br />';
   newDiv.innerHTML= html;
   document.getElementById(divname).appendChild(newDiv);
}
function add10rows(Container1, Container2){
	

Open in new window

0
Dear,
I want to have bigger height to overall div below. What to adjust?
            <li>
                <div class="imagesList-item-frame shadow"/>
                    <img src=<%=lb_pict5.Text %> onclick="pict_click5();" />
                    <div class="legend">
                        <input type="textbox" id="tb_p5_desc" style="height:20px; width:116px; border:inherit; background-color:#C5C4CC;" runat="server" /><label id="show5"></label>
                        <input type="text" id="tb_p5_desc2" style="height:20px; width:118px; border:inherit; background-color:#C5C4CC; display: none" value="TEST:" runat="server" />
                        <!---span>Some descriptions here</span><br /--->
                        <input type="button" id="butt_p5" onclick="openPopup5();" style="height:26px; width:97px" value="删除照片" runat="server" />
                    </div>
            </li>

Open in new window

0
I want to build a web app that has a lookup field on my form to get data from a 3rd party Restful api.  It would make a url call to the service like : http://www.something.com/api/?id=12345. It passes 1 value.  That call would return 4 values.  Those values would populate my 4 form fields.  Upon save, I would save that data to my database. I planned to use c# and javascript and a MSQL or MySQL db.   I'm open though since it's from scratch.  I'm looking for maybe a HTML, Javascript, DB example or HTML, Javascript, DB, C# or PHP example.  Does anyone have an example of how to do that?
0
I have an asp.net website that uses ajax and javascript.

I changed the javascript variable name but when i run the website and view the code i see the old vairable name. How do i get the progarm to use the new information.

I tried clearing the cookies and press f5
0
Hi,

My button don't work but alert work after success, what should I do ?


<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/gif" href="img/drapeauBruxelles.gif" />
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
    <title>Projet Map</title>
    <style>
       #map {
        height: 600px;
        width: 90%;
       }
    </style>
  </head>
  <body>
    <div class="container-fluid bg-2 text-center">
      <h1 class="margin">Des Marqueurs Google Maps</h1>
    </div>
    <div id="map"></div>
    <nav class="navbar navbar-default">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="https://developers.google.com/maps/documentation/javascript/adding-a-google-map?hl=fr">My Google Maps</a>
        </div>
        <div class="collapse navbar-collapse" id="myNavbar">
          <ul class="nav navbar-nav navbar-right">

            <li><button type="button" id="btn1">Fontaine d'eau</button></li>
            <li><button type="button" onclick="actionImmediate();">Fontaine d'eau</button></li>
   

Open in new window

0
I have been in the Asp.net world for while and built web sites with membership.  I want to use better technology to build Web Apps with security.  Basically, a web based software.  I know this is probably a dumb question, but what is the best stack to make this happen today.  I am familiar with most technologies.  I am better at Web Front End development.  I will also need to be able to consume data from a REST API Jason for my project.  The app will have user and role based security. Can anyone provide some direction?

Web app (software like an accounting app)
User and Role based for data views
Not currently tied to any technology (ie. .net, javascript, Node.js, MSSQL, MySQL, Stateless...)
0
Hi experts, I want to pick some data on the table with an id="myTable" and put it to another div to form another table. My code below seems working but missed one of the data from the row since I want to make a group of two per row. I attached the html here to make it easy to understand for the experts. My goal here is to form a table on a div, a table that has two td per row. Base on the code i created there are 7 items available on the table so, i could not group them by two. Is there any other technique to achieve the goal? Please help.
CreateTableOnSearchTable2.html
0
I am getthing this error message and con no see what is wrong.

The code is at http://www.marshallville-meats.com/test/Default.aspx

you will need to be login
User Name is rrr21
password is green2Apple$

after loging in go to home page and pick item
add the item to the cart
press the cart button at top of page
press the proced to checkout
press next (usp shipping)
press check out

When i press f12 i get the error

i attached the error message as an attached file
errormessage.jpg
0
Here's my server side code but it postbacks and navigate to first tab. How to prevent that postback event/ action is my problem.

  {protected void lnkIssue_Click(Object sender, EventArgs e)
          {

             txtIssuedID.Value = "";
             xtSummary.Value = "";
             txtDetailsIssue.Value = "";
             txtadvice.Value = "";
             txtaction.Value = "";
             txtAnalysis.Value = "";
             txtResolution.Value = "";
             
             }
0
I want to call/executel the script below when I click the Li tag. What am I missing?
HTML

<li class="tabs" id="liNewIssue">New Issue</>


<script>
         $(document).ready(function () {
        $("#liNewIssue").click(function () {
            //$("div").empty();
            $('#txtIssuedID').val('');        
            $('#txtSummary').val('');
            $('#txtDetailsIssue').val('');
            $('#txtadvice').val('');
            $('#txtaction').val('');
            $('#txtAnalysis').val('');
            $('#txtResolution').val('');
 
        });
    });
</script>
0
Hi Following advise from here I'm attempting to build my table using Datatables

In the code bellow I get "TypeError: f is undefined  datatables.min.js (line 60, col 471)" so I'm clearly doing something wrong

I can't just load the data as I need to do stuff, I've added comments, while the data is loading I'm creating a Openlayers marker point (Outside this question scope)

The button is used to simulate the ajax call the table will need to be refreshed

Could someone give me a hand first fixing the error second how to get at & manipulate the data, as commented

<!DOCTYPE html>
<html>
  <head>
    <title>Data Tables</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
    	<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.15/fc-3.2.2/fh-3.1.2/rr-1.2.0/sc-1.4.2/datatables.min.css"/>
 
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.15/fc-3.2.2/fh-3.1.2/rr-1.2.0/sc-1.4.2/datatables.min.js"></script>

<script type='text/javascript'>
	$(function() {
      // jQuery
       $('button').on('click', function (){
          var link = "MOCK_DATA.json";
//          $('#MainTable tbody').html(table);
          

Open in new window

0
I am using the following function in a asp.net website. Some said to use fidder but i can not see how to find the variable.

When i use a alert(Token) it comes with underfined. How can i see what the variable is in javascript.
  function SendForm()
           {
               var Amount = $get("txtOrder").value;
               var OrderId = $get("txtAmount").value;
               var Email = $get("txtEmail").value;
               var FirstName = $get("txtFirstName").value;
               var LastName = $get("txtLastName").value;
               var Address = $get("txtAddress").value;
               var City = $get("txtCity").value;
               var State = $get("txtState").value;
               var Zip = $get("txtZip").value;
               var Token = PageMethods.GetToken(Amount, OrderId, Email, FirstName, LastName, Address, City, State, Zip);
               alert(Token);
               $('#InToken').val(Token);
           }

  [WebMethod]
    public static string GetToken(string OrderId, decimal Amount, string Email, string FirstName, string LastName, string Address, string City, string State, string Zip)
    {
       

        return  CreditCardClass.CreditCardMain(Amount, OrderId, Email, FirstName, LastName, Address, City, State, Zip);
        // test of retrun
    }
0
Hi Guys,

I'm trying to build simple online chat with this example:
https://bootsnipp.com/snippets/featured/simple-chat

I copied this code and it works good. Now I'm wondering how do I recognize who is me and who is the other client I speak with.

you can open this link above and see that "me" is hard coded.
I thought to create textbox and give to the users who want to chat then take this variable and put it in the method "insertChat(who, text, time = 0)"

Please, let me know which is the best idea to do so.
Thanks.
0
I've had this working for months and now nada. Not sure what changed.

On the homepage, I'm supposed to have things slide and fade in on scroll.
All js and css file paths appear to be accurate and I have the initializing code in the head.

http://sandbox.intrepidrealist.com/alan-macy/
0

JavaScript

120K

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.