473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Output Form Dropdown to HTML Page

Hello,

For a roleplaying fansite I am trying to give visitors a convenient way to make people add items to their game. They need to enter hexcodes for items and I'd like to help with the task.

What i have now is a list that is basically like this:

Expand|Select|Wrap|Line Numbers
  1. <h2>Create Item Links</h2>
  2. <form name="frmSelect">
  3. <select id="Location" name="Location">
  4. <option value="player.placeatme">Place at Player</option>
  5. <option value="player.additem">Place in Inventory</option>
  6. </select>
  7. <select id="Item-ID" name="Item-ID">
  8. <option value="43e1e">Alessandra's Dagger</option>
  9. <option value="79b1d">Blade of Sacrifice</option>
  10. </select>
  11. <select id="Amount" name="Amount">
  12. <option value="1">1</option>
  13. <option value="2">2</option>
  14. </select>
  15. </form>
  16. Use this code in Skyrim's Console to receive the Item:
  17.  
  18. player.additem 431e1 1
  19.  
Selecting the first options should give the bolded output. What I have so far is:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function get_skcommand()
  3. {
  4. var skcommand = document.getElementById('location').value + document.getElementById('itemid').value + document.getElementById('amount').value;
  5. }
  6. </script>
  7.  
How can I get the skcommand output to a page and dynamically update it if I change selections?

Thanks in advance.

Michael
Nov 17 '11 #1

✓ answered by Dormilich

there are several methods to output a value:
- into a form field:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" id="display" size="7" readonly>
  2.  
  3. // change value
  4. document.getElementById("display").value = "something to display";
- into an other element
Expand|Select|Wrap|Line Numbers
  1. <p id="display"></p>
  2.  
  3. // change value
  4. document.getElementById("display").innerHTML = "something to display";
to update the value you just need to call the calculating/outputting function when this event (e.g. the change event) on one of the selection occurs.

Expand|Select|Wrap|Line Numbers
  1. // using event listeners
  2. function helpUser(evt)
  3. {
  4.     // calculate value …
  5.     // output value …
  6. }
  7. // select being the <select> element (define beforehand)
  8. // repeat for every select element 
  9. // works in all browsers except IE < 9
  10. select.addEventListener("change", helpUser, true);

2 2889
Dormilich
8,658 Expert Mod 8TB
there are several methods to output a value:
- into a form field:
Expand|Select|Wrap|Line Numbers
  1. <input type="text" id="display" size="7" readonly>
  2.  
  3. // change value
  4. document.getElementById("display").value = "something to display";
- into an other element
Expand|Select|Wrap|Line Numbers
  1. <p id="display"></p>
  2.  
  3. // change value
  4. document.getElementById("display").innerHTML = "something to display";
to update the value you just need to call the calculating/outputting function when this event (e.g. the change event) on one of the selection occurs.

Expand|Select|Wrap|Line Numbers
  1. // using event listeners
  2. function helpUser(evt)
  3. {
  4.     // calculate value …
  5.     // output value …
  6. }
  7. // select being the <select> element (define beforehand)
  8. // repeat for every select element 
  9. // works in all browsers except IE < 9
  10. select.addEventListener("change", helpUser, true);
Nov 17 '11 #2
Thanks a lot, I went for solution 2 and it worked!

Expand|Select|Wrap|Line Numbers
  1. <select id="location" name="location" onchange='get_skcommand();'>
and by adding

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("display").innerHTML = "something to display";
  2.  
to the script above.

You will be able to see the script in action here:

http://skyrim.mmo-game.eu/skyrim-item-link-creator/

Thanks!
Nov 17 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Michael Levin | last post by:
I've got the following problem. I'm a biologist and I have a device at work which monitors my frog habitat. The device has a bunch of sensors, and runs an embedded html server with some java...
1
by: Priya | last post by:
Hi, I'm new to ASP.NET. I've some basic ques. In what situations we use aspx page when DHTML can be used? How can I interact between an aspx page & html page eg: using Request . Form i get the...
2
by: Bob Sanderson | last post by:
I have a search form from which I hope to be able to select a record by field JobNumber and display it with an output form titled test.php <html> <head> <title>Job Database Search</title>...
3
by: GoldenEagle | last post by:
Hello, Please i wanna know how to send data of a form made by flash to html page inorder to handel the values sent by the that form and so how to send these data to a mail? Thanks in advance..
1
by: gpo | last post by:
I've done a form validation and I want to submit the form details output into the HTML page,so that I can view the details. How can you doing it using innerHTML here's the form code. <form ...
2
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. ...
3
by: saravanancse | last post by:
Can Any One Help Me....... How to display a Windows Form into Html page? I used Html Syntax <a href="that vb file name">file</a> But its shows only a coding,its doesn't show...
7
by: cartercc | last post by:
I think I already know the answer to this one, but I'm giving it the old college try. My problem is this: I have an HTML form that sends a bunch of data to a Perl script, where it is validated...
3
by: mott3510 | last post by:
I currently have some text that I have being output to a html page, but the background of the page is just white. I would like to make the background a different color on the html page. I assume that...
5
by: BobQuinn | last post by:
I have a problem that seems like it should be easy, yet I don't quite have the answer. I have an html page with a number of textboxes for input. When the user clicks a button, a javascript routine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.