Click here to Skip to main content
15,885,278 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
QuestionFedora not recognizing wireless router Pin
AmbiguousName7-Aug-10 1:12
AmbiguousName7-Aug-10 1:12 
QuestionTime Zone Conversion PHP [modified] Pin
DinoRondelly5-Aug-10 8:56
DinoRondelly5-Aug-10 8:56 
AnswerRe: Time Zone Conversion PHP [modified] Pin
Peter_in_27805-Aug-10 13:56
professionalPeter_in_27805-Aug-10 13:56 
AnswerRe: Time Zone Conversion PHP Pin
sonam_12325-Aug-10 10:35
sonam_12325-Aug-10 10:35 
QuestionCompiling MD5 on linux shell Pin
xivShin2-Aug-10 2:20
xivShin2-Aug-10 2:20 
AnswerRe: Compiling MD5 on linux shell Pin
markkuk2-Aug-10 2:57
markkuk2-Aug-10 2:57 
QuestionAuto Change Selection in Combo Box Pin
ChrisMaile30-Jul-10 6:17
ChrisMaile30-Jul-10 6:17 
AnswerRe: Auto Change Selection in Combo Box [modified] Pin
enhzflep30-Jul-10 16:26
enhzflep30-Jul-10 16:26 
Sure, you can use the onChange event of the combos to trigger some script.

I'd initially thought you'd have to use ajax, though now I'm not so sure.

If you only want to use the fonts on the client machines, you could use something like this:

<html>
<head>
<script type="text/javascript">
function byId(e){return document.getElementById(e);}
function setFont()
{
	var tgt;
	                 
			 tgt = byId("output");
	       tgt.innerHTML = byId("textInput").value;
	tgt.style.fontFamily = byId("fontCombo").value;
	  tgt.style.fontSize = byId("sizeCombo").value;
	     tgt.style.color = byId("colCombo").value;
}
</script>
<style>
body { background-image: url(darkbg2.jpg);}
</style>
</head>
<body onLoad="setFont();">

<select id="colCombo" onChange="setFont();">
	<option value="#000000">Black</option>
	<option value="#FF0000">Red</option>
	<option value="#00FF00">Green</option>
	<option value="#0000FF">Blue</option>
	<option value="#FFFFFF">White</option>
</select>
	
<select id="sizeCombo" onChange="setFont();">
	<option value="5mm">5mm</option>
	<option value="1cm">10mm</option>
	<option value="15mm">15mm</option>
	<option value="2cm">20mm</option>
	<option value="1in">25mm</option>
	<option value="3cm">30mm</option>
</select>
	
<select id="fontCombo" onChange="setFont();">
	<option value="arial">Arial</option>
	<option value="courier">Courier</option>
	<option value="impact">Impact</option>
	<option value="tahoma">Tahoma</option>
	<option value="wingdings">Wing Dings</option>
</select>

<br>

<input type="text" id="textInput" size=33 value="Enter text here.." onKeyUp="setFont();" onChange="setFont();"/>

<div id="output"></div>

</body>
</html>


Though, since you use an image in your implementation this may be unsuitable. In that instance, I'd just
use an image and give it an id. Then, in the setFont function you can just do something like:

url = "http://www.sew-n-print.co.uk/render/font.php"
url += "?text="+byId("textInput").value; 
url += "&font="+byId("fontCombo").value;
url += "&color="+byId("colCombo").value;
url += "&size="+byId("sizeCombo").value;
url += "&vadj=50&hadj=25";
byId("myImgId").src = url; 

I think that'll work.

<edit>
Yup, that works. Interesting (yet understandable) to see the lag for the image-based text.

Just make sure to remove the units from the size combo box, also the hashes from the colours.
Apologies for the total lack of formatting of the example code output.
</edit>

modified on Saturday, July 31, 2010 7:44 AM

QuestionMYSQL connect through PHP Pin
offroaderdan30-Jul-10 0:23
offroaderdan30-Jul-10 0:23 
AnswerRe: MYSQL connect through PHP Pin
Graham Breach30-Jul-10 21:40
Graham Breach30-Jul-10 21:40 
AnswerRe: MYSQL connect through PHP Pin
Shamit Kumar Tomar9-Aug-10 18:28
Shamit Kumar Tomar9-Aug-10 18:28 
AnswerRe: MYSQL connect through PHP Pin
Rockyonfire15-Aug-10 11:48
Rockyonfire15-Aug-10 11:48 
QuestionHow to display the image in html Pin
sarang_k26-Jul-10 20:52
sarang_k26-Jul-10 20:52 
AnswerRe: How to display the image in html Pin
Peace ON27-Jul-10 0:45
Peace ON27-Jul-10 0:45 
AnswerRe: How to display the image in html Pin
bishtharish27-Jul-10 23:09
bishtharish27-Jul-10 23:09 
QuestionHow to convert from pdf to doc in php Pin
sarang_k26-Jul-10 18:52
sarang_k26-Jul-10 18:52 
QuestionPostmaster Redirect - Mailsystem Failure Delivery Pin
Jayapal Chandran26-Jul-10 7:59
Jayapal Chandran26-Jul-10 7:59 
Questionchoosing a opensource cart Pin
duta25-Jul-10 5:06
duta25-Jul-10 5:06 
QuestionHow to embedded the image in doc using php Pin
sarang_k23-Jul-10 1:04
sarang_k23-Jul-10 1:04 
AnswerRe: How to embedded the image in doc using php [modified] Pin
enhzflep24-Jul-10 21:17
enhzflep24-Jul-10 21:17 
GeneralRe: How to embedded the image in doc using php Pin
sarang_k26-Jul-10 20:57
sarang_k26-Jul-10 20:57 
GeneralRe: How to embedded the image in doc using php Pin
enhzflep27-Jul-10 12:34
enhzflep27-Jul-10 12:34 
QuestionExporting data to a doc file in php Pin
sarang_k22-Jul-10 21:21
sarang_k22-Jul-10 21:21 
AnswerRe: Exporting data to a doc file in php Pin
senorbadger18-Aug-10 3:38
senorbadger18-Aug-10 3:38 
QuestionDisplaying entire row into different text boxes Pin
rashmin8820-Jul-10 5:30
rashmin8820-Jul-10 5:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.