Jump to content
  • 0

Kак подключить java-script из внешнего файла


RANCID
 Share

Question

к примеру хочу подключить cкрипт к примеру вот эти часы!как сделать?

<html>

<head>

<title>Clock</title>

<script language="JavaScript">

function clock_form()

{

day=new Date()

clock_f=day.getHours()+":"+day.getMinutes()+":"+day.getSeconds()

document.form.f_clock.value=clock_f

id=setTimeout("clock_form()",100)

}

</script>

</head>

<body bgcolor="ffffff" onLoad="clock_form()">

<center>

<form name=form metod="get">

<input name=f_clock maxlength=8 size=8>

</form>

</center>

</body>

</html>

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
А вот так не пробывал?

<script type="text/javascript" src="script.js"></script>

ну вот это я засунул в head,cоздал файл с .js и часиков не вижу,вон сверху код написал,что надо записать в внешний файл а что оставить?

Link to comment
Share on other sites

  • 0

Все отлично работает.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru" lang="ru">
<head>
<title>Мой сайт</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="reset.css" />
<script type="text/javascript" src="clock.js"></script>
</head>
<body onLoad="clock_form()">
<form name="form" metod="get">
<input name="f_clock" maxlength="8" size="8">
</form>
</body>
</html>

function clock_form() {
day=new Date()
clock_f=day.getHours()+":"+day.getMinutes()+":"+day.getSeconds()
document.form.f_clock.value=clock_f
id=setTimeout("clock_form()",100)
}

Edited by pyJee
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

 Share

×
×
  • 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. See more about our Guidelines and Privacy Policy