Click here to Skip to main content
       

JavaScript

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: passing argument from javascriptmemberdineshbabub3 Jun '12 - 21:06 
Hi,
 
I did made some progress by following the below procedure
 
1. instead of using the html file I just created a .bat file
 
@echo off
cls
set username=root
ssh-client-g3.exe -h %username%@net.aspac.nsroot.net
 
Dim WshShell, scomputername
Set WshShell = WScript.CreateObject("WScript.Shell")
Set oNetwork = WScript.CreateObject( "WScript.Network" )
 
WshShell.sleep 10
WshShell.Sendkeys "C2008" & chr(13)
 
 
It works but it stops in password prompt not sure how to pass password to the dialog box.
 
Thanks for any help
GeneralRe: passing argument from javascriptmvpManfred R. Bihy4 Jun '12 - 1:51 
You still haven't supplied the details that I asked for in my first answer to your question.
Which version are you using and why isn't the documentation I pointed to you not mentioníng anything about a ssh-client-g3.exe command line tool?
 
Please review your documentation and give us the details I asked for.
 
Besides that: Trying it out in a batchfile first is a good approach. Thumbs Up | :thumbsup: You can still try later starting it from your HTML page.
 
Regards,
 
Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925


GeneralRe: passing argument from javascriptmvpManfred R. Bihy3 Jun '12 - 21:43 
Ross?
 
Who is Ross? Reading carefully does not seem to.be one your traits.
 
Regards,
 
Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925


GeneralRe: passing argument from javascriptmemberdineshbabub3 Jun '12 - 22:14 
Sorry for the typo Manfred.
GeneralRe: passing argument from javascriptmvpManfred R. Bihy4 Jun '12 - 1:48 
I presume it was less of a typo than a reado. Wink | ;)
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925


GeneralRe: passing argument from javascriptmvpManfred R. Bihy4 Jun '12 - 2:02 
OK it seems there is a ssh-client-g3.exe after all. Here is a link to the documentation: Using Command-Line Options of ssh-client-g3.exe
[^].
ssh-client-g3 [-r] [-p port] [-u user] [-h host] [profile]
The part highlighted in green is the name of a profile file which you can build with the SSH Tectia Configuration tool. Please read the details here: Defining Connection Profiles
[^]. On this page you can search for Defining Authentication which will describe how you can add authentication to a profile so it can be used non-interactively, just the way you wanted to.
 
Regards,
 
Manfred
 
P.S.: Keep us posted of your progress in this! Wink | ;)
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925


GeneralRe: passing argument from javascriptmemberdineshbabub4 Jun '12 - 16:08 
Hi Manfred,
 
Though I use tectia 6.0.12.50, the software is customized in our environment so the "Password Authentication" part is completely removed. Why I wanted to automate because of some repetitive tasks of logging in various servers.
 
So, is it possible to store the keystore in a variable and then copy it to a clipboard and then paste when the prompts appear? But, I am not sure how to proceed with this idea.
 
Thanks for your help.
Dinesh
GeneralRe: passing argument from javascriptmvpManfred R. Bihy4 Jun '12 - 22:24 
dineshbabub wrote:
the software is customized in our environment so the "Password Authentication"
part is completely removed

You are talking about the profile file configuration tool I presume. If this is due to a company policy you'd better ask somebody if what you are trying to do is allowed by your company. Better be safe than sorry!
 
Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925


QuestionFormatting Numbers to Local SettingsmemberNagy Vilmos31 May '12 - 1:33 
I know in JavaScript I can display a date in the local format using toLocaleString(), is there an easy way to do this for a number?


Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

AnswerRe: Formatting Numbers to Local SettingsmvpManfred R. Bihy31 May '12 - 3:02 
The same function can be applied to numbers. See here: http://www.tutorialspoint.com/javascript/javascript_builtin_functions.htm[^].
Here an example:
<html>
    <body>
        Test number formatting with locale.
    </body>
    <script type="text/javascript">
        var num = 100234.56789;
        alert(num.toLocaleString());
    </script>
</html>
 
In my browser with german settings the number is rendered as 100.234,56789, which is exactly the expected behaviour.
 
Regards,
 
Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925

 
"Der Berg ruft!"
Me, 2012-05-24


GeneralRe: Formatting Numbers to Local SettingsmemberNagy Vilmos31 May '12 - 4:06 
Thanks, I just could not find it; brain fart on my part.


Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

GeneralRe: Formatting Numbers to Local SettingsmvpManfred R. Bihy31 May '12 - 4:19 
Sh*t Farts happen from time to time! Laugh | :laugh:
 
Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925


