My Account   Contact Us    
  
» HomeProductsSupportDeveloper CommunityCompany
Set background color from a drop-down list
Author: Greg Alton
Category: PHP
This sample sets the background color in ActivEdit from a drop-down list. You can do the same with the color property to set the text color.

<?php
  require ('ActivEdit.inc');
  $ae = new ActivEdit;
  $ae->attributes["inc"]       = "/aephp/inc/index.html";
  $ae->attributes["name"]      = "aecontone";
  $ae->attributes["image"]     = "1";
  $ae->attributes["baseurl"]   = "http://localhost/";
  $ae->attributes["imageurl"]  = "/aephp/inc/images/index.html";
  $ae->attributes["imagepath"] = "/code_samples/codecfm/CodeID/40/PHP/Set_background_color_from_a_drop_down_list/c/inetpub/wwwroot/aephp/inc/images/index.html";
  $ae->attributes["upload"]    = "yes";
  $ae->attributes["tabview"]   = "true";

  $ae_control = $ae->printAE();

   //   Place the $ae_control within the form you want to use with ActivEdit
?>
<html>
<title> CFDEV.COM | ActivEdit Demo</title>

 <script>
 <!--
     function changeColor(newColor) {
     DHTMLSafe=aeObjects["aecontone"];
     DHTMLSafe.DOM.body.style.backgroundColor = newColor;
  document.all.colorPicker.selectedIndex = 0;
    }
 //-->
 </script>


<body>

<form name="test" action="/code_samples/codecfm/CodeID/40/PHP/Set_background_color_from_a_drop_down_list/save.html" method="POST">
 
 <select id="colorPicker" onChange="changeColor(this.options[this.selectedIndex].value)">
  <option>Background Color
  <option value="0000FF">Blue
  <option value="FF0000">Red
  <option value="00FF00">Green
  <option value="000000">Black
 </select>

  <? print($ae_control); ?>
  <input type="submit" value="Click To View Submission">
</form>
</body>
</html>



Content Management Powered by ActivEdit  ActivEdit Browser Based WYSIWYG HTML Editor

More Code Samples

Sign up for our newsletter: | Subscribe with RSS: RSS
© ActivSoftware 1999 to 2005 | Privacy Statement