Cannot get code to execute

I have put probes which feeds back to the textbox on my page.
I have commented out sections of code but although the PROBE1 and 2 show,
The line displaying the contents of Heading 1 does not nor anything after that.

Please post your full code (HTML, CSS, JS - no screenshots) and also explain in detail what you mean by “cannot get code to execute”.

I have since simplified and recoded the routine with the same problem.
The script is set to return the result to the calling html.
It is returning the PROBE1 and the PROBE2, but falls and does not reach the PROBE3 line.

function init()
{
  var str = "Text content in Javascript" ;
  var obj=document.getElementById( "wb_txtJS" ) ;

  obj.innerHTML =  str + "<br> PROBE: 1" ;

  var heading1 = "PROBE: 2" ;
  obj.innerHTML += "<br>" + heading1 ;
  
  var conn = new ActiveXObject("ADODB.Connection") ;
  obj.innerHTML += "<br>" + "PROBE: 3" ;
  
  conn.close;
}
document.addEventListener( "DOMContentLoaded" , init , false ) ;

I am trying to get data eventually from an SQL database but … code fails before I get there.

You did not post your HTML. Also, you did not tell us if you are showing any errors in the browser console.

OK… maybe getting somewhere, error in console is
ActiveXObject is not defined - line 11
The question now is why is it not taking the definition… please

<!DOCTYPE HTML>

<html lang="en">

<head>
<meta charset="UTF-8">

<title>external</title>

<script type="text/javascript" src="external.js"></script>
</head>

<body> 
<div id="wb_txtJS"></div> 
</body>

</html>

What operating system and browser are you using?

Using Firefox and Chrome - Windows7Pro

You will have not enable ActiveX on your system.

1 Like

Thank you for the replies and feedback.
In doing my research tonight and discussing with my brother I realise that we need to allow for the code to work across phones and all browsers.
In short Javascript I do not think is going to cut it. I have been instructed to go down the PHP path (groan) which is another language I have to learn from the start again.
Many thanks for your help.

PHP has nothing to do with the browser. The problem is that ActiveX has to been enabled by the user. I would not create an app that require ActiveX. You will definitely need JavaScript to create any sort of web app for browser though. There is no way around that.