QuestionExtJSmemberRameshChTulal29 May '12 - 1:28 
I am new to ExtJS.I tried in Sencha and got some Code but its Confuse to Implement the code.I want to do the code in Visual Studio-2010.and i don't know how to do this.Please explain how to start my ExtJS examples in visual studion-2010.Please explain step by step.
 
Thanks a lot in advance..
AnswerRe: ExtJSmvpthatraja4 Jun '12 - 17:18 
Google?
Ext JS 4.0 Samples[^]
Saki's Ext Examples Page[^]

QuestionUpdate DIV text by Javascriptmemberiucaa27 May '12 - 10:06 
Hi
I have a problem: I have a div inside HTML page then I open/update with to javascript functions: it works fine until I put code inside another div, function open window div but is not the one I want, is just empty.
The following code work fine alone (I repet out of another div)
 
<input type="button" name="v2" id="v2" value="S1" önClick="javascript:showdivrecord(this)">
 
<!---- div window ----------->

<img src="immage/logos/flash.gif" alt="" width="94" height="95" id="picdiv"/>
Lorem ipsum

 
scrip to open div like window (work fine it's based on exterlan library)
 
function showdivrecord(ais)
{
return hs.htmlExpand(ais);
}
</script>
 
Once I show div (with function showdivrecord(ais)) - I fill div
<script>
function filldivrecord(idrow)
{
var divtxtElement = document.getElementById(idrow).value;
var mySplitResult = divtxtElement.split("|");
document.getElementById("divtxt").innerHTML = divtxtElement;
document.getElementById('picdiv').src= document.getElementById('pic'+idrow).value;
document.getElementById("divtxt").innerHTML = "
0) " + mySplitResult[0] + "
1) " + mySplitResult[1];
}
</script>
 
Sorry I am novice of javascript, by the way I think problem is parameter "this": what have to write to point other right DIV?? (
I guess).
 
Thank you in advance
AnswerRe: Update DIV text by JavascriptmvpSandeep Mewara27 May '12 - 19:58 
Your question/code-snippet is incomplete.
 
I don't see another div, show-div detail, etc. Though you mention 'based on external library', what does hs.htmlExpand(ais) work like? When and where you call filldivrecords? It's all connected to troubleshoot and find the culprit.
 
Did you DEBUG and see? Put keyword 'debugger;' at the start of method showdivrecords(before return statement), enable Javascript debugging in your browser and then step through using F11 to see the execution.

GeneralRe: Update DIV text by Javascriptmemberiucaa29 May '12 - 10:20 
Hi Mewara thank you for you reply i post full html page (I just removed php), the library
 
<script type="text/javascript" src="js/Photoview/highslide/highslide-with-html.js"></script>
<link rel="stylesheet" type="text/css" href="js/Photoview/highslide/highslide.css" />
<script type="text/javascript">
hs.graphicsDir = 'js/Photoview/highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header';
</script>
 

I use this function showdivrecord(ais) to have popup effect, I hope this can help you, sorry I am not a good programmer on javascript, ciao Smile | :)
 

 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
 
<META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico" />
<title>ELENCO CASTING - ISCRITTI |</title>
<link rel="stylesheet" type="text/css" href="js/media/css/demo_page.css">
<link rel="stylesheet" type="text/css" href="js/media/css/demo_table.css">
<script type="text/javascript" language="javascript" src="js/media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="js/media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#example').dataTable();
} );
</script>
 
<!----- scrip per div flottante ----->
<script type="text/javascript" src="js/Photoview/highslide/highslide-with-html.js"></script>
<link rel="stylesheet" type="text/css" href="js/Photoview/highslide/highslide.css" />
<script type="text/javascript">
hs.graphicsDir = 'js/Photoview/highslide/graphics/';
hs.outlineType = 'rounded-white';
hs.wrapperClassName = 'draggable-header';
</script>
<!----- END per div flottante ----->
 
</head>
<body id="dt_example" onLoad="myonload();">
<form name="form1" method="post" action="">














 










  Cognome e Nome Localita' Provincia Ruolo Telefono Email
<input type="checkbox" name="removeid" value="" id="removeid" = 10 ? 'disabled' : '';?> >
             




 
  
