JavaScript - Handle Variable With Space Wscript.shell
Dear friends,
My Function code is: [code] <script language="javascript" type="text/javascript"> //function to create the printer and take variable from button pressed by user function RunEXE(prn) { var oShell = new ActiveXObject("WScript.Shell"); oShell.Run ("%comspec% /k c:\windows\system32\rundll32 PRINTUI.DLL,PrintUIEntry /in /n "+prn+"",2,true); } </script> the variable is passed properly to the function with spaces using below form button. But, the command in the function doesnot execute after the space, that is printer name is taken as "5E-" only. How do i pass prn variable with additional double quotes, so that command in function takes it in full including spaces. thanks so much. [code] <input name="button2132" type="button" id="button213" onClick="RunEXE('\\\\printsrv.test.com\\5E- KMC451-SS AC')" value="Install" /> Similar TutorialsI need to run an executable file located on server from client using WScript.shell Activexobject. How Can I do that? var shell = new ActiveXObject("WScript.shell"); var oExec = shell.Exec('file:///C:/TZTwain/TZTwain.exe'); The above code throws 'the file specified not found' exception. How can you tell what shell you are running on UNIX system?
Hello people, I got a problem. This is the code for hiding en showing informatie in an acordion. It looks fine and it works! But it only handles one div! The main thing i want is that when i click on the text "button" the next div, with all the span's within it, has to slide under. Example: HTML: 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>Accordion 1</title> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".accordion h3:first").addClass("active"); $(".accordion div:not(:first)").hide(); $(".accordion div").hide(); $(".accordion p").hide(); $(".accordion h3").click(function(){ $(this).next("div").slideToggle("slow").siblings("div:visible").slideUp("slow"); $(this).toggleClass("active"); $(this).siblings("h3").removeClass("active"); $(".accordion p").show(); $(".accordion .button").show(); }); }); </script> <link rel="stylesheet" href="css/style.css" type="text/css"/> </head> <body> <div class="accordion"> <h3>Title</h3> <div class="test"> <p>subtext</p> <div class="button"> <a href="" title="">Button</a> </div> </div> <div> <span style="display:block; height: 20px; width: 220px; margin-top: 10px; margin-left: -5px;"><input type="radio" checked="checked" value="" name="" id="" /><label for="">test</label></span> <span style="display:block; height: 20px; width: 220px; margin-top: 0px; margin-left: -5px; margin-bottom: 20px;"><input type="radio" value="" name="" id="" /><label for="">test</label></span> <span style="font-weight:bold;">Vanaf<input type="text" style="width: 20px; height: 15px;" class="" value="1" readonly=""></input>-<input type="text" style="width: 20px; height: 15px;" class="" value="" readonly=""></input>-<input type="text" style="width: 40px; height: 15px;" class="" value="1" readonly=""></input> change to <input type="text" style="width: 20px; height: 10px;" class="" value="" readonly=""></input>%</span> <span style="display:block; text-align: right; text-decoration:underline; font-weight:bold; color: red;">count</span> </div> </div> </body> </html> CSS: Code: body { margin: 10px auto; width: 570px; font: 75%/120% Arial, Helvetica, sans-serif; } .accordion { width: 480px; border-bottom: solid 1px #c4c4c4; } .accordion h3 { background: #004584; padding: 7px 15px; margin: 0; font: bold 120%/100% Arial, Helvetica, sans-serif; border: solid 1px #c4c4c4; border-bottom: none; cursor: pointer; color: #FFFFFF; } .accordion h3:hover { background-color: #00AEE7; } .accordion h3.active { background-position: right 5px; } .accordion .test { background: #DFF7FF; margin: 0; padding: 10px 15px 20px; border-left: solid 1px #c4c4c4; border-right: solid 1px #c4c4c4; } .accordion .extra { background: #DFF7FF; margin: 0; padding: 10px 15px 20px; border-left: solid 1px #c4c4c4; border-right: solid 1px #c4c4c4; } I need to interact with application in a way that is being used by mouse and some keyboard clicking like save a text file to a desired location with a desired name by the java script file. Can you give me some information how to do that, and where to get information for that?
Hi , I am very new to HTML,CSS,Javascript coding. I have to add some check box in the page and there are multiple tabs in the same single page. If I select or deselect any check box, checkbox checks from all the places should be changed. Can anybody tell me how to do so using HTML,CSS, Javascript? I'm not sure what this is called to google it, ok so i have 3 divs Code: <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> Now say my page is 800x600 So when the page loads #div1 and #div3 height = 390px and #div2 height = 20px; What i want is when #div2 is draged it resized #div1 and #div3 E.G (#div2 is draged up so top = -100px) so when that happens i want #div1 = 290px and #div3 = 490px And vice versa now this is the code i have for my site So #div1 = ".torrents-list" #div2 = "#dragBar" #div3 = "#torrent_info" PHP Code: $("#dragBar").draggable({ axis: 'y', drag: function(event, ui){ var heightString= $("#dragBar").css("top"); var height = parseInt(heightString.replace("px", "")); $("#dragBar").css("top", "0px"); $(".torrent-list").height($(".torrent-list").height() + heightString); $("#torrent_info").height($("#torrent_info").height() - heightString); } }); But this dose not work for me its never setting #dragBar top to 0px and not resizing any thing if some one can tell me what this is called so i can google for a prebuilt one if not help me write one please? Hello all, I have a requirement where i need to take an IPv4 address as an input, my web page has 4 text boxes. If i have a address like this 255.255.255.255, my program jumps into the next text box without any problem as soon as i enter the 3 digits. i dont need to press any tab or any other key to go to next text box. In case of an address like 12.24.12.3, i have to press <tab> to jump into the next text box, My project requirement says that it should work with '.' (dot) char as well. SO here is my actual requirement i need to jump into the next text box as soon as user enters a dot (.) char without displaying the dot into the text box. I am writing this program in perl CGI. Thanks, Vaibhav I currently am using a mootools popup on www.Hope1st.com to play his music videos.....and its working really well...only thing is on some computers (mac with firefox browser) when someone pauses the video ...the draggable box gets stuck on their mouse weird right? yea i know... so i thought of a solution...instead of the whole box being draggable why not just the black titlebar be draggable? i have absolutely no idea on how to do this....but i do have the entire JS code....are you ready? its a mouthful....a million thanks to whoever is talented enough to help me Code: var mooSimpleBox = new Class({ options: { width: 300, height: 200, opacity: '0.8', btnTitle: "Ok", closeBtn: null, boxTitle: "messageBox", boxClass: 'mainBox', id: 'myID', fadeSpeed: 500, box: null, addContentID:null, addContent: null, boxTxtColor: '#000', isVisible: false, isDrag: true }, initialize: function(options){ this.isVisible = false; if(options['isDrag']) this.isDrag = options['isDrag']; if(options['width']) this.width = options['width']; if(options['height']) this.height = options['height']; if(options['opacity']) this.opacity = options['opacity']; if(options['btnTitle']) this.btnTitle = options['btnTitle']; if(options['boxTitle']) this.boxTitle = options['boxTitle']; if(options['boxClass']) this.boxClass = options['boxClass']; if(options['boxTxtColor']) this.boxTxtColor = options['boxTxtColor']; if(options['fadeSpeed']) this.fadeSpeed = options['fadeSpeed']; if(options['id']) this.id = options['id']; if(options['closeBtn']) this.closeBtn = $(options['closeBtn']); if(options['addContentID']) this.addContentID = options['addContentID']; if(options['addContentID']) { this.addContent = $(this.addContentID).innerHTML; $(this.addContentID).setStyle('visibility','hidden'); $(this.addContentID).remove(); } this.createBox(); }, createBox: function(){ this.box = new Element('div'); this.box.addClass(this.boxClass); }, clickClose: function(){ $(this.box).effect('opacity',{ wait:true, duration:this.fadeSpeed, transition:Fx.Transitions.linear }).chain(function(){ }).start(this.opacity,0); this.box.setStyle('display','none'); this.isVisible = false; }, fadeOut: function(){ if(this.isVisible){ $(this.box).effect('opacity',{ wait:true, duration:this.fadeSpeed, transition:Fx.Transitions.linear }).chain(function(){ }).start(this.opacity,0); this.isVisible = false; } }, fadeIn: function(){ if (document.documentElement && document.documentElement.clientWidth) { theWidth=document.documentElement.clientWidth; }else if (document.body) { theWidth=document.body.clientWidth; } if (window.innerHeight) { theHeight=window.innerHeight; }else if (document.documentElement && document.documentElement.clientHeight) { theHeight=document.documentElement.clientHeight; }else if (document.body) { theHeight=document.body.clientHeight; } var top = window.getScrollTop(); var boxTop = (theHeight - this.height) / 2 ; boxTop = (boxTop + top); var boxLeft = (theWidth - this.width) / 2; this.box.setStyle('top',boxTop); this.box.setStyle('left',boxLeft); this.box.setStyle('position','absolute'); this.box.setStyle('width',this.width); this.box.setStyle('height',this.height); this.box.setStyle('opacity',this.opacity); this.box.setStyle('cursor','move'); this.box.setStyle('z-index','999990000'); this.box.setAttribute('id', this.id); this.box.setStyle('visibility','hidden'); this.box.injectInside(document.body); if(this.isVisible == false){ this.box.effect('opacity',{ wait:true, duration: this.fadeSpeed, transition: Fx.Transitions.linear }).start(0,this.opacity); this.addHT(); this.isVisible = true; } }, addHT: function(){ this.closeBtn = new Element('button', { styles: { 'border': 'none', 'background-image':'url(modules/mod_moopopup/moopopup/images/bg_button.gif)', 'color':'#fff', 'position':'absolute', 'bottom':'3px', 'right':'3px', 'width':'44px', 'height':'19px', 'font-size':'13px', 'font-weight':'bold', 'font-family':'arial', 'cursor':'pointer' } }) var width = this.width.toInt() + 5; if(window.ie){ var titleBar = new Element('div', { styles: { 'width' : width, 'height': 'auto', 'background-repeat': 'repeat-x', 'background-position': 'right top', 'line-height': '20px', 'padding': '5px 5px 5px 10px', 'position': 'absolute', 'clear': 'both', 'margin-bottom': '10px', 'top': '0px', 'left': '0px', 'color': '#eee' } }) }else{ var titleBar = new Element('div', { styles: { 'width' : width, 'height': 'auto', 'background-repeat': 'repeat-x', 'background-position': 'right top', 'line-height': 'auto', 'padding': '5px 5px 5px 10px', 'position': 'absolute', 'clear': 'both', 'margin-bottom': '10px', 'top': '0px', 'left': '0px', 'color': '#eee' } }) } $(titleBar).innerHTML = this.boxTitle; var insideDiv = new Element('div',{ styles: { 'padding':'10px' } }); insideDiv.setAttribute('id','myContent'); this.box.innerHTML = ""; insideDiv.injectInside(this.box); insideDiv.innerHTML = this.addContent; this.closeBtn.innerHTML = this.btnTitle; $(this.closeBtn).addEvent('click',this.clickClose.bindWithEvent(this)); titleBar.injectInside(this.box); this.closeBtn.injectInside(this.box); if(this.isDrag == 'true'){ this.box.makeDraggable(); } } }); mooSimpleBox.implement(new Options, new Events); Hi I am generating a report on submit click.Due to size of data query execution takes some time to display result, in mean time if user press reload button on browser toolbar consequently same query request going to database and the performance become slow down. I am able to restrict user from clicking F5 and ctrl+R button but not reload button. I there any way to handle event on reload button? or can we disable reload button on submit? Thanks in advance! Hi to all, I have a dynamic form, when a button is clicked 3 more fields appear, the function is to colect for example from date [02/02/2010] to date [10/02/2010] equals price [250$] per week and if you want another period just click the button and 3 more fields appear. How do I get all this data to PHP? Code: <script type="text/javascript"> var counter = 3; function addNew() { // Get the main Div in which all the other divs will be added var mainContainer = document.getElementById('mainContainer'); // Create a new div for holding text and button input elements var newDiv = document.createElement('div'); // Create a new text input var newText = document.createElement('input'); newText.type = "text"; newText.value = "DD/MM/AAAA"; newText.name = counter++; var newText1 = document.createElement('input'); newText1.type = "text"; newText1.value = "DD/MM/AAAA"; newText1.name = counter++; var newText2 = document.createElement('input'); newText2.type = "text"; newText2.value = "0"; newText2.name = counter++; // Create a new button input var newDelButton = document.createElement('input'); newDelButton.type = "button"; newDelButton.value = "Delete"; // Append new text input to the newDiv newDiv.appendChild(newText); newDiv.appendChild(newText1); newDiv.appendChild(newText2); // Append new button input to the newDiv newDiv.appendChild(newDelButton); // Append newDiv input to the mainContainer div mainContainer.appendChild(newDiv); counter++; // Add a handler to button for deleting the newDiv from the mainContainer newDelButton.onclick = function() { mainContainer.removeChild(newDiv); } } </script> <table style="margin-left:200px" border="0"> <tr><!-- Row 1 --> <td width="140"><b>Start Date</b></td><!-- Col 1 --> <td width="142"><b>End Date</b></td><!-- Col 2 --> <td width="140"><b>Price per week</b></td><!-- Col 3 --> </tr> </table> <div style="margin-left:200px" id="mainContainer"><div><input value="DD/MM/AAAA" name="0" type="text" ><input value="DD/MM/AAAA" name="1" type="text" ><input value="0" name="2" type="text" ><input type="button" value="New price" onClick="addNew()"></div> Hi, I have a programing problem that have been around for ages. I have search on google using several expressions and words and after hours of digging i'm still unable to do it. I would like to get a value from a HTML page hosted remotely with an inconstant value. Then define this value and name as a javascript variable and apply or show in my page. Thanks for all the help P.S. Is there any way to make a domain lookup in javascript? I mean a user enters a domain and the script converts to an ip and shows to the user. If not thanks, probably it can only be done in the server side... Hello I have a php page in which I declared a js variable... right at the top of the page... <script type="text/javascript"> var tester = 0; </script> Later in the page I test this variable... <script type="text/javascript"> if (tester==1){ do some stuff!! } </script> But I keep getting an error variable _tester undefined Am I missing something obvious... I am new to js... but this seems really straightforward I don't know how I should do ? Quote: <html> <head> <script type="text/javascript"> function add(a,b){ y=a+b return y } var aaa = add(one,two) //one needs to get somehow get the value of yil, in this case 10 var one = function reas(){i=10;if(i<10){yil = 15}; else{yil = 10; yil = one;}; var two = 20; document.write(y) </script> </head> </html> also why doesn't this work? Quote: <html> <head> <script type="text/javascript"> function adder(a,b){ var k=a+b; return k } var hes=adder(5,kol); kol=40; alert(hes); </script> </head> </html> you cannot have variables in callback functions? Hi! I have a javascript in the head of the document which has a variable named "ref2" ... ref2 is already working as I can see its value working in another function. I need to send this variable as the value of a hidden field in the form which is in the body of the document. This is my JavaScript Code: Code: function WriteContactFormStatement1 () { var ContactFormValue = ref2; document.write('<input type="hidden" name="UReferrersName" value="' + ContactFormValue + '" />'); } var WriteContactFormStatement = WriteContactFormStatement1 (); And at the end of my form, before the submit button, I have the following code: Code: <!-- START -- Javascript to print the statement for UReferrersName --> <script language="JavaScript" type="text/JavaScript"> //WriteContactFormStatement(); document.write (WriteContactFormStatement); </script> <!-- End -- Javascript to print the statement for UReferrersName --> When I execute the form, it doesn't work the way it should, plus, gives me a word "undefined" next to the "Submit" button ..... Please help !... - Xeirus. Hello I have a piece of javascrip that refreshes the page: ---------- Code: <script type="text/javascript"> <!-- Begin function reFresh() { location.reload(true) } /* Set the number below to the amount of delay, in milliseconds, you want between page reloads: 1 minute = 60000 milliseconds. 2 minutes = 120000 milliseconds 5 minutes = 300000 milliseconds*/ window.setInterval("reFresh()",20000); // End --> </script> -------- I am new to javascript and wanted to use an html options menu in order to be able to choose the refresh interval: Code: <SELECT NAME="refreshtime"> <OPTION VALUE="60000">1 min</option> <OPTION VALUE="120000">2 min</option> <OPTION VALUE="180000">3 min</option> <OPTION VALUE="240000">4 min</option> </SELECT> I know that I have to pass a variable to the function. I have tried several variations but none have worked. I have mostly received a "done with errors" warning. Any help would be appreciated. Thanks Zam If I manually write out "2/22/2012 4:00 PM" in TargetDate, I get the correct result for what I want to do (a countdown). But I want the countdown to always be the current day at 4pm. So I tried the code below thats commented, but it is not working. New to javascript, still reading the books, just hoping for some guidance on this. Code: Next Update: <script language="JavaScript"> var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() var year = currentTime.getFullYear() TargetDate = "2/22/2012 4:00 PM"; //TargetDate = "document.write(month + "/" + day + "/" + year) + 4:00PM"; BackColor = "white"; ForeColor = "red"; CountActive = true; CountStepper = -1; LeadingZero = true; DisplayFormat = "%%H%% H, %%M%% M, %%S%% S"; FinishMessage = "Forecasts posted"; </script> <script language="JavaScript" src="countdown.js"></script> Hello everybody I have a problem with Java Script damned I want to add the values of several variables in one variable and then use this variable, which contains the values of variables You can see the following example HTML Code PHP Code: <input type="text" name="txt1" /> <br/>age <input type="text" name="txt2" /> <br/><br/> <input type="button" name="submits" value="send"/> Javascript Code PHP Code: field = document.getElementsByName('txt1')[0]; field2 = document.getElementsByName('txt2')[0]; submit = document.getElementsByName('submits')[0]; data = 'data=' + field.value + '&data2=' + field2.value + '&submits=' + submit.value; document.getElementsByName('submits')[0].onclick = function(){ alert(data); } After executing this code I find that the variables are not displayed values As in the following picture I want to know what the cause of this problem ? This might be a stupid question, but is there any memory usage difference between var variable1, variable2; and var variable1; var variable2;? I'm learning how to use faster code hence the question.
I have a 3 textareas that when the user presses the spacebar I would like for the code to execute a TAB to move between them instead. My code works if I make the replacement keycode an number or letter but it wont work if I use TAB. The browser is IE. Thank you for any help you can give. <script type="text/javascript"> function keycode(e) { if(e.keyCode==32) {return (e.keyCode=9);} } </script> </head> <body> <form> <input name="DefectNumber" id="DefectNumber" type="text" onkeypress="return keycode(event);"> <input name="DefectNumber2" id="DefectNumber2" type="text" onkeypress="return keycode(event);"> <input name="DefectNumber3" id="DefectNumber3" type="text" onkeypress="return keycode(event);"> </form> </body> Hi All, Firstly, apologies if this is already posted somewhere on the site. I did do a search of the forum, but could only find solutions for things link Perl scripts etc. What I have is a file upload input (as part of a larger form) and I want to get some javascript that will replace spaces in a filename with another character, such as an underscore or dash. If possible, I would also like to be able to replace commas with an underscore or dash. Hope someone here can help or point me to the right place! Neil |