JavaScript - Passsing Javascript Variable Via Url And Read It In Form Textfield
hi ,
i am trying to pass a javascript variable into URL ..but not getting the value.. var newID = 2; row.insertCell(6).innerHTML = "<a href=Update_Gate.cfm?GateIdVar=newID>Edit Gate</a>"; i am getting "newID" in Update_Gate.cfm page ... i want to pass this javascript variable in url and read it on the other page as form field value any help !! Similar TutorialsIs it possible to have an onclick event on a readonly input field? I want to avoid the mouseover event.
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... 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 Hi I have a problem but im not sure if it could be solved by Javascript or PHP but either is good. I have a form with a text box where users can enter a 10 digit code. The 10 digit code can be just numbers/letters (eg. 0123456789 or abcdefghij) or it can be a mixture (eg. 0a1b2c3d4e). What I would like is if the user enters a code which is a mixture of numbers and letters then the submit url goes to mixed.php If the user enters a code which just has letters or numbers then the submit url goes to sole.php Anybody can help me? I know its possible to change the url from selecting radio buttons so I hope this can be achievable. I hope that makes sense...let me know if you need more info. Thanks guys! so i have this code i am working on(this is a dumbed down version of it) Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $("#Submit").click(function(){ for (i=0;i<=50;i++) { $.ajax({ url:"process.php", type:"get", data:$("form").serialize(), success:function(response){ var obj = jQuery.parseJSON( response ); var success = obj.success; var actionsNumber = obj.number; $("#result").html('There have been '+actionsNumber+' loops completed'); } }) } }) }) </script> </head> <body> <form action="" method="post"> <p> <label><strong>Number of Loops</label> </p> <input name="count" type="text" value = "1"/> </p> <p> <input id="Submit" type = "button" value = "Send"> </p> </form> <p id="result">There have been 0 loops completed</p> </body></html> so you see this for loop for (i=0;i<=50;i++) I want it to be able to be like for (i=0;i<=count;i++) so that it will loop the number of times inputted also(though i dont know if this is something that i need to use js for) On my full code there are other textboxes that need to be sent to process.php each time that it is run. How can i achieve this? also before anyone asks i have googled this and searched around yet i havent been able to figure this out, everything i have tried hasnt worked and here is the process.php PHP Code: <?php session_start(); // process the form data here //::::::::: // if(!isset($_SESSION['number'])){ $_SESSION['number'] = 0; } $number = $_SESSION['number']++; // output json response echo'{"success":"true","number":"'.$number.'"}'; ?> I've been having a hard time with this and was hoping someone here would take a little pity and render me a great service. I'm using a javascript to get the user's timezone and am trying to pass the response to an input field in a php form. With a great deal of trial and error I got a demo working to a point but I'm stuck. Here's what works now: Code: <p id="timezoneInformation" style="text-align: center;">click here</p> <script src="jstz.js"></script> <script> var container = document.getElementById("timezoneInformation"); var showTimezone = function () {container.textContent = jstz.determine().name();}; container.addEventListener("click", showTimezone); </script> jstz.js is from Automatic timezone detection using JavaScript The example above is as far as I've gotten. I would like to send the results to a form field to submit to the server. It's probably a lot easier than I'm making it out, but I've had little success and would welcome any help. Thank you. I have used php with forms but can I do easy form to java vars? I saw one snippit of code that did it when I was newer but did not understand it. what is the way you usually do this? This little snippet tells me that using "read" as the saved cookie doesn't work. But using "listen" "speak" "write" etc. works OK. Code: else if (lessonnum == "reading"){ // oddly, "read" as cookie value fails. Why? so.addVariable('file','/images/101online/Introduction/readsubtest/audioRead.mp3'); } I had to change it to "reading". Is this normal? Is there a place where I can find all the reserved values that won't work as cookie drops? Hi all, I am new to JS and usually learn by studying code posted online and modify it to have it do what I need. Recently, I used a totaling plugin for an online ordering form which does the below: item1 qty(user input text) * preset price = total price item2 qty(user input text) * preset price = total price item3 qty(user input text) * preset price = total price -------------------------------------------------------- grand total -------------------------------------------------------- The JS code which passes the grandTotal variable is as below: Code: function ($this){ // sum the total of the $("[id^=total_item]") selector var sum = $this.sum(); $("#grandTotal").text( // round the results to 2 digits "₹" + sum.toFixed(2) ); } The problem I have is the above grandTotal displays the final value when put into a table like below: Code: <td align="right" id="grandTotal"></td> But I am unable to make it work by passing it into a variable within the form fields. I would like to do something like this: Code: <input type="text" name="grandTotal" id="grandTotal" readonly="readonly" /> Can somebody please help me fix this? Any help will be greatly appreciated. Thank you. Ok, I am currently working on an announcements portlet for a dashboard that my team is creating. What is desired is to be able to have this portlet access a stored text file (file can be edited so content is subject to change) that will have all the information needed for these announcements. The JavaScript will then write it into a html file. I am a novice at html, and javascript; and i was hoping that if anyone had any advice, ideas, or a helpful link that could point me in the right direction I would much appreciate it. Hi, i have a question, is JavaScript can read an external file? i have an ear file, can it read external file without the external file compile together in the ear file? can we do so? This is a must-read for all users posting to the JavaScript forum, especially if you're looking to get help. A lot of you are posting in a manner that makes it extremely difficult- if not impossible- to respond to. Below are a list of posting guidelines and tips we ask that you please read- and FOLLOW- when asking for help: 1) Type in a subject that summarizes your question! - The fastest way to turn off other members wanting to help you is to type an incomplete or silly subject for your post. Examples of poor subject titles include: - "Help!" - "I'm a newbie...please!" - "Is this possible using JavaScript?" - "loops" - "Urgent...deadline tomorrow!" - "A challenge for you JavaScript masters" The above subjects either have absolutely nothing to do with the question itself, or are grossly incomplete (ie: "loops"). When asking for help, enter a subject that summarizes your question, period! Don't use silly, incomplete, or "bait" subjects. 2) Be descriptive and articulate when asking your question! Some of you are posting as if we're all psychics, and are supposed to grasp your question with the little or confusing information you've provided in your question. We cannot read your mind, and putting up a post like "Can someone help me with arrays?" or "How can I get the slide-in slideshow to work on my site?" is not nearly enough information to go by. What exactly do you want to know about arrays? Which slide-in slideshow are you referring to (the one written by Bill Gates?)? Set us up with some crucial background information, what you want to do, and what the problem is. Be concise and precise. Also when posting, understand that you're trying to convince others to help you. Be articulate and have respect for the English language! Check for spelling/grammar mistakes, and try and format your question and code in an easily legible manner. Big tip: Use the preview button often. Bottom line- put yourself in our shoes, and try and phrase the question so it's clear and easy to respond to. 3) Do your homework first. Only post the part of the script you're having trouble with! There are generally two types of people- ones that simply dump their entire page or problem and expect everyone to spend hours solving everything for them, and those that do their own homework first, and only ask very specific, manageable questions. The later invariably gets more and better responses from others. When you're lazy, do not expect us to be hardworking for you. As an example, lets say you're working on a long script that uses the "switch" statement of JavaScript, and it's returning errors. You could either: i) Post the entire script and simply say "Please debug this script for me!" ii) Or, localize the problem yourself first and post instead "Can someone tell me the syntax of the switch statement in JavaScript?" The second question will get a LOT more quality responses, as it is concise, manageable, and not overwhelming. Remember, ask for the world, and you'll get nothing. Ask for a little, and you'll get a lot. 4) Use the search feature often to make sure your question isn't already answered- The longer this forum has been online, the more solutions it accumulates. Always search past posts first (using the search link to your upper right) to make sure your question isn't already answered. Use 1-2 keywords as the search terms. 5) Know the capabilities and limits of JavaScript before posting. Please familiarize yourself with what JavaScript can- and cannot do- before posting. Many people are posting JS questions that simply cannot be accomplished using the language, period. JavaScript is a client side language, and cannot manipulate the server end in any way, such as saving data to the server, accessing a database etc. JavaScript works strictly on the user end, such as popping up a window, applying an image rollover effect, or determining user screen resolution (*without* the ability to pass this info back to the server). If JavaScript is completely new to you, please familiarize yourself somewhat with the language, by visiting the below links - JavaScript questions and answers list - JavaScript tutorials - Advanced JavaScript tutorials - Pre-made JavaScripts (illustrates typical JS applications) 6) Be appreciative and follow up when getting a response. Everyone here is volunterring their time to help out others. The least you can do is be appreciative and follow up when getting a helpful response. If you've solved your problem, let people know so they don't continue spending time on your question. Saying a little "thank you" goes a long way. I am having trouble with JavaScript code and do not know why it is not working. I have the code I think is right but it is not showing up in my browser when run. Any ideas? Also are there any other ways to read in an xml file using javascript? please list if so. I wants to access server web page which data is continuously growing(streaming data), I want to buffered some of that data write it in responseText then again get next buffered data write it and so on (in AJAX). Is it possible? if yes how to do that? Hello, Is there a way with JavaScript to easily detect which mobile browser is being used? I would not normally ask this, but because we do not have the time or budget to implement any back end detection scripting it is our only option right now! I don't think we will need to detect which version of the browser, or which revision of the phone is used - just need to target each family to deliver the proper video type. Hi, Using the following javascript: Code: <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"> </script> <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/USERNAME.json?callback=twitterCallback2&count=1"> </script> I am able to display the latest tweet of a user into a div. However, I have a user-generated database of username's stored in an XML file and would like to list each username's latest tweet on a single page. Any thoughts on how I might be able to achive this? I'm new to javascript so forgive my stupidity. hi, Does any one knows the javascript that read step by step single line from form and then store in array , and that array use 4 further references Please help i need this Please Please Please Thanx Regards Fawad Hey folks, I have a little problem here, I have two textfield and a botton Text fields: Code: <input name="rate" type="hidden" id="rate" value="<%= rs_rating.Fields.Item("rate").Value %>" /> <input name="plus" type="hidden" id="plus" value="1" /> <input name="total" type="hidden" id="total" /> <input type="Submit" name="Submit" id="Submit" value="Course Rating " /> Now what I want is something like this input "rate" value + input "plus" value which means if for example if rate (with dynamic value which could be any number) is 4 it will be 4+1 (1 is the static value of input "plus") which will be 5 and that 5 would be the value of input "total" that is the only text field which submit to DB. Just need the JS for that math problem. Thanks folks. Hi all. I have a textfield on my form problem. My boss wants it as a textfield to keep the field small on the page but still wants to be able to read all of the information that is in the field. What can I do with this?? Can we have change to textarea when he hovers to clicks in it. Any help would be appreciated. |