<input name="elimina" type="button" class="cella_form" id="elimina" value="Elimina" onClick="javascript:delthis(this);"><input name="aggiungi" type="button" class="cella_form" id="aggiungi" value="Aggiungi" onClick="javascript:nuovoiscritto();"><input name="reset" type="button" class="cella_form" id="slideshow" value="slideshow" onClick="javascript:showpic();"><input name="azzera" type="reset" class="cella_form" id="reset" value="Azzera" onClick="javascript:azzeraform();"><input name="browse" type="button" class="cella_form" id="browse" value="Agenda Casting" onClick="javascript:window.location='browse_casting_agenda.php';">
<input type="button" name="v1" id="v1" value="S1" onClick="javascript:showdivrecord(this)">
 
<!---- finestra div visualizzazione DIV ----------->
 

Titolo

<img src="immagini/logos/flash.gif" alt="" width="94" height="95" id="picdiv"/>
Lorem ipsum

 
<!---- scrip per funzionamento div ----->
<script>
 
function showdivrecord(ais)
{
return hs.htmlExpand(ais);
}
</script>
 
<script>
function filldivrecord(idrow)
{
var divtxtElement = document.getElementById(idrow).value;
var mySplitResult = divtxtElement.split("|"); // parte da 0
document.getElementById("divtxt").innerHTML = divtxtElement;
document.getElementById('picdiv').src= document.getElementById('pic'+idrow).value;
document.getElementById("divtxt").innerHTML = "
0) " + mySplitResult[0] + "
1) " + mySplitResult[1];
//return hs.htmlExpand(ais);
}
</script>
<!---- scrip per funzionamento div FINE ----->
<!---- finestra div visualizzazione FINE ----------->
 

</form>
</body>
 

</html>
Questionimplement double click event on Div child elementsmemberSteve Holdorf27 May '12 - 2:18 
I am trying to implement the double click event on a child element of an autocomplete text box. I can assign the ondblclick to the div but when I double click the innerHTML shows all of the child elements and not the one I double clicked on. See the code below:
 
var aStr2 = new Array("computer - Plain IA", "computer - Plain JSOC", "communication - Plain IA", "condor - Plain IA");

function AutoComplete(oText) {
// initialize member variables
this.oText = oText; // the text box
this.oDiv = document.getElementById("acdiv"); // oDiv; // a hidden
for the popup auto-complete
this.nMaxSize = 30;
this.aStr = new Array(5);
this.aStrx = new Array(5);
this.aStr3 = aStr2;
 

// preprocess the texts for fast access
var i, n = this.oText.value.length;
 
for (i = 0; i < aStr2.length; i++) {
this.aStrx[i] = aStr2[i];
}
 
this.nCount = this.oText.value.length;
 
// if a suitable number then show the popup-div
if ((this.nMaxSize == -1) || ((this.nCount < this.nMaxSize) && (this.nCount > 0))) {
// clear the popup div.
while (this.oDiv.hasChildNodes())
this.oDiv.removeChild(this.oDiv.firstChild);
 
// get all the matching strings from the AutoCompleteDB
for (i = 0; this.aStr3[i] != null; i++) {
if (this.aStr3[i].indexOf(this.oText.value) == -1) {
delete this.aStrx[i];
}
}
// add each string to the popup-div
var i, n = aStrx.length;
for (i = 0; i < n; i++) {
var oDiv2 = document.createElement('div');
//debugger;
oDiv.appendChild(oDiv2);
if (aStrx[i] != null) {
oDiv2.innerHTML = aStrx[i];
}
oDiv2.onmousedown = AutoComplete.prototype.onDivMouseDown;
oDiv2.onmouseover = AutoComplete.prototype.onDivMouseOver;
oDiv2.onmouseout = AutoComplete.prototype.onDivMouseOut;
this.oDiv = oDiv2;
this.oDiv.style.visibility = "visible";
this.oDiv.style.color = "Black";
this.oDiv.style.background = "Yellow";
}
}
else // hide the popup-div
{
this.oDiv.innerHTML = "";
this.oDiv.style.visibility = "hidden";
}
}
 

AutoComplete.prototype. önblur = function () {
this.oDiv.style.visibility = "hidden";
}
 
function dblclick() {
// debugger
alert("hello");
}
AnswerRe: implement double click event on Div child elementsmemberSteve Holdorf28 May '12 - 7:14 
Got it working. Just made the following class var global:
 
var first = true;
 
var aStrx = new Array(5);
 
var oDiv;
 
var indextext = 0;
 
Then added the event to each childelement:
 
var oDiv2 = document.createElement('div');
//debugger;
oDiv2.id = i;
oDiv2.setAttribute('ondblclick', 'dblclick("' + oDiv2.id + '")');
 
Finally, added the functions:
 
