/    Sign up×
Community /Pin to ProfileBookmark

point to a url

Hello,

I copied this page from a device running embeded linux and I want to put it on a different computer on the same network to control this device. My javascript knowledge is bellow zero. The page is looking for local files. I understand that I have to point all the commands to my embeded linux device (url= [url]http://192.168.0.128)[/url]. Where do I need to add the url address?

Thank you.

This is the page:

<HTML>
<HEAD><TITLE>Matrix3 LX-300 Control Page</TITLE></HEAD>
<BODY>
<H1>Matrix3 LX-300 Control Page</H1>
This is the default web page provided by the LX-ELC EtherTracks module.
<p>
To modify this page, use your web browser to save this page as “index.html” on your local computer, edit it as desired, and then import the modified file back into your project by selecting “Import Files…” from the Files menu in the “Support Files” window (or by dragging the index.html file’s icon into that window).
<p>
For more information, call Meyer Sound at (626) 836-0446, or visit <a href=”http://www.meyersound.com/lcs”>The LCS Series Support Page</a> or <a href=”http://www.lcsforums.com”>The LCS Series User Forums</a>.
<p>
<p>
<p>

<script language=Javascript>

var req;

// This function requests the specified URL in the background, then
// opens up a little window when the URL has been downloaded.
function OpenURLInBackground(url)
{
req = false;
if (window.XMLHttpRequest)
{
// branch for native XMLHttpRequest object
try {
req = new XMLHttpRequest();
} catch(e) {
req = false;
}
} else if(window.ActiveXObject) {
// branch for IE/Windows ActiveX version
try {
req = new ActiveXObject(“Msxml2.XMLHTTP”);
} catch(e) {
try {
req = new ActiveXObject(“Microsoft.XMLHTTP”);
} catch(e) {
req = false;
}
}
}
if (req)
{
try {
req.onreadystatechange = ProcessStateChange;
req.open(“POST”, “http://192.168..10.101”, true);
req.send(“”);
} catch(e) {
alert(“Error sending asynchronous URL request”);
}
}
else alert(“Unable to create asynchronous URL request — perhaps your web browser doesn’t support XMLHttpRequest objects”);
}

var popup;

function ProcessStateChange()
{
if (req.readyState == 4) // only if req shows “loaded”
{
if (req.status == 200)
{
// If request succeeded, show a little temporary window to notify user
popup = window.open(“”, “popup”, “dependent=yes,width=200,height=25”);
popup.document.write(“<HTML><head><title>Command sent!</title></head><BODY>The command was sent!</BODY></HTML>”);
setTimeout(“popup.close()”, 1000);
}
else
{
// Otherwise, tell user about the problem
alert(“There was a problem sending the command:n” + req.statusText);
}
}
}

// This function tells the system to recall the cue with the specified ID.
function RecallCue(cueID)
{
lsb = ((cueID%128).toString(16)); // low 7 bits of the cue ID
hsb = ((cueID>>7).toString(16)); // high 7 bits of the cue ID
OpenURLInBackground(‘http://192.168.10.101/sysex?1F,7E,11,3F,1E,’+lsb+’,’+hsb)
}

// This function opens a dialog showing the system’s current Log contents.
// The contents will be re-downloaded every 10 seconds.
function ShowLog()
{
// Generate the proper Log URL (e.g. “http://192.168.0.101:8000“) based on the
// current document URL (e.g. “http://192.168.0.101/index.html“)
url = location.href;
slashslash = url.indexOf(“//”);
if (slashslash >= 0)
{
nextSlash = url.substring(slashslash+2).indexOf(“/”);
if (nextSlash >= 0) url = url.substring(0, nextSlash+slashslash+2);
url = url + “:8000”;
}
logpopup = window.open(“http://192.168.10.201:8000″,”log”,”dependent=yes,width=850,height=500″);
setInterval(“logpopup.location.reload()”, 10000) // have the log refresh itself every 10 seconds
}

// This function opens a dialog showing the system’s current status.
// The contents will be updated every 10 seconds.
function ShowStatus()
{
statpopup = window.open(“http://192.168.10.101/status?all”,”status”,”dependent=yes,width=350,height=470“);
setInterval(“statpopup.location.reload()”, 10000) // have the window refresh itself every 10 seconds
}

</SCRIPT>

<P>
<hr>
<h2><i>Recall Cues:</i></h2>
<p>
<form>
<input type=”button” onclick=”RecallCue(0)” value=”Cue 0″/>
<input type=”button” onclick=”RecallCue(1)” value=”Cue 1″/>
<input type=”button” onclick=”RecallCue(2)” value=”Cue 2″/>
<input type=”button” onclick=”RecallCue(3)” value=”Cue 3″/>
<input type=”button” onclick=”RecallCue(4)” value=”Cue 4″/>
<p>
<input type=”button” onclick=”RecallCue(5)” value=”Cue 5″/>
<input type=”button” onclick=”RecallCue(6)” value=”Cue 6″/>
<input type=”button” onclick=”RecallCue(7)” value=”Cue 7″/>
<input type=”button” onclick=”RecallCue(8)” value=”Cue 8″/>
<input type=”button” onclick=”RecallCue(9)” value=”Cue 9″/>
</form>
<p>
<p>
<hr>
<h2><i>Maintenance:</i><p></h2>
<A HREF=”javascript: ShowStatus()”>Show Current Status</A><p>
<A HREF=”javascript: ShowLog()”>Show Current Log</A><p>

</BODY>
</HTML>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooMar 17.2008 — You don't mean local files, do you? xmlHTTPRequest only opens files with the 'http' or 'https' protocol, not the file system.

Do you mean files on the localhost server path?
Copy linkTweet thisAlerts:
@yianniauthorMar 17.2008 — Thank you for your reply. Yes I mean the localhost. I realised that I posted the script I was trying to make work on a spare device. This is the original one:

<HTML>

<HEAD><TITLE>Matrix3 LX-300 Control Page</TITLE></HEAD>

<BODY>

<H1>Matrix3 LX-300 Control Page</H1>

This is the default web page provided by the LX-ELC EtherTracks module.

<p>

To modify this page, use your web browser to save this page as "index.html" on your local computer, edit it as desired, and then import the modified file back into your project by selecting "Import Files..." from the Files menu in the "Support Files" window (or by dragging the index.html file's icon into that window).

<p>

For more information, call Meyer Sound at (626) 836-0446, or visit <a href="http://www.meyersound.com/lcs">The LCS Series Support Page</a> or <a href="http://www.lcsforums.com">The LCS Series User Forums</a>.

<p>

<p>

<p>

<script language=Javascript>

var req;

// This function requests the specified URL in the background, then

// opens up a little window when the URL has been downloaded.

function OpenURLInBackground(url)

{

req = false;

if (window.XMLHttpRequest)

{

// branch for native XMLHttpRequest object

try {

req = new XMLHttpRequest();

} catch(e) {

req = false;

}

} else if(window.ActiveXObject) {

// branch for IE/Windows ActiveX version

try {

req = new ActiveXObject("Msxml2.XMLHTTP");

} catch(e) {

try {

req = new ActiveXObject("Microsoft.XMLHTTP");

} catch(e) {

req = false;

}

}

}

if (req)

{

try {

req.onreadystatechange = ProcessStateChange;

req.open("POST", url, true);

req.send("");

} catch(e) {

alert("Error sending asynchronous URL request");

}

}

else alert("Unable to create asynchronous URL request -- perhaps your web browser doesn't support XMLHttpRequest objects");

}

var popup;

function ProcessStateChange()

{

if (req.readyState == 4) // only if req shows "loaded"

{

if (req.status == 200)

{

// If request succeeded, show a little temporary window to notify user

popup = window.open("", "popup", "dependent=yes,width=200,height=25");

popup.document.write("<HTML><head><title>Command sent!</title></head><BODY>The command was sent!</BODY></HTML>");

setTimeout("popup.close()", 1000);

}

else

{

// Otherwise, tell user about the problem

alert("There was a problem sending the command:n" + req.statusText);

}

}

}

// This function tells the system to recall the cue with the specified ID.

function RecallCue(cueID)

{

lsb = ((cueID%128).toString(16)); // low 7 bits of the cue ID

hsb = ((cueID>>7).toString(16)); // high 7 bits of the cue ID

OpenURLInBackground('sysex?1F,7E,11,3F,1E,'+lsb+','+hsb)

}

// This function opens a dialog showing the system's current Log contents.

// The contents will be re-downloaded every 10 seconds.

function ShowLog()

{

// Generate the proper Log URL (e.g. "http://192.168.0.101:8000") based on the

// current document URL (e.g. "http://192.168.0.101/index.html")

url = location.href;

slashslash = url.indexOf("//");

if (slashslash >= 0)

{

nextSlash = url.substring(slashslash+2).indexOf("/");

if (nextSlash >= 0) url = url.substring(0, nextSlash+slashslash+2);

url = url + ":8000";

}

logpopup = window.open(url,"log","dependent=yes,width=850,height=500");

setInterval("logpopup.location.reload()", 10000) // have the log refresh itself every 10 seconds

}

// This function opens a dialog showing the system's current status.

// The contents will be updated every 10 seconds.

function ShowStatus()

{

statpopup = window.open("status?all","status","dependent=yes,width=350,height=470");

setInterval("statpopup.location.reload()", 10000) // have the window refresh itself every 10 seconds

}

</SCRIPT>

<P>

<hr>

<h2><i>Recall Cues:</i></h2>

<p>

<form>

<input type="button" onclick="RecallCue(0)" value="Cue 0"/>

<input type="button" onclick="RecallCue(1)" value="Cue 1"/>

<input type="button" onclick="RecallCue(2)" value="Cue 2"/>

<input type="button" onclick="RecallCue(3)" value="Cue 3"/>

<input type="button" onclick="RecallCue(4)" value="Cue 4"/>

<p>

<input type="button" onclick="RecallCue(5)" value="Cue 5"/>

<input type="button" onclick="RecallCue(6)" value="Cue 6"/>

<input type="button" onclick="RecallCue(7)" value="Cue 7"/>

<input type="button" onclick="RecallCue(8)" value="Cue 8"/>

<input type="button" onclick="RecallCue(9)" value="Cue 9"/>

</form>

<p>

<p>

<hr>

<h2><i>Maintenance:</i><p></h2>

<A HREF="javascript: ShowStatus()">Show Current Status</A><p>

<A HREF="javascript: ShowLog()">Show Current Log</A><p>

</BODY>

</HTML>
×

Success!

Help @yianni spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...