Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending form values w/o submit button 1

Status
Not open for further replies.

Ssanai80

IS-IT--Management
Jun 28, 2001
21
US
I don't know if this can be done with javascript, but it's worth a try.
I'm making a webpage where a person can customize the look of the website(fonts/bgcolor/linkcolor..etc) by filling out the form field(for example..inputting the hex code for bgcolor). but i also want to have color scheme/template made so that they can click on a scheme on a dragdown button and the values of the form fields on the same page change to reflect the scheme. is this possible? I don't have to use the dragdown button...wutever else works..radio button..etc.
thank you for the help in advance.
 
Yes, it's entirely possible!
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Sorry about the short answer, but I was rushed at the time. I did answer your question though! :) Here's an example of how it's done. Try it out and see how it works:
Code:
<html>
<head>
<title></title>
<script language=&quot;javascript&quot;>
function setvals() {
   var which = document.myform.dropdown.selectedIndex;
   if ( document.myform.dropdown(which).value == 1 ) {
      document.myform.color.value = &quot;ffffff&quot;;
      document.myform.bgcolor.value = &quot;000000&quot;;
   } else if ( document.myform.dropdown(which).value == 2 ) {
      document.myform.color.value = &quot;red&quot;;
      document.myform.bgcolor.value = &quot;yellow&quot;;
   } else if ( document.myform.dropdown(which).value == 3 ) {
      document.myform.color.value = &quot;white&quot;;
      document.myform.bgcolor.value = &quot;blue&quot;;
   } else {
      document.myform.color.value = &quot;&quot;;
      document.myform.bgcolor.value = &quot;&quot;;
   }
}
</script>
</head>
<body>
<form name=&quot;myform&quot;>
<select name=&quot;dropdown&quot; onChange=&quot;setvals()&quot;>
   <option value=&quot;0&quot;>-- Themes --</option>
   <option value=&quot;1&quot;>Theme 1</option>
   <option value=&quot;2&quot;>Theme 2</option>
   <option value=&quot;3&quot;>Theme 3</option>
</select><br>
<input type=&quot;text&quot; name=&quot;color&quot;><br>
<input type=&quot;text&quot; name=&quot;bgcolor&quot;><br>
<input type=&quot;submit&quot; value=&quot;submit&quot;>
</body>
</html>
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
vituz: thanks for spotting that! It worked without it, but it SHOULD have been there.

Ssanai80: You're quite welcome!
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top