Results 1 to 10 of 10

Thread: I'm looking for a code

  1. #1
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I'm looking for a code

    Hello! all I have a website I'm looking for a code but I found nothing that could do it I'm not an expert but I'm doing a little bit.

    I will explain one I can three links to diferent language such index.php? set_language = default and with two others over and I have a big image that are connected to a . css file like this who are the <div id="content_01">.

    I am looking for a code that will change when I click on one of three languages ​​that'm worm picture on the link to the English language that image changes to English and if I click on the French language as image changes to Image French

    but I'll link to better understand

    I have 3 links its this

    <a href="{url_page}?set_language=default"> src="{url_tmpl_main}img_1/lang1.gif" <img alt="" /> </ a>
    <a href="{url_page}?set_language=spain"> src="{url_tmpl_main}img_1/lang2.gif" <img alt="" /> </ a>
    <a href="{url_page}?set_language=french"> src="{url_tmpl_main}img_1/lang3.gif" <img alt="" /> </ a>


    and for three of my index page picture her like this


    <div id="content_01"> first image of the index page
    <div id="content_02">
    <div id="content_03">

    and two other image that his link to my css file that I would change when I click on a link language to image the same language that I chose.

    Its two days that I'm looking and I need your help.

    Thank you in advance
    Last edited by jscheuer1; 07-01-2012 at 06:02 AM. Reason: remove extraneous link

  2. #2
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    So youre saying, tha when you click the link for the different language, the image will change?
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  3. #3
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yes it's her when someone will click on the picture will change language ver another image that would be in English and if someone else clicks another language will change another image worm another image of that language,

    Thank you for your help

  4. #4
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Here's some JavaScript which will change the src in the img tag, so:
    Code:
    function changeMySrc(i) {
    if (i == 1) {
    document.getElementById("Img1").src="Images/folder_open.gif";
    document.getElementById("Img2").src="Images/folder.gif";
    } else if (i == 2) {
    document.getElementById("Img2").src="Images/folder_open.gif";
    document.getElementById("Img1").src="Images/folder.gif";
    }
    }
    Then just reference the function in the link that you want to click using an onclick event.
    Last edited by bernie1227; 07-02-2012 at 07:10 AM. Reason: Darn stars
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  5. #5
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much for your help

  6. #6
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello! I am doing the test the way I do it's still not working I'm going to put my code back here and tell me if this is correct or not.

    Thank you again for your help

  7. #7
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello I made the test, but I always arrive at the same result when I click on my picture of the language but the link I and link worm picture but its not working is least if it was me who I'm doing it wrong 'm not an expert I can get a can here is the code I made a mistake when he told me how and I will do.


    I but my link to my site and understanding the code above

    http://www.citasyamigos.com/


    <script>
    function changeMySrc(i) {
    if (i == 1) {
    document.getElementById("http://www.citasyamigos.com/index.php").src="imagelangues/content-bg.jpg";
    document.getElementById("http://www.citasyamigos.com/index.php?set_language=default").src="imagelangues/content-bg.jpg";

    } else if (i == 2) {
    document.getElementById("http://www.citasyamigos.com/index.php").src="imagelangues/encontent-bg.jpg";
    document.getElementById("http://www.citasyamigos.com/index.php?set_language=default").src="imagelangues/encontent-bg.jpg";

    }
    }

    </script>



    thank you again for your support

  8. #8
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    On the images you want to change, (if there isn't already) add id="someIdHere"

    Replace someIdHere with a value unique to each image.

    For instance

    Code:
    <img src="elephant.png" alt="Elephant" id="elephantImage" />
    Then, in the code bernie gave you, change Img1 and Img2 to the id's of your two images. and the src attribute, should be the path to the images.

    THen, make your links look like this -
    Code:
    <a href="pathToSomething" onclick="changeMySrc('1');"></a>

  9. #9
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by keyboard1333 View Post
    On the images you want to change, (if there isn't already) add id="someIdHere"

    Replace someIdHere with a value unique to each image.

    For instance

    Code:
    <img src="elephant.png" alt="Elephant" id="elephantImage" />
    Then, in the code bernie gave you, change Img1 and Img2 to the id's of your two images. and the src attribute, should be the path to the images.

    THen, make your links look like this -
    Code:
    <a href="pathToSomething" onclick="changeMySrc('1');"></a>
    Oh yeah, sorry about that, didn't explain that well enough.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  10. #10
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ok Thanks for your help I'll go try it I do not understand all my I think I will succeed with what you wrote me and said I'll be able.

    Thank you again for your support

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •