JavaScript - Xml: How Do I Get It An Xml To Display Contents In Html Page?
Hello,
I have an issue. I can't seem to extract XML from an somepage.xml document and display it on a regular webpage. I have no way of reading its contents. I read up on some microsoft way of doing it, but not sure that is gonna fly (need it for most browsers), so can this be done easily with json/ajax? I have an xml file in normal format: www.somedomain.com/somepath/somexml.xml <products> <items> <item>blah</item> <item>blah2</item> <item>blah3</item> <item>blah4</item> <item>blah5</item> </items> </products> So, how do I get that data to manipulate and display in my html? I don't even know where to begin with json/ajx etc.. and how to call the xml file etc.. Similar TutorialsHi Folks, Have a C# application. On one of the .aspx page, I have a simple textbox: <asp:TableCell ColumnSpan="4"> <asp:TextBox ID="txtBox1" runat="server" Width="210px" MaxLength="100" TextMode="MultiLine" /></asp:TableCell> The Textbox display about half of its 100 character capacity to the user. I need the Tooltip to display the entire contents when hovered. Since the user can enter any length of text and hover the tooltip at any time, I figure Javascript in the codebehind page (.aspx.cs ) would be the solution. I know absolutley nothing about JAVA script ! Can anyone help ? Thank You in advance for your help ! Hello, I'm working on a somewhat interactive script that uses dynamic content and I'm quite new to javascript so I was wondering how I could download contents from a source such as a file that would give plain text output, display the output and then the client would wait for X seconds before refreshing the content(Discarding the old content)?
Hi guys. I am a newbie here on this forum. I have tried to learn how to use javascript on HTML forms however I just couldn't find the answers to my questions on the net. Perhaps I am not using the correct 'terms' when searching so I decided to join a forum like this to ask help. Anyway, I have a form with multiple inputboxes and lists and my goal is to generate and display all the accumulated information to a textarea so that the user can copy it afterwards. I have an idea how I could make it work but I am not entirely sure how to put it on a code. I actually have a number of questions on this so let me start off with the first one. I am eager to learn javascript so I would post my questions one after the other as my questions get answered. That way I get to learn how to build the code from the top. So my first one is this.. 1. I would like to know how to display a user input on an inputbox to a textarea. My html form is like this: Code: <html> <head> <script language="javascript"> function generateLogs (form) { TW_Logger.tickDoc.value = TW_Logger.name.value; } </script> </head> <body> <form name="TW_Logger"> <label for="name_id">Name: </label> <input type="text" name="name" id="name_id"/><br /><br /> <label for="logs_id">Ticket Documentation: </label><br /> <textarea cols="53" rows="5" name="tickDoc" id="tickDoc_id"> </textarea><br /><br /> <label></label> <input type="submit" value="Generate Logs" class="button1" onclick="generateLogs(this.form) " /> </form> </body> </html> I don't know what I did wrong but the script is not working. I appreciate any help I can get from anyone. Thanks! Greetings! I'm not a huge javascript person, I barely know enough php to get by. I struggle and I learn. I have this page that take a while to load and I really don't want it to show the results in the browser before the php script finishes. So I was hoping that somebody could point me to a way to either give some sort of wait indicator (i.e. a bar, the trendy twrilling circle thingy) or just hide the everything till the page is completely loaded. Below this sentence is the original post I left in the PHP forum. Since the birth of CSS3 you can easily use fonts that are NOT on the local users PC. This is the best! Although some fonts do not render through the browser. I wrote this script (for personal use) which is pretty elementary which reads fonts in a directory (without installing them in windows) and then lets you display them in various web aspects. In the script I pick a random background color and calculate a contrast color and then determine if the text color should be black or white depending on the color of the background. What's happening is that if I pile a bunch of fonts in the fonts directory when the script executes it displays the contents until it 100% complete. Basically I'd like it NOT to do that. I was looking around a progress bars but .. they don't seem to do much. I couldn't find one that would either give you that twrilling circle while it loads or something to that nature. **Is you test this script you MUST create a folder named 'fonts' in the root of where you put the script! ***If you find ways that I can make this more effecient or any tips or tricks that'd be great and constructive criticism is always appreciated! Thanks so much for any help or advice given! You'll need the javascript file animatedcollapse.js from my site http://handlersspot.net/css3font/animatedcollapse.js There's are three images: http://handlersspot.net/css3font/slantdivider.gif http://handlersspot.net/css3font/minus.png http://handlersspot.net/css3font/plus.png I tried to post the source here but it seems that I used up my allotment of 20K characters I tried to use the attachments feature but it doesn't work for me for some reason so I posted all the source here on my website: http://handlersspot.net/css3font/source.html Whew! That's allot of stuff! Again .. thanks for the effort/advice/help way in advance! Oh! Sorry! Meant to put the actual working version of this here --> http://handlersspot.net/css3font I have a very simple page that has one iframe on it. What I would like to accomplish is having Javascript read the contents of the iframe and write it to the page. I have tried numerous coding samples found all over the web but nothing seems to work for me as I am a major Javascript noob. The iFrame will include content like the following which will be from an outside web server; Code: <?xml version="1.0" encoding="UTF-8" standalone="yes"?><response><results><![CDATA[Success]]></results></response> Thanks a lot in advance! Hey there everyone. I've got a form which has a couple of inputs. The 1st is just a text input and the 2nd a textarea. I have it so that when someone types into the 1st input some javascript causes a div elsewhere on the page to update with whatever's being typed. html: Code: <div class="input text required"> <label for="CampaignTitle">Title</label> <input name="data[Campaign][title]" type="text" maxlength="76" id="CampaignTitle" /> </div> Javascript: Code: $('#CampaignTitle').bind("onpropertychange input", function() { $('#titleBar').text(this.value); }); That works fine. But using the above I tried to create a similar effect for the textarea but it doesn't work: html: Code: <div class="input textarea"> <label for="CampaignStory">Story</label> <textarea name="data[Campaign][story]" class="ckeditor" cols="30" rows="6" id="CampaignStory" ></textarea> </div> javascript: Code: $('#CampaignStory').bind("onpropertychange input", function() { $('#story').text(this.value); }); How can I make it work thanks Hi there, I basically need script that will detect if the user is using Internet Explorer, and then display a different page to the one that would be loaded for any other browser.
I am working on a project where I have 5 XML files that I bring into HTML and display the tables on one browser page. I would like for the row of the tables to change depending on what is in the "status" field. There will only be the following inputs in that column - "IS" which is in stock(green), "OS" which is out of stock(red), and "PO" which is Pre-Order(blue). 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=iso-8859-1" /> <title>ABC Book Store</title> <style type="text/css"> <!-- .style1 { font-size: 10pt; } --> </style> <script> function ld_fiction() { var doc=nb_fiction.XMLDocument; doc.load("fiction.xml"); document.getElementById("head_id").innerHTML="Fiction "; } function Id_nfiction() { var doc_s=nb_nfiction.XMLDocument; doc_s.load("nfiction.xml"); document.getElementByID("head_id_d").innerHTML="NonFiction"; } function ID_selfhelp() { var doc_t=nb_selfhelp.XMLDocument; doc_t.load("selfhelp.xml"); document.getElementByID("head_id_e").innerHTML="SelfHelp"; } function ID_reference() { var doc_u=nb_ref.XMLDocument; doc_u.load("ref.xml"); document.getElementByID("head_id_f").innerHTML="Reference"; } function ID_mags() { var doc_v=nb_mags.XMLDocument; doc_v.load("mags.xml"); document.getElementByID("head_id_g").innerHTML="Mags"; } </script> <XML id="nb_fiction" src="fiction.xml"></XML> <XML id="nb_nfiction" src="nfiction.xml"></XML> <XML id="nb_selfhelp" src="selfhelp.xml"></XML> <XML id="nb_ref" src="ref.xml"></XML> <XML id="nb_mags" src="mags.xml"></XML> <object id="nb_fiction" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" width="0" height="0"></object> <object id="nb_nfiction" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" width="0" height="0"></object> <object id="nb_selfhelp" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" width="0" height="0"></object> <object id="nb_ref" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" width="0" height="0"></object> <object id="nb_mags" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" width="0" height="0"></object> <body> <table width="30%" border="0" align="left" cellspacing="1" font size="10"> <tr bgcolor="#CCCCCC"> <td colspan="2"> <table id="FICTIONTABLE" table width="100%" datasrc="#nb_fiction" font size="1" border="0" align="center" bordercolor="#FFFFFF"> <caption> <span>Fiction </span> </caption> <thead> <tr> <th span class="style1">Stock No.</th></span> <th span class="style1">Title</th></span> <th span class="style1">Author</th></span> <th span class="style1">Status</th></span> <th span class="style1">Price</th></span> <th span class="style1">Publisher</th></span> <th span class="style1">Year of Release</th></span> </tr> </thead> <tbody> <tr> <td><span class="style1" datafld="stock"></td></span> <td><span class="style1" datafld="title"></td></span> <td><span class="style1" datafld="author"></td></td></span> <td><span class="style1" datafld="status"></td></span> <td><span class="style1" datafld="price"></td></span> <td><span class="style1" datafld="publisher"></td></span> <td><span class="style1" datafld="year"></td></span> </tr> </tbody> </table> </td> </tr> </body> </html> I only included the first part of the html code along with the first table, but there is a table for each xml file. You can also probably tell how the XML files are structured by looking at the way they are displayed in the tables. I think what I want to do can be accomplished with JavaScript, but I have no idea how to do it and it's the only thing I have left before I'm done. Any help would really be appreciated and thanks in advance. Hi, I am Aditya. I am explaining below the exact scenario where I need the help: I am developing a web application in which I need to integrate a javascript/html editor on some of the web pages and then provide 'Edit' buttons on those web pages so that users can edit the content on that partciular html/jsp page (like editing in wiki pages) and then, when they add some content and click on submit button, the new content should appear on the web page with all the formatting (i.e. bold, italics, color and so on) which was applied by user when he was entering the text. Now, I need help for the below issues: 1. Please suggest me a good javascript/html editor (freely downloadable) which I can use to integrate with my web pages. 2. Once the user has entered some content using the above javascript editor, how to make that content reach the server and update the corresponding web page. I am new to web development, so may be that these questions are too simple. But, I need some help from you. Waiting for your reply, Thanks, Aditya Hi there! I am using GlassBox "http://www.glassbox-js.com/" As a light box on a website. Basically, You click an thumbnail image, and a window pops up with a larger version of that image. Now originally, the window opened X number of pixels from the top of the page. However, My thumbnail images were located mid page, so when you clicked on one, the window would open at the top of the page and the user would not see it unless they scrolled up. So I attempted to modify the script so that it would get the users page width/height and display it directly in the center no matter the position. Now my problem is that the script only works when the user has already scrolled down. So if the page is scrolled all the way to the top, and you click on a thumbnail, the window will not open center screen. Here is an example: http://synaxis.pcriot.com/ When the page loads, DO NOT scroll it, and click on the image. You will see the window pop up, and not centered, like it should be. However, now if you scroll down, and click the image again, you see that it is now centered. I also noticed that when the page is scrolled up, and the image does not center, it always is placed below the thumbnail image, or otherwise where ever the DIV is located. It normally located under the image, but if i place the DIV at the top of the page then the window will pop up there. And this does happen on every browser that I have tested, Firefox, IE, and Chrome. So, I am pretty much stumped as to why this is happening. If anyone can shed some light I would be very grateful. Thank You Here is a link to the original code: http://synaxis.pcriot.com/javascript...ox/glassbox.js And modified code: http://synaxis.pcriot.com/javascript...ox/glassbox.js The modified code is at the very bottom of the script. Original Code: Code: /** * @public */ if ( typeof($) == 'undefined' ) { $ = function (id) { return document.getElementById(id); } } Modified Code Code: /** * @private */ var removeElement = function(id) { var Node = document.getElementById(id); Node.parentNode.removeChild(Node); } /** * @private */ var getDocHeight = function() { var db = document.body; var ddE = document.documentElement; return Math.max( db.scrollHeight, db.offsetHeight, db.clientHeight, ddE.scrollHeight, ddE.offsetHeight, ddE.clientHeight ); } /** * @public */ if ( typeof($) == 'undefined' ) { $ = function (id) { return document.getElementById(id); } } Hi All, Im new to this forum...need some of your help and advice. I have a js code like this : <script type="text/javascript"> <!-- var sipPos = 0; $(document).ready(function() { $("#panel-tab").click(function(e) { //if(autoTimer) clearTimeout(autoTimer); //autoTimer = null; e.preventDefault(); $("#panel").animate({ left: sipPos }, 1764, 'linear', function() { if(sipPos == 0) { sipPos = -856; } else { sipPos = 0; } }); }); }); --> </script> what it does is that it hide and show a panel by slidint it to the left. But my client want that on page load the panel opens automatically for about 2-3 seconds just to let users know that its here. So ive written this : <script type="text/javascript"> <!-- var sipPos = 0; $(document).ready(function() { var autoTimer = null; autoTimer = setTimeout(function(){ $("#panel").animate({ left: sipPos }); autoTimer = setTimeout(function(){ $("#panel").animate({ left: sipPos = -856 }); }, 2000); },1000); $("#panel-tab").click(function(e) { //if(autoTimer) clearTimeout(autoTimer); //autoTimer = null; e.preventDefault(); $("#panel").animate({ left: sipPos }, 1764, 'linear', function() { if(sipPos == 0) { sipPos = -856; } else { sipPos = 0; } }); }); }); --> </script> But when the panel finished showing the button to open it again doesn't work...any help please..really urgent. thks //Sam Hi There, I am attempting to do a site which is of a similar format to a TV listings website. Each day's schedule will be on a different HTM page (contained within an iFrame), and I would like it to display the current day's schedule on the appropriate day. I have searched the forum, but can't find anything exactly like this (maybe I'm searching for the wrong thing), so any answers greatly appreciated. Thanks, Roz Hi. I am pretty sure this requires js, but if not and I am posting in the wrong section, I am sorry. Let me try to explain my situation so you know what i'm trying to accomplish. I am hosting a site on a home pc. My isp blocks inbound port 80 so I use no-ip services and port 80 redirect and cloak the address because it displays my ip instead of the domain name. For example, without the cloak it will show http://xxx.xxx.xxx.xxx:81/index.php instead of http://mydomain.com/index.php I would like to display the current page the user is on somewhere on the page. Example: You are currently viewing index.php How would I be able to accomplish this? javascript2.js Code: function displayMessage(msg) { // Open a new window var msgWindow = window.open('', 'Message'); // Write message in the new Window msgWindow.document.write(msg); // Raise this window, in case it's not visible msgWindow.focus(); } //Enter total number of questions: var totalquestions=13 var correctchoices=new Array("a","a","b","c","b","c","a","a","b","c","a","b","b"); var correctanswers=new Array("memory locations","_ underscore","x=5+5;","20","Else","lose win","ticker = ticker + 1;","Ticker = ticker + 1;","300.000","Jonathon \b","var","var counter;","var mark = 50, 70"); function gradeit(){ var actualchoices=new Array() var msg1=new Array() var correctanswersno=0 var t=0 var displaycorrectanswers="" for (q=1;q<=totalquestions;q++){ var thequestion=eval("document.Questionform.q"+q) for (c=0;c<thequestion.length;c++){ if (thequestion[c].checked==true) actualchoices[q]=thequestion[c].value } if (actualchoices[q]==correctchoices[q]){ msg1[t]=q+")"+" Correct"; correctanswersno = correctanswersno + 1; t = t + 1; } else { msg1[t]=q+")"+" Incorrect: <br>Correct Answer: "+correctchoices[q]+") "+correctanswers[q]; t = t + 1; } } for (p=0;p<=12;p++){ displaycorrectanswers+="<br>"+msg1[p]; } var msg="Sco "+correctanswersno+"/"+totalquestions+" <br><br>Marks: "+displaycorrectanswers; displayMessage(msg); } Basically on my index page it has a button which when clicked makes use of gradeit(). Currently this then used displayMessage(msg) which opens a new window and displays the message. However, what I want it to do is to open another created html page e.g. answer.html and then for this page to display the message. How do i do this? When I hit the submit button, the result are display on a new page. how do I force it to stay on the same page, here's my code. Code: <HTML> <HEAD> <TITLE>Test Input</TITLE> <script type="text/javascript"> function addtext() { var newtext = document.myform.inputbox.value; document.writeln(newtext); } </script> </HEAD> <BODY> <FORM NAME="myform">Enter something in the box: <BR> <INPUT TYPE="text" NAME="inputbox" VALUE=""> <INPUT TYPE="button" NAME="button" Value="Check" onClick="addtext()"> </FORM> </BODY> </HTML> any comments or suggestions would be greatly appreciated. Currently the page has some divs' displays set to none. When a user clicks an anchored link, it displays the appropriate div. Here is the script I'm currently using, which works fine: Code: function showApp(whichApp) { document.getElementById('dTips').style.display='none'; document.getElementById('dCaseStudies').style.display='none'; document.getElementById('dWebinars').style.display='none'; document.getElementById('dReports').style.display='none'; document.getElementById('dDigimags').style.display='none'; document.getElementById('dPodcasts').style.display='none'; document.getElementById('dNews').style.display='none'; document.getElementById('dCalendar').style.display='none'; if (document.getElementById) { document.getElementById(whichApp).style.display='block'; } } Here's how I call it within the page: Code: <a href="javascript:showApp('dTips')">Tips</a> Is there any way to modify it so that if the user clicks a link on a different page, it goes to the APPS page and displays the requested div? If not, is there another way to accomplish this task? I'm trying to display the elements in an array but doesn't seem to work: Code: var myurl=new Array("google.com", "yahoo.com"); for (i=0;i<=myurl.length-1;i++){ document.writeln("<a href='http://www.' + myurl[i] + target='_blank'>"); } Not sure why it is not working?? I know that when you "display: none" with CSS it will not show the div content in the browser, but will still show the div and content in page source. Is there a way (via javascript or anything else) to also remove the content from page source at the same time? Thanks. Bit of a noob when it comes to js. Hope someone can help me out. I am trying to place text output from a url on another webpage. The output is the status of an alarm system. The URL is: Code: https://www.eye-zon.com/EZMOBILE/index.php?mid=<hash>&action=ssi&did=<mac> hash and mac info remove for security reasons. The URL leads to a webpage that outputs: Code: <update>2011-08-18 21:21:10</update><status> Stay Armed </status><trouble>NO</trouble> I would like to place these three outputs on another page. Any ideas? Hi, i will try to be as brief as possible. I have a page A with form: Code: <form id="search" action="find.html" method="get"> ... (some select options) ... <input type="submit" class="submit" value="search"> this form look up some holiday destination which appears on this page with url: (example) Code: www.domain.com/find.html?destination=italy&price=500 Now, I dont want to display result on this page, but on page B, in iframe. I found a way how to redirect output as a link to properly show in iframe on page B. Page A contains: Code: <a href="pageb.html?http://www.domain.com/find.html?destination=italy&price=500">show on page B</a><br> Page B contains: Code: <script type="text/javascript"> <!-- function loadIframe(){ if (location.search.length > 0){ url = unescape(location.search.substring(1)) window.frames["iframe"].location=url } } onload=loadIframe //--> </script> <iframe src="" name="iframe" id="iframe"</iframe> In this case page B will properly load requested link in iframe. Problem is it is just a static link... I want to display search result from the form. Thanks a lot for your help... |