Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2009
    Location
    Norway, Europe
    Posts
    94
    Thanks
    12
    Thanked 2 Times in 2 Posts

    PHP vs JavaScript for HTML inputs

    So.. I'm just wondering if.. for example if I'm not sure of the name of a site, and I create a new document which I'll redirect to every time I say the name (don't comment on this part, it's just an example )

    BUT the point is:

    Should I use JavaScript:
    Code:
    <html>
    <head>
    </head>
    <body>
    Welcome to <script type="text/javascript" src="../scripts/sitename.js"></script>. Hope you have a nice time here!
    and then have a JS code of:

    Code:
    {
    document.write("<b>CurrentSiteName</b>")
    }
    or use PHP to input it (if so, where is a tutorial on just that part?)

    and will one/both work in, for example, <title></title>?
    Always Use a DOCTYPE!
    Always Use * {margin: 0; border: none; padding: 0;} in the top of your CSS stylesheet.
    Always Use only CSS for layout; never (X)HTML.
    Always Have fun while coding!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Can't see where it makes any difference in the final result.

    Now, if you are ONLY going to need to use PHP for this one purpose, then clearly the JS answer will save on server resources. But in terms of results...<shrug>either</shrug>.


  •  

    Posting Permissions

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