For example, if in php i printed this:
<script type="text/javascript">
txt = "<p>Browser Name: " + navigator.appName + "</p>";
document.getElementById("example").innerHTML=txt;
</script>
and used a variable, lets say $bname then used an if() statement, could i change the value of an element such as a link <a> etc. to whatever i wanted? alternatively is there a way in jQuery/JavaScript?
You can easily achieve this on jQuery. Using jQuery.browser as easy as this example.