Jump to content

Recommended Posts

i have a login section that i want to put in my header on every page. It has javascript which i put in the head section of the html. can i save all the javascript in an include file and make it a function and echo it in the head section? would that work? if so...should i save the file as .php or .inc or does it matter?

Link to comment
https://forums.phpfreaks.com/topic/154529-solved-include-javascript/
Share on other sites

so i would save this EXACT file as whatever.js? ive never save a .js file and don't know if i need to include anything at the top or bottom to open/close the javascript...im assuming that this is correct though

 

<script language="javascript">
function changeBox()
{
    document.getElementById('pass').style.display='none';
    document.getElementById('pass2').style.display='';
    document.getElementById('fpassword').focus();
}
function restoreBox()
{
    if(document.getElementById('fpassword').value=='')
    {
      document.getElementById('pass').style.display='';
      document.getElementById('pass2').style.display='none';
    }
}

function changeBox1()
{
    document.getElementById('user').style.display='none';
    document.getElementById('user2').style.display='';
    document.getElementById('fusername').focus();
}
function restoreBox1()
{
    if(document.getElementById('fusername').value=='')
    {
      document.getElementById('user').style.display='';
      document.getElementById('user2').style.display='none';
    }
}
</script>

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.