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

say, I have an XML response file from a third party web service.

This contains a result of some operation which, I need to display it to a client. this third party has also provided me with  css and javascript files, which I use to display the response XML in a web browser.

my question is how can i write back a XML file to a web browser?
0
Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I am currently in the process of creating my online portfolio and I am having difficulties with my burger menu icon toggling the off canvas menu.  I've managed to set it to open but when I click it again to close it doesn't work.
0
Thank you for looking at my question,

I have an input form some elements of which are filled from scanned data matrix.
An OnChange event breaks the scanned information down, displays the key piece of data in the text box and writes the supporting information to hidden fields.

The user wants to mouseover the text box after the onchange event and have the supporting information display as a tooltip.

After the onchange event is triggered, when the user hovers over the input box the supporting information is displayed as text within the table <td> element rather than as a tooltip, and doesn't disappear when the mouse is moved away.

Where am I going wrong?

Form element:
echo '<td align="center">RTD<br/>';
	echo '<div class="tooltip"><input type="text" size="10" id="SpigotNoRTD" OnChange="jsHeatNoRTD()" OnMouseOver="jsMouseOverSpigotRTD()" tabindex="1"/>';
		echo '<span class="tipSpigotRTD"></span>';
	echo '</div>';
	
	echo '<input type="hidden" id="SpigotRTDPONo"/>';
	echo '<input type="hidden" id="SpigotRTDDrgNo"/>';
	echo '<input type="hidden" id="SpigotRTDRevNo"/>';
echo '</td>';

Open in new window



