JavaScript - Reading Registry Value
I would like to modify an old script retrieve a registry key and sifting through the many forums put this together but not sure if this is correct?
Thanks Code: <html> <head> <script language="javascript"> <!-- var value; var Shell; var cicserver; Shell = new ActiveXObject("WScript.Shell"); value = Shell.RegRead("HKLM\\Software\\Interactive Intelligence\\EIC\\Notifier"); if value = "servername1" { cicserver = "servername1" } else { cicserver = "servername2" } Similar TutorialsI need to reset the active content registry entries to the defaults when a page unloads: Code: <script> // Window Onunload, last to execute, manage registry function windowonunload(){ var WshShell = WScript.CreateObject("WScript.Shell"); WshShell.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_LOCALMACHINE_LOCKDOWN\\iexplore.exe\\", 1, "REG_DWORD"); WshShell.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_LOCALMACHINE_LOCKDOWN\\Settings\\LOCALMACHINE_CD_UNLOCK\\", 0, "REG_DWORD"); } WScript.DisconnectObject(sh); WScript.Quit(); //--> </script> ...but it doesn't seem to work. What am I doing incorrectly? Thanks. need help.... I need to create a web page that can pull data from sensatronics senturion sensor probe. The unit has a web server that displays temperature, humidity,etc. You can also query it for from telnet or webpage which kicks back xml. My page needs to read the values of the probes. I don't know much about javascript and have been unsuccessful trying to use httprequest. I guess this would be considered cross domain as well? Here is the XML that is generated from the unit. I get this by pulling through a web browser x.x.x.x/xmldata Thanks <?xml version="1.0" encoding="ISO-8859-1"?> <Sensatronics id="S10604" hb="10554"> <Group id="1"> <Probe id="100"><Value>75.2</Value></Probe> </Group> <Group id="2"> </Group> <Group id="3"> </Group> <Group id="4"> </Group> <Group id="5"> </Group> <Group id="6"> </Group> <Group id="7"> </Group> <Group id="8"> </Group> <Group id="9"> <Probe id="99"><Value>1.0</Value></Probe> <Probe id="1"><Value>79.5</Value></Probe> <Probe id="2"><Value>34.3</Value></Probe> <Probe id="3"><Value>35.6</Value></Probe> <Probe id="4"><Value>0.0</Value></Probe> </Group> </Sensatronics> Hi all, I am having trouble trying to use the substring String method. Relevant HTML code: Code: <img id="news" src="../images/news.png" alt="News" onmouseover="change(this)" /> Relevant JavaScript code: Code: function change(element) { if (element.id == "news" && element.src.substring(3,5) != "../") { element.src = "../images/news.png"; alert(element.src.substring(3,5)); } else if (element.id == "news" && element.src.substring(3,5) == "../") { element.src = "../../images/news.png"; } } I want the image to change to another image, but depending on the src in the HTML code. This is so that it can locate the correct folder. However, it doesn't work, and I tried using an alert statement to show me what JavaScript is reading and it seems to read "e:", which is not correct. It never reads "../", which it should. I don't know how to solve this problem, any ideas? Hi, I am a newbie at XML and this issue is proving to be a tough nut to crack for me. My AJAX query returns me an XML response of the following structure for a query on "ind": <countries> <country> <name>India</name> <capital>New Delhi</capital> </country> <country> <name>Indonesia</name> <capital>Jakarta</capital> </country> </countries> How do I transform the XML response into a HTML layout? Particularly, how do I get down to the value at each node?How do I traverse the XML document using JS? Is this (using XML) better than JSON (other than the obvious platform-independence)? Which is better? Thanks! All, Say I have the following code: Code: <!DOCTYPE html> <html> <head> <style>img{ height: 100px; float: left; }</style> <script src="http://code.jquery.com/jquery-1.7rc2.js"></script> </head> <body> <div id="images"> </div> <script> $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?", { tags: "cat", tagmode: "any", format: "json" }, function(data) { $.each(data.items, function(i,item){ $("<img/>").attr("src", item.media.m).appendTo("#images"); if ( i == 3 ) return false; }); });</script> </body> </html> This came from the jQuery website. What I would like to do is change the link to something like this: https://graph.facebook.com/me/friend...ss_token=12345 The data that comes back is something like: Code: { "data": [ { "review_comment": "Here is a comment", "id": "12" }, { "review_comment": "Testing With more", "id": "34" }, { "review_comment": "Third comment", "id": "643" }, { "review_comment": "More Comments", "id": "120" }, { "review_comment": "Testing", "id": "3455" } ] } What I would like to do is basically read all of the review_comment tags and basically rotate these to display them on the webpage. So have "Here is a comment" be displayed for like 10 seconds and then fade out and have "Testing with More" fade in and be displayed for another 10 seconds etc. What is the best way to do this? I'm not sure how to change my JSON code above to acheive this. Would I need to basically put the comments in a div and then use jQuery to fade in the divs in and out? Any help you could provide would be greatly appreciated!! Hi there! I'm having a little bit of trouble, I've read through tutorials on parsing XML to Javascript and such, but the XML file I'm working with is very different to the ones the tutorial showed me. Normally it'd be like Code: <here> <there></there> </here> But the one I'm wanting to work in looks like this: Code: <rowset name="names" columns="name"> <row name="this"> <rowset name="fun" columns="name"> <row name="that"> </rowset> </row> </rowset> To make it more clear, my question to you is: How can I parse <row name="that"> where only we only have <row name="this"> I am trying to make a simple alert come up stating a checkbox is checked when it changes, and then another alert for when the checkbox is unchecked. Problem is, only the alert for when the box is checked is coming up. Anyone know why? Code: function displayCheckPopUp() { if(document.activeElement.checked=true) { alert("A check box has been selected"); } else if(document.activeElement.checked=false)<!--if(document.getElementById().checked=false)--> { alert("****"); } } Code: <input type="checkbox" name="Checkbox 1" value="Checkbox 1" id="first_cbox" onchange="displayCheckPopUp(this)" /> <p class="custom_style2"> Checkbox 1 </p> hi Guys , I have some instructions in property files , now I wat to retrive that fmt tag values in scriptlets So that I can modify the content in property file So i have written the code in jsp as <c:set var="mailBodyData" value='<fmt:message key="confirmemail.body.message"/>' scope="request"/> <% out.println("hero "+request.getAttribute("mailBodyData")); %> but its displays empty , Also I have tried as <% String str ="<fmt:message key="confirmemail.body.message"/>' %> but its throughs the Compilation error , Pls help , So that I can retrive the data from fmt to Scriptlets Hi All, Im trying to write a html with javascript page that reads values from an XML file and outputs to a table. Thats easy i hear you say? Trouble is the application that is outputing the XML file doesnt output a simple XML file. Below is a section of the file: Code: <?xml version="1.0" encoding="UTF-8"?> <CVES name="EUREX" datetime="09 Aug 10 14:40:41"> <thread name="DB 0" state ="active" nb="0" tempo="00:00:02" action="Wait"/> <thread name="DB 1" state ="active" nb="0" tempo="00:00:02" action="Wait"/> <thread name="match" state ="active" nb="0" tempo="00:00:02" action="Wait"/> <MatchingList> <Tickets value="142"/> <TicketsCleared value="23"/> <TicketsNotCleared value="119"/> <Orders value="21"/> <OrdersCleared value="21"/> <OrdersNotCleared value="0"/> </MatchingList> <thread name="exch 1" state ="active" nb="0" tempo="00:00:10" action="Wait"/> <Exchange> <Tickets value="142"/> <TicketsWithUnknownExternalCodes value="212"/> <ClearingInProgress value="4"/> <Clearing> <AverageClearingTime value="00:00:00"/> <LastClearingTime value="14:26:37"/> <LastUnclearingTime value="14:27:55"/> <TotalQtyCleared value="705"/> <TotalQtyUnCleared value=""/> </Clearing> <Reading> <LastReadingTime value="14:40:31"/> <NextReadingTime value="14:41:00"/> im able to read the contents of the CVES tag (Name and datetime) but cannot get any others to load. how can i get details from LastReadingTime? Thread name="Exch 1" Having googled reading XML into HTML file and cannot find anything that covers this kind of xml file THanks I am having an issue reading from a div that is being changed. The div in question was initially empty. A function that was called upon the selection of something in the drop down list creates another drop down list within that div (sets the inner html). Now, I have another function that needs to read from this new drop down list. However, when I use alert(document.getelementbyid('divid').innerhtml) in the function it returns undefined. The drop down list is created successfully and populated by the relevant data. The method of creation was calling another php file that created the list after querying a database. Any ideas? I can post the code if it will help.
Dear frnd I wanna read on html page , and i have script : " [I]<html> <head> <script type="text/javascript" language="javascript"> function Read() { var Scr = new ActiveXObject("Scripting.FileSystemObject"); var CTF = Scr .OpenTextFile("C:\\123.txt", 1, true); data = CTF .ReadAll(); document.write("<pre>" + data + "</pre>"); CTF .Close(); } </script> </head> <body onLoad="Read()" > </body> </html> [I] " But as its using activex control not allowing in all browser . Have you any other way with pure js to read the file contains ? or allowing activex in all browser ? i am thinking of using a xml file as a data base for example , the xml file stores a list of reference numbers which is allocated to a url or a name such as 0123456789 and i have a text box on a webpage and the user types in a reference number and the javascripts reads the xml file to check if its a valid reference number i.e a registered number i am new to working with xml etc... so would be nice to have a little help here EXAMPLE <DATA> <REF> <0123456789>JOE</01234567890> <1111111111>www.google.com</1111111111> </REF> </DATA> id like it to read the specific data thats contained within the tag such as 0123456789's tag = JOE hi, (JAVASCRIT) the actual program reads and prints values from a checkbox tree and this piece of code does it. Code: dhtmlXTreeObject.prototype.getAllChecked=function(){ return this._getAllChecked("","",1); } dhtmlXTreeObject.prototype.getAllCheckedBranches=function(){ return this._getAllChecked("","",0); } dhtmlXTreeObject.prototype._getAllChecked=function(htmlNode,list,mode){ if(!htmlNode)htmlNode=this.htmlNode; if(((mode)&&(htmlNode.checkstate==1))||((!mode)&&(htmlNode.checkstate>0))){if(list)list+=","+htmlNode.id;else list=htmlNode.id;} var j=htmlNode.childsCount; for(var i=0;i<j;i++) { list=this._getAllChecked(htmlNode.childNodes[i],list,mode); }; if(list)return list;else return ""; }; the values are returned to alertbox. Code: <a href="javascript:void(0);" onclick="alert(tree2.getAllChecked());">Get list of checked</a><br><br> kindly help me with reading the returned values in to an array or list (but bot in alertbox) ...so that i can pass them to next JSP page. waiting for ur answer, BeanBoy ! Hi, ive just been debugging my script in IE, and came across this: Code: OrbitTool.prototype.handleMouseUp = function(e) { if (e.button == g_o3d.Event.BUTTON_LEFT) { this.mouseLeftDown = false; } else if (e.button == g_o3d.Event.BUTTON_MIDDLE) { this.mouseMiddleDown = false; } }; its giving me an error on the second line, the error reads ('button' is null or not an object). does anyone know why this might be? im not a pro with javascript so my knowledge only stretches so far. Simon Reply With Quote Hi I'm reading a text file, manipulating the string that I've read, and then writing to a new text file called temp. The error that I am getting is basically reading past the end of the file. function SpaceFileEntries() { fso = new ActiveXObject("Scripting.FileSystemObject"); filename = "NDELPROF.txt"; path1 = document.getElementById("lblDataOutputDirectory").innerText + "\\" + filename; path2 = document.getElementById("lblDataOutputDirectory").innerText + "\\temp.txt"; s = fso.OpenTextFile(path1); j = fso.CreateTextFile(path2 , true); do { text = s.readLine(); partOne = text.substring(0,34); lastPart = text.substring(35, 54); space = " "; j.write(partOne); j.write(space); j.writeline(lastPart); } while ( text != null ) s.Close(); j.Close(); } Can someone please help me find this bug in the code. I know it's got to do with the while statement, but can't think or find good alternatives. Thanks. Daniel Here I am again. In Internet Explorer 7, running on Windows Vista I am testing a project. I get an error message when the page loads to the effect: line 31 char 29 error: object does not support this property or method code 0 This is a one page site and this message comes up on every page load. So I have a good idea what it is complaining about. But in I.E., how do I determine 'line 29'? Where does it start counting, and what type of lines would it skip? I.E. loads source into notepad and notepad does not number the lines. Further, the lines in the source are formatted unix style ("\n" line feed endings instead of line feed/carriage return: as in Windows). Long lines are wrapped, so it is unclear where one line ends and the next starts. Are there any good web dev tools for I.E.(preferreably open source)? Thank you; JK Hi all, How can i read CSV data from the text file using Java Script.Please give me the script for the problem. Thanx, Nari Novice Javasript query. My requirement: Each time a visitor arrives at a specific webpage i want the main image on the page to be different, or more specifically, one of 6 images which will be shown in rotation. Solution: Set a cookie. Each time the visitor access the page read the cookie and display the corresponding image. Then increment the value and rewrite the cookie, so that next time they'll see the next image in sequence. NB: if the cookie does not exist (first timer) or is at 6, then the value is set to zero (and then incremented). Problem: Can't get my coding to work. Specifically it just doesn't do anything - no error message, no cookie written. I'm a very novice scripter, as in I've cobbled the coding together from bits off the net that i think i've managed to grasp some kind of an understanding of. Very suck it and see - so far lots of sucking and no seeing! Anyway here's my code - if someone could cast a beady eye it would be much appreciated. Hopefully I'm not a million miles out !!! Code: <script type="text/javascript"> /*<![CDATA[*/ var cookies = document.cookie; if (cookies.indexOf(pookie) == -1) { var pookey = 0; } else { var startpos = cookies.indexOf(name)+name.length+1; var endpos = cookies.indexOf(";",startpos)-1; if (endpos == -2) endpos = cookies.length; var pookey = cookies.substring(startpos,endpos); if (pookey == 6) pookey = 0; } pookey = pookey++; var expire = new Date (); expire.setTime(expire.getTime() + 1000 * 60 * 60 * 24 * 365); document.cookie = name + "=" + pookie + "; expires=" + expires.toGMTString() + "; path=/"; if (pookey == 1) document.write ("<img src=\"../HomePage/Image1.jpg\" />"); if (pookey == 2) document.write ("<img src=\"../HomePage/Image2.jpg\" />"); if (pookey == 3) document.write ("<img src=\"../HomePage/Image3.jpg\" />"); if (pookey == 4) document.write ("<img src=\"../HomePage/Image4.jpg\" />"); if (pookey == 5) document.write ("<img src=\"../HomePage/Image5.jpg\" />"); if (pookey == 6) document.write ("<img src=\"../HomePage/Image6.jpg\" />"); /*]]>*/ </script> Thanks in advance for any help... I'm sorry I'm not to good at javascript. I know VB.net, but I have not learned javascript yet, and I need some help. I am working on a project to get a survey to pop up for new visitors on the index page of our site. What I need to do: on load look for a cookie, if that cookie is not found run a script telling the site to pull up another page in lightview using its own "on load" command. If the cookie is there the site will not open this other page. What I've done: I already found a way to do most of this, but I can only use a hyper link as a trigger for the site to load the other page in lightview. Here is a link of what I have so far: http://naomi-dr.com/template2.html Please let me know if you have any questions or need more information. Somebody had posted this query on how to read text files using JavaScript.......can't find that post now... Anyways, though it's not possible to read text-files using JavaScript it is possible to read XML files using it. Here is an XML based JavaScript Ticker http://www.dynamicdrive.com/dynamicindex2/xmlticker.htm It works only on browsers supporting XML (IE) Enjoy! |