Welcome to Welcome to DNF.com™ - Domain Sales, Domain Forum, Domain Appraisals, Domain Registrars

If you are new to domains and looking to buy, sell and learn about domains then you have come to the right place. DNForum is the largest domain name community on the internet and continues to grow every day. There are over 105,000 domainers on DNForum doing everything from buying domains, selling domains, learning about domains and discussing domains. Take a minute and Register.

Register Today on DNForum IT'S FREE!

Results 1 to 4 of 4
  1. #1
    Platinum Lifetime Member
    rawkinrich's Avatar
    Join Date
    May 2004
    Location
    Sheffield
    Posts
    3,036
    Country

    England Follow rawkinrich On Twitter Add rawkinrich on Facebook
    DNF$
    1,407
    Bank
    0
    Total DNF$
    1,407
    Donate  

    JavaScript to PHP.. Can you help this code conversion?

    Hi all,

    How can you write the following in PHP?

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    //document.write('Your settings are ' + screen.width + ' x ' + screen.height + '');
    if (screen.width == 640) {
    document.write('<img src="/images/footer-left800.gif" width="78" height="18" border="0" alt="Main Man Kennels">');
    }
    if (screen.width == 800) {
    document.write('<img src="/images/footer-left800.gif" width="78" height="18" border="0" alt="Main Man Kennels">');
    }
    if (screen.width == 1024) {
    document.write('<img src="/images/footer-left.gif" width="88" height="20" border="0" alt="Main Man Kennels">');
    }
    if (screen.width == 1280) {
    document.write('<img src="/images/footer-left.gif" width="88" height="20" border="0" alt="Main Man Kennels">');
    }
    if (screen.width == 1600) {
    document.write('<img src="/images/footer-left.gif" width="88" height="20" border="0" alt="Main Man Kennels">');
    }
    // End -->
    </script>

    I want spiders etc to be able to see the image, and the browser to determine screen resolution.

    Richard

  2. #2
    www.LOL.biz
    Bender's Avatar
    Join Date
    Apr 2004
    Location
    .ro
    Posts
    1,912
    DNF$
    6,243
    Bank
    0
    Total DNF$
    6,243
    Donate  

    Re: JavaScript to PHP.. Can you help this code conversion?

    unfortunatelly PHP cannot determine the screen width without JavaScript.
    why all those "IF" 's ?- seems to me that you have only 2 images to swap-you can ignore the 640*800 users(or make a special page for them), they are under 9% and because of them a code gets executed on every page view...

  3. #3
    The Bishop
    namestrands's Avatar
    Join Date
    Jan 2005
    Location
    Langley, VA
    Posts
    4,053
    DNF$
    3,312
    Bank
    0
    Total DNF$
    3,312
    Donate  

    Re: JavaScript to PHP.. Can you help this code conversion?

    You could however use the javascript code in a dynamic include that you could feed to the page depending on if it was a Bot or a Browser Visiting.
    Enterprise Communications and Social Media in Uist

  4. #4
    Platinum Lifetime Member
    csmaster2005's Avatar
    Join Date
    Jul 2004
    Location
    United States
    Posts
    456
    DNF$
    1,840
    Bank
    0
    Total DNF$
    1,840
    Donate  

    Re: JavaScript to PHP.. Can you help this code conversion?

    java script is made to be a user side scripting language, while php is made to be server side. PHP has very limited access to any of the users information, thus you can not really incorporate both into 1 system, unless it's basic coding.
    Tyler Cruz schooled me in BW, so he won this until May 23rd, 2011 TylerCruz

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
  •  

Domain name forum recommended by Domaining.com