JavaScript functionality
function jsHeatNo(){
	var HeatNo = document.getElementById('SpigotNo').value;
	
	if (HeatNo.length > 0){
		var arrValues = HeatNo.split("|");
		document.getElementById('SpigotNo').value = arrValues[0];
		document.getElementById('SpigotPONo').value = arrValues[1];
		document.getElementById('SpigotDrgNo').value = arrValues[2];
		

Open in new window

0
Hi, I am using bootstrap treeview , I would like to know how I can add node dynamically at run time. means users should able to add any node.

any help will be highly appreciated.

Regards,

Aamir
addNodes.png
0
Hi, I need to make sure our users always have the latest copy of a .pdf file from our Intranet, so initially I wanted to see if there was a way to prevent the PDF from being saved to the desktop. As this doesn't appear to be possible my next approach is to put the contents of the .pdf into a .html file and use the javascript:popUp command.
This works, however both the Print and Close buttons appear on the printed page along with the header and footer text, all of which I want to remove.
Kind regards,
Rick Penney
javascript-code.txt
0
My ISP is telling me that my IP address has been reported to them as sending out Phishing emails.  I have 15 locations all using the Comcast Metro E and outgoing internet is all on the same IP address.  How might I be able to find which node is infected?
0
difference between evaluation and function in javascript
0
Python Gurus--

I am utilizing a 3rd-party API which returns the data I'm looking for in JSON--however, there is a u'foo' in front of everthing. Maybe a unicode thing?  I want to extract the elements to toss into a tabe that has the same element names.

Here's what I am getting:

[{u'comment': u'', u'enableSpeedWarning': False, u'major': 17, u'licensePlate': u'', u'enableMustReprogram': False, u'immobilizeArming': 30, u'engineVehicleIdentificationNumber': u'1XPBDP9X3GD301269', u'isActiveTrackingEnabled': False, u'workTime': u'WorkTimeStandardHoursId', u'isReverseDetectOn': False, u'brakingWarningThreshold': -34, u'gpsOffDelay': 10, u'minAccidentSpeed': 3.0, u'serialNumber': u'G7DF20DBD6F6', u'timeToDownload': u'1.00:00:00', u'maxSecondsBetweenLogs': 200.0, u'isSpeedIndicator': False, u'id': u'b18', u'customParameters': [], u'hardwareId': 551278326, u'name': u'1579', u'activeFrom': datetime.datetime(2017, 7, 31, 18, 13, 27, 296000, tzinfo=<UTC>), u'corneringWarningThreshold': 26, u'deviceType': u'GO7', u'disableBuzzer': False, u'accelerometerThresholdWarningFactor': 0, u'speedingOff': 90.0, u'minor': 59, u'productId': 109, u'odometerOffset': 0, u'isDriverSeatbeltWarningOn': False, u'deviceFlags': {u'isGarminAllowed': True, u'isOdometerAllowed': True, u'isTripDetailAllowed': True, u'isIridiumAllowed': True, u'isEngineAllowed': True, u'isVINAllowed': True, u'activeFeatures': [], u'ratePlans': [], u'isActiveTrackingAllowed': True, u'isUIAllowed': True, u'isHOSAllowed': …
0
Hi,

I have a requirement in Java script to run the select statements every 3 hours and update those select count(*) counts in a spreadsheet. Kindly share the code snippet to accomplish this request.

Also we are running

1. 2 scripts 3 hours once in a day.
2. 1 Script once in a day.
3. 1 script on particular times like 10.45, 11.15....

please let me know if you need any more details.

Thanks
Venkatesh.
0
I have a blockui popup layer where there is a form. I want to clear the text "Enter your email address" when the user clicks the input field. But when the popup layer opens, the text is gone. How to fix that issue?  Thanks a lot!  My code is as follows:

<input name="emailAddress"  type="text" value="Enter your email address" onfocus="if (this.value == 'Enter your email address') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Enter your email address';}" />

The above code works perfectly fine if it's on a web page, but it doesn't work if it's a blockui layer.

Really appreciate your help.
0
On Demand Webinar - Networking for the Cloud Era
LVL 10
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Hi
In code bellow clicking the button should move the random row to the top of the table
However it only works  if the random number is <= 10 or the paging is set to false any ideas how to fix it  

https://jsfiddle.net/493gpg5a/
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Ajax Table</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.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
      $('#example').DataTable({
            scrollY : '200px', 
            scrollCollapse: true,
            paging: true,  // set to false works
            searching: false,
            info: false
      });
       $('button').on('click', function (){
       $('tr').removeClass("highlight");        
        var ID = randomIntFromInterval(1,20);
         alert("Highlight row " + ID);
//         $("#row_" + ID).toggleClass("highlight");
      $("#row_" + ID).prependTo('#example').toggleClass('highlight');

     });
});

function 

Open in new window

0
Dear,
Is there a way to save/store (within one button event) relevant latitude or longitude of the relevant position, already to the map below?

http://my-friend.co/RegRec2?id=18&user_abbr=mc2&readonly=n
0
Hi E's,
I try to do a simulator/emulator for test my pages in different devices.
The problem is when the resolution is higher then the screen that show the simulate, that broke the width of the screen.
For try resolve the problem I use this two codes:
<!DOCTYPE html>
  <html>
    <head>
<meta charset="UTF-8">
      <!--Import Google Icon Font-->
      <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <!--Import materialize.css-->
      <link rel="stylesheet" href="../../tutoriais/1435/materialize/css/materialize.min.css"/>
 
      <!--Let browser know website is optimized for mobile-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    </head>
 
    <body>
        
        <div class="row">
            <div class="col s12">
                <iframe style="width:960px; height: 600px;" src="iframe.php" width="1920" height="1200"></iframe>
                </div>
            </div>
        
      <!--Import jQuery before materialize.js-->
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
      <script src="../../tutoriais/1435/materialize/js/materialize.min.js"></script>
    </body>
  </html>

Open in new window

<!DOCTYPE html>
  <html>
    <head>
<meta charset="UTF-8">
      <!--Import Google Icon Font-->
      <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <!--Import materialize.css-->
      <link rel="stylesheet" href="../../tutoriais/1435/materialize/css/materialize.min.css"/>
 
      <!--Let browser know website is optimized for mobile-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    </head>
 
    <body>

<div class="row">
<div class="col s2 m10 l10 xl5">
<img src="ponte.jpg" class="responsive-img">
</div>
</div>

      <!--Import jQuery before materialize.js-->
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
      <script src="../../tutoriais/1435/materialize/js/materialize.min.js"></script>
    </body>
  </html>

Open in new window

The first code is where I call the iframe, and the second is the iframe content.
I try to use CSS to reduce the size of the box, but not resolve the problem.

The question is, have any trick, for show high resolution screen in my simulator without broke the width?

The best regards, JC
0
i have a website with few html pages.
i want to add search functionality in it.
no database. need a free search widget to embed in the top of the web page.
0
I am using an iframe to display the form test.authorize.ent/payment/payment. when i press the contunite button on the authorize.net page it should close the iframe and take you to the final check out page. it opens in the iframe. Does anyone have an idea how to do this. I am also posting this to the authorize.net forum.

Below s the code i am using to call the iframe

 <div id="myForm" style="display:none">
    <div id="inline_content">
        <script src="Scripts/colorbox/jquery.colorbox.js"></script>
           <script type="text/javascript">
        $(".inline").colorbox({
            inline: true,
            opacity: 0.5, // overlay a bit less dark
            innerWidth: 640,
            innerHeight: 390,
            onComplete: function () { document.OutputForm.submit() }
        });

       
    </script>
         
        <form name="OutputForm" method="post" action="https://test.authorize.net/payment/payment" target="payframe" id="LinkTo" class="ShowForm">
      <input type="hidden" id="InToken" name="Token" value="" />
       </form>
        <iframe id="payframe" name="payframe"></iframe>
        </div>
        </div>
0
I am working with paypal payment. I want to implement payment condition below:-

Block payment amount on card at the time of reservation. If card cannot be blocked reject the event and add "Payment Declined" to the end of the description. Take payment at 12:01 am the day of the event.

For recurring events...
Block payment for first event at time of reservation. Take payment 12:01 am the day of the event.
For next event in the recurrence series, Block payment after the previous payment is taken and take payment at 12:01 am the day of the event. Continue this cycle until all reservations are complete.
 If card cannot be blocked reject the event and add "Payment Declined" to the end of the description but continue with the series of events.

Please know me how to implement.
0
how to export jsp content, (which will have html div and pie charts) to pdf/excel/csv..
any solution?
0
<!DOCTYPE html>
<html>
<head>
<script src="nine.js" type="text/javascript">
</script> 
<meta charset = "utf-8"/>  
<title>JavaScript for Absolute Beginners</title> 
 
<link rel="stylesheet" type="text/css" href="nine.css" />   
<link rel="stylesheet" type="text/css" href="blue.css" id="skin" />  
</head>  
<body>   
<div id="running">   
  <h4 class="drag">Running</h4>   
  <ul>   
    <li><a class="sprite" id="adidas" href="http://www.adidas.com">adidas</a></li>   
    <li><a class="sprite" id="asics" href="http://www.asics.com">ASICS</a></li>   
    <li><a class="sprite" id="brooks" href="http://www.brooksrunning.com">Brooks</a></li>   
    <li><a class="sprite" id="newBalance" href="http://www.newbalance.com">New Balance</a></li>   
    <li><a class="sprite" id="nike" href="http://www.nike.com">Nike</a></li>   
    <li><a class="sprite" id="saucony" href="http://www.saucony.com">Saucony</a></li>   
  </ul>   
</div>     
</body>   
</html>

Open in new window



When i run with firefox firebug; there is placeholders but I can not see any output
0
I use www.formvalidation.io for my form validation and I need to integrate http://www.plupload.com/

This is my formvalidation.io code...

$('#contact-form').formValidation({
		
		// live: 'enabled', // Default value
		trigger: 'input change keyup'
		
	}).on('success.form.fv', function(e) {
		
		//success message here
		
    });

Open in new window


I need the validation to check if the user has added files, but forgot to upload them. Any idea how I do this?
0
On Demand Webinar: Networking for the Cloud Era
LVL 10
On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

So I have a big pdf file and I want to split it by everytime a name changes (its performance reports so I want each person's file to be saved by itself) to maybe add a blank page so I can merge them by hand or if it would do it for me that would be great, heres the code I used to extract the pages, is there anything I can add to it that would make it find the files and save them by the persons name?
Thanks!

// Iterates over all pages and find a given strign and extracts all pages on which that string is found to a new file

var pageArray = [];

var stringToSearchFor = "ID"
var stringToSearchFor = "Name"


for (var p = 0; p < this.numpages; p++) {
//iterate over all words ;

for (var n = 0; n < this.getpagenumwords(p); n++) {
if(this.getpageNthWord(p.n) ==stringToSearchFor) {
pagearray.push(p);
break;
}
}
}  

if(pagearray.length > 0) {
// extract all pages that contain the string into a new document
var d = app.newdoc();//this will add a blank page-we need to remove this when we are done
for(var n = 0; n <pagearray.lenght; n++) {
d.insertpages ( {
nPage: d.numpages-1,
cPath: this.path,
nStart: pagearray[n],
nEnd: pagearray[n],
} ) ;
}

// remove the first page
d.deletepages(0);



}
0
<asp:DataGrid ID=dg1 AllowPaging=True PageSize=22 PagerStyle-Mode=NumericPages PagerStyle-Position=TopAndBottom AutoGenerateColumns=True Width="95%" HorizontalAlign="Center" CellPadding=0 CellSpacing=0 BorderWidth=0 Runat=server>
								<HeaderStyle CssClass=BasicListHeader ForeColor="white" />
								<ItemStyle CssClass=BasicListItem />
								<AlternatingItemStyle BackColor="#e4e4e4" />
								<Columns>
									<asp:EditCommandColumn EditText="Edit" UpdateText="Update" CancelText="Cancel" ItemStyle-Width="1%" />
									<asp:ButtonColumn ButtonType=LinkButton CommandName="Delete" Text="Del" ItemStyle-Width="1%" />
								</Columns>
							</asp:DataGrid>

Open in new window


The code behind creates the columns for the rows for multiple tables.  My issue is that I will have different number of columns per table and I do not know how to create a modal to reflect different number of columns.
TableEditor-Screen.docx
0
I am implementing paypal payment into my vb.net project using javascript payment system.

I want to schedule payment. For example- I want to enable user to schedule payment in future.

How can i do this?

Please suggest.
0
what is a function literal in javascript?

Is it just a function that is small
var data = {
    foo: 42,
    bar: 43
};

or a function that is saved to a variable name
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
Hi experts, please help me  understand what's the reason why some computers cannot  get the message from the server while trying to  accessed it? The codes below is trying to test the server response how the server deal with the response. My laptop is able to get message while some of my destops, pc cannot. I'm using chrome to all computers but some of my computers cannot get the message from the server. The alert box message will appear blank but some computers able to obtain the message.

Js

 function iSaveToServer(x)
{
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (this.readyState==4 && this.status==200)
	    {
	        	var str = this.responseText; 
	        	alert (str);
	    }
	  }                                             
		xmlhttp.open("GET","SendMsg.asp?a="+ x, true);
		xmlhttp.send();
}

Open in new window


Asp


<%
dim msg
msg = request.querystring("a")

response.write("test-1")
response.end()

%> 

Open in new window

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.