JavaScript - Retrieved Data From First Page
Hello everybody,
I have the following problem: I have a form in a page in which you have multiple choices on how you would like the data from an XML file to appear. What I want is that when I pick the subsequent selections they be displayed in the next page. For example (you have chosen cyan, and a range from 10-50, etc) i want the xml to appear on a third page in the way that i selected it, generating at the same time automatically the respective xsl file. record from xml Code: <myxml> <record> <id>1</id> <football_team>Aberdeen</football_team> <position>28</position> <ddd>Mbira</ddd> <www>833.48</www> <ball>Aberdeen</ball> <bin>42</bin> <bat>Jew's harp</bat> <bend>10</bend> </record> </myxml> (the xml created from a db using php ) I have been stuck with this problem for over a week now and I'm going crazy. Thank you for your help in advance. If you need further info please tell me to post it. Similar TutorialsI'm using jquery right now but I sort of understand what the problem is. I'm making a file manager and when you click on an li tag it will do some action depending on if it's a file type or a folder type. There are 3 important files you should know about. 1. filemanager.php (Where the file managing takes place. Starts by including filemanager_getfile.php and including filemanager.js in the head). 2. filemanager_getfile.php (Information that receives information from the ajax request [the directory to be read] and prints the new file list in <li> tags) 3. filemanager.js (Jquery that processes li clicks) The problem is, when you click on a folder (and it loads the new information from the ajax request) the jquery doesn't check the new li tags when clicked (I'm guessing when you first link the javascript file it has to compile all of the current li information?). Try it for yourself- [removed] Instruction (if it's not already obvious): -Clicking a file selects if. If files are selected and you click the arrow in the file options it will transfer it (not really, but it will later). -Clicking a folder will send an ajax request with the new directory information to be checked and return the html -Clicking the '?' in the file options will display the pages html (I implemented it to debug). I have tried linking the js page every time I include the new directory information, but the js stacks on each other. So if I click on 3 folders and hit the '?' button it will display the page html 3 times. And if I select the index.php li and click transfer, it will "transfer" 3 times. filemanager.php Code: <div id="goldenSub"> <div class="title">Golden Subdomain</div> <div class="files" id="goldenSubFiles"> <? include("filemanager_getfiles.php"); ?> </div> <div id="history" visited="goldensub/"></div>; <div class="fileOptions"><img src="images/question.png" title='HTML Information' id="ask"><img src="images/transferto.png" title='Copy File To' id="transferTo"></div> </div> filemanager_getfiles.php PHP Code: <? $path = $_REQUEST["dir"]; if($path == "" || $path == null) { $path = 'goldensub/'; } echo "\n<div class='path'>$path</div>\n<ul>\n"; $handler = opendir($path); //We need to organize the results. Be default, all files and folders will be //located by alphabetical order. But we want to list all folders first, followed //by files. By adding the results to arrays first we can decide to print our //results in the order we want. $folderArray = array(); $fileArray = array(); $folderCount = 0; $fileCount = 0; while(false !==($file=readdir($handler))) { if($file != "" && $file != null && $file != "." && $file != "..") { $extensionLocation = strrpos($file, "."); //Is this a folder or a file? if($extensionLocation == null && $extensionLocation == "") { //This is a folder unless it's the error_log file. if($file != "error_log") { //Nope, it's definitly a folder. Add it to the folder array. $folderCount++; $folderArray[$folderCount] = $file; } } else { //This is a file. Add it to the file array. $fileCount++; $fileArray[$fileCount] = $file; } } } if($path != 'goldensub/') { echo "\t<li title='goldensub/' type='folder'>\n\t\t<img src='images/up.png'> goldensub\n\t</li>\n"; } for($i = 1; $i<=$folderCount; $i++) { $newPath = $path.$folderArray[$i].'/'; echo "\t<li title='$newPath' type='folder'>\n\t\t<img src='images/folderOpen.png'> $folderArray[$i]\n\t</li>\n"; } for($i = 1; $i<=$fileCount; $i++) { $extensionLocation = strrpos($fileArray[$i], "."); $nameLength = strlen($fileArray[$i]); $extensionLength = $nameLength-$extensionLocation; $nameClean = substr($fileArray[$i], 0, $extensionLocation); $extension = substr($fileArray[$i], $extensionLocation+1, $nameLength); echo "\t<li title='$fileArray[$i]' type='file' extension='$extension'>\n\t\t\n\t<img src='images/$extension.png'> $nameClean\n\t</li>\n"; } echo "</ul>"; ?> filemanager.js Code: $("li").click(function(){ var type = $(this).attr("type"); //This is a folder if(type == "folder") { //Path to new directory var newPath = $(this).attr("title"); //Ajax request to filemanager_getfiles.php $("#goldenSubFiles").load("filemanager_getfiles.php", { dir: newPath }, function(data){ //Update log newLog("Directory changed to <i><b>"+newPath+"</b></i>"); }); } //This is a file else { if($(this).hasClass("selected")) { //It's already selected - deselect it. $(this).removeClass("selected"); } else { //Select it $(this).addClass("selected"); } } }); Resolved
I want to use Javascript to submit a form - without filling the form in physically Is this possible? Let's say a web page has a form that submit First Name and Last Name to the next page Instead of filling in the form and hitting submit, can I submit the data in variables and call the next page somehow using Javascript? Thanks OM Hi, I want my page to jump to a different page based on data collected in the form input fields. I can jump to a new page alright, using the following javascript: 1. javascript code in form_a.html document.forms["form_A"].action = "page_x.html"l; document.forms["form_A"].submit(); 2. document.forms[0].action = "page_x.html"l; 3. window.locaton = "page_x.html"; 4. window.location.href = "page_x.html"; The problem is, I can see the new page was jumped to, but immediately it return back to the page that trigger the jump. Any idea? I need to finish the project before Christmas. Any help is greatly appreciated! Jeff Hi All, I am new to javascript and actually I need to insert the data into a textarea from a text file when the user loads the browser.. and I am using this program to do it..but its throwing error 405, I dont know whats the problem..can any one please check the code or give me some code to do the same funtionality. Quote: <script type="text/javascript"> function getfile() { xmlHttp = GetXmlHttpObject(); if (xmlHttp == null) { alert("Browser does not support HTTP Request"); return; } var url = "${pageContext.request.contextPath}/static/files/email1.txt"; xmlHttp.onreadystatechange = stateChanged; xmlHttp.open("POST", url, true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete") { var emm = xmlHttp.responseText; alert(emm); } } function GetXmlHttpObject() { var xmlHttp = null; try { // Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } </script> can one give me some idea regarding this. Thanks in Advance, Best Regards, Rajasekhar. Hello, I am trying to copy data from one element to another on page load. Below is the scenario: I want to copy the below data within each element <h2>Product Name</h2> <div class="price">$9.99</div> To the different parts of this URL <a href="https://myaccount.foxycart.com/cart?name=PRODUCT NAME&price=PRICE" class="foxycart">Add to Cart</a> Thank you in advance for your help. hi there, i wish there could be solution to this as I cannot figure how to do it. I would like to have an autocopy and paste data from a page to a textbox...Like if a webpage has the details like receive from: and receive to:, can this text be autocopied to a textbox on a click of a button? the text box is place on another webpage, so there are basically two webpages, 1st page is where the data to be copied is contained while the 2nd webpage is where the textbox is contained. the data to be copied on the 1st page are the contents of received from: and recieved to: like receive from:edward receive to:jacob. So with a click of a button I would like the contents receive from:edward receive to:jacob be copied and pasted on the text box from another page... I hope this sounds clear enough...sorry to be a pain... regards, verve hi there, i'm new here and pretty new to js. i'm making a page for my daughter's school - or trying to. they are having a silent auction and i'm trying to make a very simple bidding page. where i'm running into problems is passing the bid to a text box (read only) where it can be updated when a new bid is entered. I would like this to be in the upper part of the page with the listings of the auction items, i just can't wrap my head around how to do this. I've gotten as far as the form for entering the bod and contact info. I have the php code to submit. i still have to get the validation js to make it more secure. thanks for any help. Code: <html> <body> <h1 id="logo"></h1> <div id="main"> <p> <h4>Silent Auction</h4> <form name="auction" method="post" action="send_form_email.php" > <label for="item1">Item 1</label> <br /> <label for="curr_bid_item_1">Current Bid = </label><br /> Your Bid = <input type="text" name="item1" maxlength="15" size="10" /> <br /> <br /> <label for="item2">Item 2</label><br /> <label for="curr_bid_item_2">Current Bid = </label><br /> Your Bid = <input type="text" name="item2" maxlength=="15" size="10" /> <br /> <br /> <label for="item3">Item 3</label><br /> <label for="curr_bid_item_3">Current Bid = </label><br /> Your Bid = <input type="text" name="item3" maxlength="15" size="10" /> <br /> <br /><br /><br /> <form name="contactform" method="post" action="send_form_email.php" onsubmit="document.getElementById('myButton').disabled=true; document.getElementById('myButton').value='Submitting, please wait...';"> <label for="first_name">First Name *</label> <input type="text" name="first_name" maxlength="50" size="30"><br /><br /> <label for="last_name">Last Name *</label> <input type="text" name="last_name" maxlength="50" size="30"><br /><br /> <label for="email">Email Address *</label> <input type="text" name="email" maxlength="80" size="30"><br /><br /> <label for="telephone">Telephone Number</label> <input type="text" name="telephone" maxlength="30" size="30"><br /><br /> <label for="comments">Comments</label><br /> <textarea name="comments" maxlength="1000" cols="40" rows="6"></textarea><br /><br /> <input type="submit" value="Submit" id="myButton" /> </form> </form> </div> </body> </html> Hello Friends In my jsp,Struts project i am using the javascript calendar control for selecting the date and by using function calcage() i am calculating the age of the user but problem occurs when the page refreshes OR when user updated the other values such as name ,contact no. Then the value of the age is set as 0 in the textfield as 0 So can you please tell me why this problem occurs And please give me solution Thanks I have a "pre-order" opt-in page disguised as a "step 1" in the order process of a clickbank product I'm ready to launch. I'm wanting to pass the user's first name, last name, and email address (built into the optin form) over to the clickbank order page upon submit. Clickbank gives me the data strings you can pass along, but I'm not sure how to properly configure this function or where to place it in my page code. This is the only step I have remaining before I can go live, and it's holding me back. Any suggestions would be extremely helpful. I can provide any code needed for review to assist in getting this wrapped up. Thanks in advance Hi. Please help. I have a credit card donation page and what I wanted to do is after they click the submit button and transaction is successfult I wanted to capture the donation amount they enter from the donation page and show it to the next page. I know that is possible but I just don't know how to do it. I am new in Javascript and still consider as a baby. Can someone please help? Thanks in advance.
Hey guys, I've been searching for a few hours and haven't been able to find a code snippet to see if this is available. I'm attempting to pass text from my website to another website that has a form setup on it. I'd like to fill in the pertinent data for my users on the page that I load for them. I cannot make any changes to the receiving page as it is run by another company. I've pasted some of the code that is available on the receiving form. Thanks for any help. Code: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <input name="txtBranch" type="text" maxlength="4" id="txtBranch" tabindex="1" style="height:14px;width:35px;" /> <input name="txtClient" type="text" maxlength="11" size="11" id="txtClient" tabindex="2" style="height:14px;" /> Im trying to fill in the data in these 2 input fields. I just wrote an essay to discover it had logged me out and I lost everything. Grrrrrrr. Here goes again, simplified this time. I've got a sticky footer at the bottom of the page and a spry collapsible panel which expands to reveal content on mouse over. The problem I'm facing is that the page doesn't scroll down with it, only the scroll bar gets larger to accommodate for a manual scroll down. This is kind of useless because the user might not even realise that there's extra content there in the first place if it's not automatic. My question is, what's the best javascript code to use to automatically scroll the page down when the spry tab is opened and where would I insert it? I've tried all morning with no success so far! Thanks, Nick, I'm copy pasting this post this time round, I don't trust this website now I want to implement a javascript function where a submit button will be submitted from the parent page each time I close a child page. Please let me know what I did wrong in my code and please elaborate your answer so that I could understand it better. Thank you so much for your help. I have the following jscript code but it is now working. Code: window.onunload = submitParent; function submitParent() { var doc = window.opener.document, theForm = doc.getElementById("finalForm"); theField = doc.getElementById("finalSelected"); theForm.submit(); theField.trigger('click'); } My form from the parent page is as follow. I want my jscript to just click on the submit button once. Code: <form id = "finalForm "name= "finalForm" method="POST" action=""> <input type="Submit" id = "finalSelected" name="finalSelected"/> Hello. My goal is to load the JS for a specific element before displaying that element. I integrated a third part script, and it works well. I set the timer he The JS is in my heading as <script type="text/javascript" src="countdownpro.js"></script> About mid-body I have: <span id="countdown1">2010-07-20 00:00:00 GMT+00:00</span> which allows for the setting of a target date to countdown to. When the page first loads it shows the above long format target time, until the js/meta tags kick in to modify it to just show the actual countdown as 00:00:00. I have attached countdownpro.js to this post. I tried shifting the function CD_Init() to the top of the script, and also appended it inline with the .html. I tried setting the big external script to "defer", but neither arrangement worked. I also tried placing the src file right at the top. I appreciate your help. 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, I have a large list of UK towns, see he http://www.mypubspace.com/mobile/index.php#towns I would like to add an a-z link so that when a user clicks on say 'W' they are then presented with the towns that begin with 'W' the problem is, is that I have to keep #towns in the URL as it's a web application Can anyone help? thanks Hi guys, I need to redirect a page to another url when it detects that the page is opened inside an iframe. I need help with this <script > if(location.href != top.location.href){ window.location = 'http://myurl.com' } </script> - check my attachment index.zip Thx. |