HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Need help with forms
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
Acer



Joined: 13 Sep 2008
Posts: 1

PostPosted: Sat Sep 13, 2008 8:31 am     Need help with forms Reply with quote

Hi, I'm working on a website
http://shadowassassins2.awardspace.com/ratings.htm
and I need it so when you click a game, a rating appears in the box below. Can someone help?
Straystudio



Joined: 14 Apr 2008
Posts: 264
Location: Nord Italy

PostPosted: Sat Sep 13, 2008 12:35 pm     more option data as value Reply with quote

You may enter rating as value-Attribute's Value of each option:

<option value="which rating"></option>

Ratings will be taken by a JavaScript function triggered onChange by select
Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>rating collector</title>


<script type="text/javascript">

 function display_rating_3(){
   document.getElementById("txt01").value=document.form3.select.value;
 }             
</script>

</head>
<body>


              <form name="form3" method="post" action="">
                <label>
                <select name="select" onChange='display_rating_3();'>

                  <option selected value="10">Tales of Vesparia</option>
                  <option value="12">Tiger Woods PGA Tour 09</option>
                  <option value="9">Castle Crashers</option>
                  <option value="18">Galaga Legions</option>
                  <option value="4">Too Human</option>
                 
                </select>
                </label>
                <p class="style6">Rating:</p>
                <p class="style6">
                  <label></label>
                  <input id="txt01" name="textarea" type="text" value="10">
                </p>

              </form>


</body>
</html>


I assigned id="txt01" to the rating text-field as well, to show how it as an anywhere Element can be JS accessd by getElementById(" ")
If being inside a form as here, being form-Element and named, it can be accessed by document.form3.textarea.value

If rating changes depending on Users, You will have to manually revise them periodically.

Notice I entered the rating of the selected option as default value of the text-field, as well; to be displayed at starting.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial