HTML - Variables
can anyone fill me in on how to call a variable from a javascript file? this is what im doing:
click a button on a page that is generated from a javascript script--> button redirects to new htm file. new htm page that is loaded needs to know the value of a variable from the script that was run in the previous page before the redirection. sooo: page A is loaded: script loads a button into the webpage user clicks the button: the button performs window.location = "www.somesite.com" somesite.com is loaded but a variable is needed from the script that loaded the original button so that the value held by the variable can be displayed on the page. Any ideas to how I would accomplish this would be greatly appreciated. Thanks Similar TutorialsOur website works perfectly with Mozilla Firefox, but in IE7 or 8, if a person looks around through the content and then starts over choosing different options, the session variables don't get changed. If the cookies are cleared, then the problem is temporarily solved. Is there common code that solves this problem for IE? Thanks, mei I need to display variables on my thank you page from my opt-in page (using Aweber as my autoresponder). They say to display variables use <script>printElement("custom communication")</script> which is fine and displays correctly but I need to include that within a IF/Else statement so I can display a different message based on the variable. Here is my If/Else which does not work - I assume because the extra <script> <script type="text/javascript"> var d = new Date() var time = <script>printElement("custom communication")</script> if (time=='Satisfied') { document.write("<b>Good morning</b>"); } else if (time=='Dissatisfied') { document.write("<b>Good day</b>"); } else { document.write("<b>Hello World!</b>"); } </script> Any help on how I can solve this would be great!!! In a regular form with text fields, can I pass the imput from the user directly into a hidden textarea from multiple fields intertwined with html? Example: <form> <input type="text" name="firstname"> <input type="text" name="lastname"> <input type="text" name="occupation"> <input type="hidden" value="some html + firstname + some html + lastname + some html + occupation"> </form> I think this might require some javascript. Is something like this possible? Blah Blah Blah Hello guys! Let me explain the problem... I have a website full of radios, 12 on total, and all of them have something like this: <object id="Radio01" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" type="application/x-oleobject" width="140" height="45" align="middle"> <param name="FileName" value="Link_to_the_stream"> <param name="Autostart" value="False"> <param name="enableContextMenu" value="False"> <param name="ShowControls" value="True"> <param name="ShowDisplay" value="False"> <param name="ShowStatusBar" value="False"> <param name="Volume" value="100"> <embed src="Link_to_the_stream" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/download/default.asp" width="140" height="45" align="middle" autostart="0" enableContextMenu="0" showcontrols="1" showdisplay="0" showstatusbar="0" volume="100"></embed></object><br> <b><a href="Link_to_the_website" target="_blank"> Radio_name </a> As the radios are continually going on and off, sometimes I need to switch them. But the html of my website is too long and I would not like to edit it every time I need to switch a radio. I would like to, instead, create an apart document with variables like: Link_to_stream = "http://www.link.com:port/" Link_to_the_website = "http://www.radiowebsite.com/" Radio_name = "Name of the radio" And then make the html call these variables, so if I wish to switch a radio, I would only edit the file... The tricky part would be to edit the object src, I think. Is there any way to do that? Any method? I'm using conventional html on my website. Thanks in advance! Hey all, I want to have code that will take a user to a site that they specify. For example: John puts 'google' in the input box. The form will then send him to www.google.com. So whatever SITENAME is it goes to www.<whatever it is>.com Any help please? Will I need JavaScript? Code: <form name="input" action="http://www.SITENAME.com" method="get"> <input type="text" name="SITENAME" value="" size="20"> <input type="submit" value="Submit"> </form> Thanks, MacAddikt I'd like to have a html file where i can pass over the variables from another html file i.e. title = "Image 01" Image = image.jpg description = "image 01 description test" then with a link open the html file with this variables. thanks. I am struggling with a tutorial right now. I have a picture that when clicked on takes the user to another PHP page. At the end of the URL I have added several variables that I send to the new page. Currently the above works. However, I also want to make it so the new window opens in a little pop up window that I can control the size of. I can make that happen, but only if I don't add the variables to the end of the URL. This works <a href="game.php?name=<? echo $gameName ?>&swf=<? echo $swf ?>&width=<? echo $width ?>&height<? echo $height ?>"><img src=<? echo $picture ?> width="310" height="223" border="0"></a> This works <a href="javascript:void(0);" NAME="<? echo $gameName ?>" title="Kesler" onClick=window.open("game.php","Ratting","width=<? echo $width ?>,height=<? echo $height ?>,0,status=0,");><img src=<? echo $picture ?> width="310" height="223" border="0"></a> But combined they do not work <a href="javascript:void(0);" NAME="<? echo $gameName ?>" title="Kesler" onClick=window.open("game.php?name=<? echo $gameName ?>&swf=<? echo $swf ?>&width=<? echo $width ?>&height<? echo $height ?>","Ratting","width=<? echo $width ?>,height=<? echo $height ?>,0,status=0,");><img src=<? echo $picture ?> width="310" height="223" border="0"></a> Anyone know how I go about this? The embedded side of my project is not much of a problem to me, I have background on this. But HTML is a new animal and I am low on the learning curve. I apologize if this is an unlearned question. The attached file is one I cut and pasted together by an eclectic approach . The page layout is a little asymmetric, but has its elements in (close to) the right places. The presentation is nice. It also displays the values from the PIC correctly, but in two different "divisions" of the code. I admit, I don't know s__ from shinola about this. I am just cutting and pasting and trying to follow some general syntax concepts. And I have by utter beginner's luck gotten something that somewhat "works". Referring to line 39 of the attached file, the "display" division, the following 25 paragraphs of type: <p>updateParm0: <span id="updtParm0">?</span></p> Are working correctly and displaying the value associated in the mchp.js file which contains the dynamic variable array. Of course, this printing screws up the placements of all the elements in the large table which follows. But this will ultimately not be a problem, because these paragraphs won't remain in the code. What I would like to accomplish is to remove the 25 paragraphs in the "display" division, and cause the "updtParmXX" values to appear on the page in the placement described by the table layouts. Could someone tell me briefly how to do this? Or if I need a completely different approach? Thanks. PS: the attached .zip file is index.htm in its day job. One product in my shop has multiple sizes and each size has a different price. I would like a drop down menu that lists options like this: Small Shirt - $15.00 Medium Shirt- $20.00 From whatever option is chosen, I need to register both the name(item_name) and price(amount) values with two different fields, like this: input type=hidden name="item_name" value="Small Shirt" input type=hidden name ="amount" value="15.00" Any suggestions? Hey guys, I'm fairly new to programming web forms on my own. (I've used some Joomla/Mambo components that eased the process). I understand the basics of forms and what not, but was curious as to what the best way to pass variables from an email (pre-filled) to a form would be without using Server-Side Scripting of any kind. (I could easily write a PHP page to do so, but on this specific project I don't have access to any kind of scripting on the server side). I have thought about doing it one of two ways. The first way would be to write some Javascript that saves the fields I need as cookies and then calling those cookies back on the webform. The other way, was to pass the variables through the URL. I don't know if this is possible without Server-Side Scripting or not. I'm sure I could hack up some sort of Javascript code to read the URL and break it into the relevant variables but that seems like a lot of work for something so simple. Is there a way to use the GET method at all to pull those variables from the URL? Also, sorry for not posting this in the Client-Side Scripting forum, but I wasn't sure if there were other solutions to this problem that wouldn't require any scripting at all. Thanks Again, -Ian- I am trying to pass variables to a php script from a text link. This is how I was doing it: <a href="page.php?variable=something"> However, my question is: is there a way to do this so that the variables are NOT included in the URL? So the destination URL would be 'page.php', and not 'page.php?variable=something', but the variable would still be passed? THANKS! Hey guys, i'm just starting up with html, and am having a few problems. I have a php file titled "stats.php" that return results when you direct your url to: /stats.php/default/dricho Its a dynamic sig generator through a php file. I have created a form that allows you to simply add in the details so that it generates the link for you. But i am having an issue. here is the form: HTML Code: <form action="http://www.domain.com/sig/stats.php" method="post"> <select name="background"> <option>maple</option> <option>default</option> </select> Name: <input name="rsn" type="text" /> <input type="submit" /> </form> How can i make it so teh results open a link based on teh items chosen? i.e. if i chose maple and input dricho it would direct the url to: "/stats.php/maple/dricho"? All help is greatly appreciated, Daniel Hi, I have a page that uses AJAX to set a variable, the variable is either true or false. On the page there is a form with a text input, i would like the variable to dictate whether the element is read only or not. So instead of: <input name="cd" value="title" readonly="readonly" /> I would rather something like: <input name="cd" value="title" readonly="$lock" /> Note: I am aware that $lock is PHP but I am not familiar with the syntax in this instance. Thanks in advance, Tom Good afternoon, I have a program that I am writing in HTML and Javascript. Here is what I want to do. I have a menu that goes to multiple pages. When I get to a certain page, I want a variable set that when I return to the menu, I can use that variable to display a check mark. I need to keep the functionality simple, so I can't use ASP or write to cookies. I have two ideas on what to do, but none of them worked. 1) To use a .js file. I can get the .js file to hold the variable on just the page that called it, but when I go to another page and access the .js file, I lose the variable. 2) To use frames, where I pass the variable dynamically to one frame and so I can access it later. I don't know what to do. I've tried using a combo of the above ideas, but nothing has worked. Any help would be greatly appreciated. Thanks. Hey guys. Thanks in advance for help on this. I am simply (what I think should be simple) trying to carry over answers submitted by a user from one page to the other. For example, using the scripting below on my homepage, truquill.com a user would enter 'Tom Smith'. How do I carry over that information over to a whole new page - truquill.com/tenant through html? HTML Code: <form name="input" action="http://www.truquill.com/tenant.html" method="get"> First name: <input type="text" name="firstname"><br> Last name: <input type="text" name="lastname"><br> <input type="submit" value="Submit"> </form> I have looked at server sider related stuff but that was way over my head. Was hoping there might be a solution in html? Thoughts? Thanks! Very new to HTML. I have a basic "Add To Cart" button created thru PayPal's website payments standard. I want to add a 20% discount cart wide for "New Customers Only" at checkout. I have checked add variables and added discount_amount_cart=20. Still doesn't work. I have read that PayPal will not allow discounts in their shopping carts because they are not the owner of said discount. True or False?? Is this possible to do thru PayPal w/out using a third party. If not, why do they give us an option to add advanced variables. Hopefully I'm on the right track here. All help is greatly appreciated!!! This is what I have so far. The original button was set up as a "Computer Setup" service costing $60 usd, small button, encrypted, no drop down or text menus. Original code: <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="G7LXUWQLSJPBY"> <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_cart_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1"> </form> What I have created so far. Still doesn't work. <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="G7LXUWQLSJPBY"> <input type="hidden" name="add" value="1"> <input type="hidden" name="cmd" value="discount_amount_cart"> <input type="hidden" name="item_name" value="New Customer Discount"> <input type="hidden" name="currency_code" value="USD"> <input type="hidden" name="discount_amount_cart" value="20"> <input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_cart_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1"> </form> I am using a form to submit a name and password for log on. The form is using password type fields. However, once the form is submitted the results are showing in the url query string of the return page. How do I prevent this? |