What this code do?
#1

Код:
<html><head><meta charset="UTF-8">	<script>function check()	{		var parts = document.domain.split('.');	 if(!isNaN(parts[0])) {window.location.href='samp://samp.anyserverip.lt:7777';}ele{	var sndleveldomain = parts.slice(-2).join('.');		sndleveldomain = 'http://' + sndleveldomain;		window.location.replace(sndleveldomain);}			}	</script></head><body on‌load="check()"></body></html>
Reply
#2

nothing because ele is not a keyword
Reply
#3

It won't work properly because of the syntax error. (Else instead of ele)

It checks if the sitename(Eg. www.******.com) is number or alphabets.
if its a number/IP, It will launch the samp client application and make the user join the server. Otherwise it will make the user browse the website normally.
Reply
#4

But is there any more mistakes, without that ele?
Reply
#5

Why not just check it yourself?
Reply
#6

Yes i checked, but maybe there is a little mistake i have to fix or replace function maybe it's outdated or not safe
Reply
#7

Step one:

format your code:
Код:
<html>
<head>
<meta charset="UTF-8">
  <script>
    function check()
    {
      var parts = document.domain.split('.');
      if(!isNaN(parts[0]))
      {
        window.location.href='samp://samp.anyserverip.lt:7777'; // connects to the the samp server with specified address
      }
      else // was ele
      { // address is _likely_ an ip
        var sndleveldomain = parts.slice(-2).join('.'); // take the last the last two bytes and join them by a dot. e.g. 12.34.23.14 will become 23.14
        sndleveldomain = 'http://' + sndleveldomain; // prepend http:// to half the ip
        window.location.replace(sndleveldomain); // ??? profit ???
      }
  }
  </script>
</head>
<body on‌load="check()"></body>
</html>
Guest twice where the error is.
Reply
#8

Don't reply to this guy. He makes a topic for every single thing and when people help him, he doesn't even give a thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)