Hi All,

Im not very good with javascript and im trying to figure out how to use if and getElementById to change the contents of a link in order to point to different pages depending on if the browser detected is pc or mobile. If PC i want to launch it in an iframe using fancybox, and if its mobile, i just want to link directly to the page (ie, i dont just want to change the href, but other parts of the link also). Here's what i have so far:

<script type="text/javascript">
function mobileversion() {
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    document.getElementById('mobilev1').a="'class="fancybox fancybox.iframe" data-color="#F9F9F9" data-width="980" data-height="1230" data-scrolling="no"  href="linkformobiles.html" data-fancybox-group="gallery-1"'
else {


    <a id="mobilev1">Click here to see the page for your browser type</a>
Does anybody know how to go about this?

Many thanks in advance for any help.