Web Hosting Talk







View Full Version : Can you assign an image to appear when you select from drop down? Like sample fonts


frogee
02-06-2009, 05:01 PM
We would like a font that changes the text to show you the sample font that you have selected. Example: http://www.leavesandletters.com/product_info.php?cPath=21_25&products_id=443 or http://www.leavesandletters.com/product_info.php?cPath=21_25&products_id=46
Please choose different fonts from the drop down menus in order to see the sample font change. Would it be possible to have whatever text that the customer types in the name/monogram field to show the sample fonts in the typed text? Does that make sense? Basically, if I typed in Jonathan McKenzie in the name field and then chose a font from the drop down menu….I would see “Jonathan McKenzie” in the font that I selected. If I then chose a different font from the drop down menu…it would then show “Jonathan McKenzie” in a different font.
If that is not possible…then I guess we will go with the way the above site (www.leavesandletters.com) has it....any idea how to do that? It simply calls an image for each font that is selected from a drop down menu.
I am no coder....so I am sure it is MUCH harder than I make it sound. But it seems that you could edit the php page that contains the attributes for the products and assign an image to each font choice in the drop down menu. So when a user selects a font from the drop down menu, the code would call the image and it would appear on the page. Any ideas? THANKS!

Angry Vulcan
02-13-2009, 09:52 PM
<input type="text" style="font-size:20px" id="sample" />
<br />
<select name="font" onchange="updateFont(this.value)">
<option value="">Select a font</option>
<option value="arial">Arial</option>
<option value="calibri">Calibri</option>
<option value="Castellar">Castellar</option>
</select>
<script type="text/javascript">
function updateFont(value)
{
document.getElementById('sample').style.fontFamily = value;
}
</script>