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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation How to make a configuration page?

    Hello, first, I'm new here and I hope you can help me

    The problem is that I'm making a script and I need to have the information of a website on the script which is in a different document.

    The code of the website is similar to this:
    Code:
    <html>
    <head>
    <script type="text/javascript">
    var name = prompt("Put here your name");
    var surname = prompt("Put here your surname");
    </script>
    </head>
    <body>
    </body>
    </html>
    But I want to give the value of the name and surname to the vars of another script:
    Code:
    var name = "What I have to put here to get the info of the web?";
    	var surname = "What I have to put here to get the info of the web?";
    	
    		document.getElementById("name").value = name;
    		document.getElementById("surname").value = surname;
    		document.getElementById("loginbutton").click();

    Help please!

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,303
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Philip M View Post
    JavaScript is purely a client-side language, and unless used with an Ajax call has no capability to read from or write to a file (except a cookie), communicate with the server, access a database, the client's operating system or the Windows registry, or alter the default behaviour of the browser. And for security reasons JavaScript cannot access anything beyond the domain of the current page. This is known as the "same origin policy" and prevents a document or script loaded from one origin from getting or setting properties of a document from a different origin.


    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
    So how can I do to make the prompts only in one web page?
    For example, I want to get prompts on www.myname.com but not in the others sites.
    How can I do?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,303
    Thanks
    203
    Thanked 2,562 Times in 2,540 Posts
    I don't really understand you, but JavaScript is not the answer. You need to use server-side scripting.


  •  

    Posting Permissions

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