hi im new to PHP .. i want a script were i can change the text dynamically when the page is live from (Arial to Times) something like that.. can any one pls help me in dis.. or can anyone pls provide a script for dis..???
+1
A:
<?php
$font = "courier";
if(isset($_GET['font'])){
$font = $_GET['font'];
}
?>
<a href="?font=arial">Arial</a> |
<a href="?font=times">Times</a>
<div style="font-family: <?php echo $font; ?>">
the quick brown fox jumped over a lazy dog.
</div>
... although this might be a job for javascript, in some folks' opinion.
echo
2010-01-16 06:43:42
thank u but when i click arial or times its nt working... mean the font is not changing.. wt i should do now.. any modifications .. any sugessiongs pls
Patel
2010-01-16 06:49:48
oh weird... it works in firefox for me. you should get the general idea though, right?
echo
2010-01-16 06:51:10
thank u very much... this the result i was expecting.. once again thanks for providing such a good script..
Patel
2010-01-16 06:53:25
Can u pls explain y ve u mentioned this line $font = "courier"; wts the use of this..
Patel
2010-01-16 06:56:46
Easiest 15 rep ever.
Ignacio Vazquez-Abrams
2010-01-16 07:00:54
just a default value; if they don't click a font, it defaults to courier.
echo
2010-01-16 07:01:08
oh thank u.. then we can set it to any font..
Patel
2010-01-16 07:02:33
hi everyone, i want to create a page by using PHP in such a way that page should contains a few color change options and themes by selecting those colors or themes it should refelect in the same page. can anyone pls help me by giving sugessins or proving a script for that..
Patel
2010-01-16 07:11:49
A:
You could also do this with JavaScript
<html>
<head>
<title>change font test</title>
</head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$(".changeFontArial").click(function () {
$("body").css("font-family", "arial");
return false;
});
$(".changeFontTimes").click(function () {
$("body").css("font-family", "Times New Roman");
return false;
});
});
</script>
<body>
<p class="changeFontArial">
Change to Arial</p>
<p class="changeFontTimes">
Change to Times</p>
</body>
</html>
Jason Rowe
2010-01-16 07:09:03
http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js if u change the path of this then will the script runs normally... and one more can u pls explain brifely y u ve used that line(javascript).. is it so necessary
Patel
2010-01-16 07:17:38
I used the JQuery JavaScript library it can be hosted via googleapis as I have shown it.
Jason Rowe
2010-01-16 07:21:23
ok thank u.. But Can i implement ur code in a page so that if i clink the ARIAL or Times will the whole content of the page will get change or any modifications i ve to do for that..
Patel
2010-01-16 07:26:28
if i ve used few tables in a page and in each <td> there are contnets if i want to change all the <td> contents at a time when i click Arial ro Times then how to implement this script.
Patel
2010-01-16 07:35:24