Jump to content

Changing an image when clicking on a link


cerberus478

Recommended Posts

Hi

 

I'm trying to change an image when a certain link is clicked. The image is a logo of a company and the links that will be clicked is english, arabic, and Chinese.

 

So if someone clicks on Chinese then the logo changes to the Chinese version of the normal logo.

 

 

 

Here is my html

<?php
$langArabic='';
    $langChinese='';
    $langSpanish='';
    $langEng='';

    $linkArabic=getSEOLink($page_id);
    $linkChinese=getSEOLink($page_id);
    $linkSpanish=getSEOLink($page_id);
    $linkEng=getSEOLink($page_id);

    $queryLink = mysql_query("SELECT * FROM $_SEO_TABLE WHERE `id_page`='".$page_id."'");
    if(mysql_num_rows($queryLink) > 0){
        $resultLink = mysql_fetch_object($queryLink);
        if($resultLink->url != ''){
            $linkEng = $_HTTP_ADDRESS."".$resultLink->url;
            if($page_id == 1 || $page_id == '1'){
                $linkEng = $_HTTP_ADDRESS;
            }
        }
        if($resultLink->url_arabic != ''){
            $linkArabic = $_HTTP_ADDRESS."".$resultLink->url_arabic;
        }
        if($resultLink->url_chinese != ''){
            $linkChinese = $_HTTP_ADDRESS."".$resultLink->url_chinese;
        }
        if($resultLink->url_spanish != ''){
            $linkSpanish = $_HTTP_ADDRESS."".$resultLink->url_spanish;
        }
    }

    switch (urlExtension()) {
        case 'html':
            $langClass = '';
            $langEng='langActive';
            $langTag='en';
            break;
        case 'ar':
            if($page->title_arabic == ''){
                $langClass = '_arabic'; 
            }else{
                $langClass = '_arabic';
            }
            $langArabic='langActive';
            $langTag='ar';
            break;
        case 'es':
            $langClass = '';
            $langSpanish='langActive';
            $langTag='es';
            break;
        case 'cn':
            $langClass = '';
            $langChinese='langActive';
            $langTag='cn';
            break;
        default:
            $langClass = '';
            $langEng='langActive';
            $langTag='en';
    }
?>

<a class="main-logo<?php echo $langClass;?>" href="javascript:void(0);"><img src="<?php echo $_HTTP_ADDRESS;?>images/logo-letters.png" /></a>


<div class="language-selection-wrapper<?php echo $langClass;?> overlay-bg<?php echo $langClass;?> border-bottom-white<?php echo $langClass;?> padding-level-one<?php echo $langClass;?>">
                <div class="language-inner-wrapper<?php echo $langClass;?>">
                    <a class="<?php echo $langEng;?>" href="<?php echo $linkEng;?>">English</a><span>|</span>
                    <a class="<?php echo $langArabic;?>" href="<?php echo $linkArabic;?>">العربيّة</a><span>|</span>
                    <a class="<?php echo $langSpanish;?>" href="<?php echo $linkSpanish;?>">Español</a><span>|</span>
                    <a class="<?php echo $langChinese;?>" href="<?php echo $linkChinese;?>">中文</a>
                    <div class="clearboth"></div>
                </div>

 

Edited by cerberus478
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.