function dblclick(id) {
 
if (first == true) {
populateTxt(aStrx[id]);
first = false;
}
 
indextext++
if (indextext >= aStrx.length - 1) {
indextext = 0;
first = true;
}
}
 
function populateTxt(selectedtext) {
document.getElementById("txtSearch2").value = selectedtext;
indextext = 0;
oDiv = document.getElementById("acdiv");
oDiv.innerHTML = "";
oDiv.style.visibility = "hidden";
}
QuestionJava Script moveing a picture around the screenmemberBoaz Yaari26 May '12 - 5:00 
Hello,
I'm trying to move a picture around my screen randomly.
 
Here is my code:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript: Moving an Image</title>
<script type="text/javascript">
var i = 0;
 
function Init()
{
    var elem = document.getElementById("ss");
    var move = parseInt(elem.style.marginTop+10);
        elem.setAttribute("style", "marginTop:" + move.toString() + "px");
        elem.setAttribute("style", "marginLeft:" + move.toString() + "px");
        elem.setAttribute("style", "marginBottom:" + move.toString() + "px");
        elem.setAttribute("style", "marginRight:" + move.toString() + "px");
        setInterval("Init()",1000);
 

 

}
function  backToCenter()
{
    var elem = document.getElementById("ss");
    elem.style.marginTop="200px";
    elem.style.marginRight="200px";
    elem.style.marginBottom="200px";
    elem.style.marginLeft="400px";
}
 
</script>
 

<style>
#box
{
   width: 500px;
   height: 300px;
   position: relative;
   margin: 20px auto 0px auto;
   border: 5px outset #000;
   overflow: hidden;
}
 
.image
{
   position: absolute;
   z-index: 100;
}
</style>
</head>
 
<body onload="Init()">
<div  id="ss"style="height: 200px; width: 500px;"><img class="image" id="img1" src="beer-logo.jpg" height="50px" width="50px"/></div>
</body>
</html>
 
but the picture doesnt move, i cant figure out how to do this.
 
any help would be more than thankfull.
 

cheers.
AnswerRe: Java Script moveing a picture around the screenmemberAli Al Omairi(Abu AlHassan)26 May '12 - 20:57 
Sir;
I think it's because of the lines (below) are overwriting each other.
elem.setAttribute("style", "marginTop:" + move.toString() + "px");
elem.setAttribute("style", "marginLeft:" + move.toString() + "px");
elem.setAttribute("style", "marginBottom:" + move.toString() + "px");
elem.setAttribute("style", "marginRight:" + move.toString() + "px");
 
Also, the value of the attribute style should be margin-top: npx not marginTop: nxp (we remove the '-' character from the javascript identifier marginTop).
Sir, lets begin with moving the picture down at speed of 10px/sec.
 
elem.style.marginTop = move.toString() + "px"; 
then you change the direction when the picture reaches the edge of the screen.
Help people,so poeple can help you.

GeneralRe: Java Script moveing a picture around the screenmemberBoaz Yaari27 May '12 - 10:43 
Thanks for the help.
 
my problem is that i need to keep it moveing all the time, with your code the picture stays in the smae place.
 
My problem is in this area:
 
var x = parseInt(elem.style.marginTop);
x=x+10;
elem.style.marginTop = x+"px";
 
the compiler has an issue with this line:
elem.style.marginTop = x+"px";
 

I changed the code abit (lost the setAttribute and replaced it with what you gave me)
 

Hope you can help me out.
GeneralRe: Java Script moveing a picture around the screenmemberBobJanova28 May '12 - 23:34 
What error do you get? That looks correct.
GeneralRe: Java Script moveing a picture around the screenmemberBoaz Yaari27 May '12 - 11:22 
Let me exaplain what I want maybe it will give you a better idea of how to help me:
 
I need my picture to randomly move around the screen that why i give a random amount to each diarection, i'v been trying to thing of an algorithm to solve this, I have the algorithm but the syntax is just not matching up.
 
i found the element.style.margin(and direction here) = something will move the object, but i need the object to move in a certin step so the movement will look smooth.
 
any help would be more than thankfull.
 
Kind reggards
GeneralRe: Java Script moveing a picture around the screenmemberAli Al Omairi(Abu AlHassan)28 May '12 - 0:38 
Sir;
  1. about you first comment what exception does the browser throw in the console?
  2. about the smoothing, you should make the steps faster and smaller for example 10px/sec can be 1px/100 millisecond (you change the time interval in setInterval() to 100 and the 10px in move() to 1px.
  3. about moving in certain steps, you can use an array than contains information about both speed and direction or the endpoints.
Help people,so poeple can help you.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 22 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid