Created
March 20, 2012 13:20
-
-
Save h4/2135475 to your computer and use it in GitHub Desktop.
Подключение JavaScript на странице
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Подключение внешнего JS</title> | |
| <!-- | |
| Атрибут src указывает путь в файлу с javascript кодом | |
| Атрибут type в настоящее время является необязательным | |
| --> | |
| <script | |
| src="02.first-script.js" | |
| type="text/javascript"></script> | |
| </head> | |
| <body> | |
| <h1>Правильный способ подключения JS на странице</h1> | |
| <!-- | |
| Элемент script может располагаться в любом месте страницы | |
| --> | |
| <script | |
| src="03.second-script.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Этот сценарий выведет текст в модальное всплывающее окно | |
| */ | |
| alert('Скрипт работает'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| А этот сценарий выведет текст в консоль отладчика | |
| */ | |
| // Заглушка для старых браузеров | |
| if (!window.console || !console.firebug) { | |
| var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; | |
| window.console = {}; | |
| for (var i = 0; i < names.length; ++i) { | |
| window.console[names[i]] = function() {} | |
| } | |
| } | |
| console.log("И этот скрипт тоже работает"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Встроенный JS</title> | |
| <script> | |
| // JavaScript-код может быть размещён внутри блока script | |
| document.write("Вывод текста прямо в браузер"); | |
| </script> | |
| </head> | |
| <body> | |
| <h1>Допустимый способ подключения JS на странице</h1> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Обработчик события JS</title> | |
| </head> | |
| <body onload="alert('Страница загружена');"> | |
| <h1>Нежелательный способ подключения JS на странице</h1> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Обработчик события JS</title> | |
| </head> | |
| <body> | |
| <h1>Недопустимый способ подключения JS на странице</h1> | |
| <p><a href="javascript:alert('Ну кто так делает, а?');">Давай, щелкай</a></p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local savedPosition = nil
local flying = false
-- GUI
local gui = Instance.new("ScreenGui")
gui.Parent = player:WaitForChild("PlayerGui")
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0,200,0,150)
frame.Position = UDim2.new(0.1,0,0.2,0)
frame.BackgroundColor3 = Color3.fromRGB(25,25,25)
frame.Active = true
frame.Draggable = true
frame.Parent = gui
local title = Instance.new("TextLabel")
title.Text = "Erik Hub"
title.Size = UDim2.new(1,0,0,30)
title.BackgroundColor3 = Color3.fromRGB(40,40,40)
title.TextColor3 = Color3.new(1,1,1)
title.Parent = frame
-- Botón TP1 (guardar posición)
local tp1 = Instance.new("TextButton")
tp1.Text = "TP1"
tp1.Size = UDim2.new(0.5,0,0,40)
tp1.Position = UDim2.new(0,0,0.3,0)
tp1.Parent = frame
-- Botón TP2 (teleport)
local tp2 = Instance.new("TextButton")
tp2.Text = "TP2"
tp2.Size = UDim2.new(0.5,0,0,40)
tp2.Position = UDim2.new(0.5,0,0.3,0)
tp2.Parent = frame
-- Botón FLI (volar)
local fli = Instance.new("TextButton")
fli.Text = "FLI"
fli.Size = UDim2.new(1,0,0,40)
fli.Position = UDim2.new(0,0,0.7,0)
fli.Parent = frame
-- Guardar posición
tp1.MouseButton1Click:Connect(function()
local char = player.Character
if char and char:FindFirstChild("HumanoidRootPart") then
savedPosition = char.HumanoidRootPart.Position
end
end)
-- Teleport a posición guardada
tp2.MouseButton1Click:Connect(function()
local char = player.Character
if savedPosition and char and char:FindFirstChild("HumanoidRootPart") then
char.HumanoidRootPart.CFrame = CFrame.new(savedPosition)
end
end)
-- Sistema de vuelo simple
fli.MouseButton1Click:Connect(function()
local char = player.Character
if not char then return end
local hrp = char:FindFirstChild("HumanoidRootPart")
end)