Примеры использования
Java
и
GGI
скриптов
Рассмотрим два простейших вида программирования: применение 1.CGI-скриптов и 2. JAVA-скриптов.
1. CGI-скрипты
на странице это комманды посетителя сайта программе, размещенной на сервере, выполнить определенные действия: занести в гостевую книгу, искать по серверу, обработать форму для отправки сообщений.
Применение их разрешено не на всех серверах, а в основном на платных. Создавать скрипты самому сейчас необходимости нет, можно скопировать, например из сайта www.cgi-resources.
Пример формы:
Начало формы
Начало формы
Впишите свой адрес: |
Подписаться: |
Конец формы
Код
формы
:
<FORM action=kulichki.rambler/cgi-bin/cgiwrap/listserv/subscribe.pl method=get> <TABLE bgColor=#F3FEFF border=0 cellSpacing=4 width=250> <TBODY> <TR align=middle> <TD>Впишите свой адрес: <INPUT name=email> <INPUT type=submit value=Отправить!> </TD> <TD>Подписаться: <INPUT CHECKED name=action type=radio value=subscribe> </TD></TR></TBODY></TABLE></FORM></TD>
Как видно, форма начинается меткой FORM
. Метка АCTION
-указывает на путь к обработчику формы (там где находится исполняемый файл-скрипт), METHOD
-метод протокола передачи гипертекстов: METHOD=POST и METHOD=GET, по умолчанию предполагается METHOD=GET.
<INPUT>
-элемент ввода данных, input type=sybmit - кнопка с надписью отправить и действием подписаться при нажатии
<INPUT CHECKED name=action type=radio value=subscribe>- при нажатии на значек кнопки подтверждается желание подписаться (следите за логикой: ввод помеченной кнопки=подписка) .
Форма может содержать CHECKBOX- квадратик, куда можно ставить галочку, HIDEN- cкрытые элементы и др. Самый простой метод создать форму: скачать готовую и подогнать ее под свои потребности. Базисные знания у вас уже есть.
2. JAVA-cкрипты
тоже лучше изучать на примерах.
а) Меняющаяся кнопка при нажатии.
Код
:
<SCRIPT LANGUAGE="JavaScript">
browser_name = navigator.appName;
browser_version = parseFloat(navigator.appVersion);
if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
else { roll = 'false'; }
function over(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
function out(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
if (roll == 'true')
{
a1=new Image;a1.src="../menue/news_an.jpg";
a2=new Image;a2.src="../menue/news_aus.jpg";
}
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
1 browser_name = navigator.appName;
2 browser_version = parseFloat(navigator.appVersion);
3 if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
3 else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
4 else { roll = 'false'; }
5 function over(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
6 function out(img,ref) { if (roll == 'true') { document.images[img].src = ref; } }
7 if (roll == 'true')
{
8 a1=new Image;a1.src="../menue/news_an.jpg";
9 a2=new Image;a2.src="../menue/news_aus.jpg";
}
</SCRIPT>
10 <p><A HREF="../distant/index.html" onMouseOver="over('image_name','../menue/news_aus.jpg');"
11 onMouseOut="out('image_name','../menue/news_an.jpg');">
12 <img name="image_name" alt="О дистанционном обучении" src="../menue/news_an.jpg" width=84 height=28 border="0">
</A>
Для себя этот скрипт можно приспособить делая ссылки на свои рисунки в строках 8,9,10,11,12 (убирая естественно номера строк) и ссылку на свой документ в строке 10. Рисунков может быть больше. У меня имена рисунков: news_an - мышь нажата, news_aus- отпущена. Те строки, которые нужно менять, выделены
б) Если ваш сайт "переехал", вы можете перенаправить посетителей со старого адреса на новый (new.address) этим скриптом:
<HTML>
<HEAD>
<META HTTP-EQUIV="REFRESH" CONTENT="1; URL=new. address
">
<script language="JavaScript"> </script>
<!-- window.location.href = ".new. address
" // -->
<CENTER>
<A HREF="new.address
">new name
</A>
</BODY>
</HTML>
в) Выпадающее меню:
Начало формы
Пособие по веб дизайну Основы HTML Программирование веб страниц Cоветы
Конец формы
Код:
<form> <select name="menu name
">
<option selected value="webdesign.html">Пособие по веб дизайну
<option value="webhtm.html">Основы HTML
<option value="webprog.html">Программирование веб страниц
<option value="web3.html">Cоветы
</select>
<input type=button value="Ok" onclick="top.location.href = this.form.menu name
.options[this.form.menu name
.selectedIndex].value"> </form>
Форма задается элементом SELECT. Если форм несколько, menue name
должны отличаться.
г) Поместите свой текст в строку состояния браузера автоматической корректировкой тега BODY:
<body .... onLoad="window.defaultStatus=' Ваш текст в строке состояния
'">
Вот и все программирование для начинающего веб дизайнера. Знание даже этого минимума позволит придать вашим страницам привлекательный профессиональный вид.
Другие работы по теме:
Работа с базами данных в JAVA на основе соединения JDBC
Предварительная компиляция SQL-запросов по месту исполнения. Использование инструкции prepareStatement. Использование синтаксиса определения вызова для получения значения, возвращаемого процедурой или функцией. Создание инструкции на выборку по запросу.
Языки серверных скриптов
В последнее время Web-узлы перестают быть просто набором страниц и картинок. Все чаще создаются узлы, которые взаимодействуют с посетителем, выполняют какие-то действия, собирают данные, ведут подсчеты, самонастраиваются под предпочтения посетителя.
Инструменты необходимые для тестирования Linux
Данная статья представляет из себя набор тех утилит, с которыми приходится сталкиваться QA инженеру при тестировании linux/unix подобных таргетов. Здесь описаны лишь некоторые, основные инструменты, с которыми Вам наверняка придется работать.
Восемь мифов про Java
Java это платформа, современная программная платформа, по большому счету стремящаяся заменить все функции операционной системы. Возможно, это в скором будущем и произойдет.
Разработка приложения на Java
Разработка и создание игры "Змейка". Использование динамически-активных принципов языка Java. Графические объекты программы. Описание игры, правила, теоретические сведения. Классы приложения. Типы данных. Реализация. Метод. Объект. Блок-схема игры.
Разработка транслятора в среде Java и С+
Общая характеристика и оценка возможностей языка программирования си-шарп, его сходные и отличительные черты от С++ и Java. Разработка с помощью данного языка программирования лексического и синтаксического анализатора. Составление таблиц разбора.
Выбор и обоснование языка программирования
Java — объектно-ориентированный язык программирования, разрабатываемый компанией Sun Microsystems с 1991 года и официально выпущенный 23 мая 1995 года. Изначально новый язык программирования назывался Oak (James Gosling) и разрабатывался для бытовой электроники, но впоследствии был переименован в Java и стал использоваться для написания апплетов, приложений и серверного программного обеспечения
The Microsoft Antitrust Case Essay Research Paper
The Microsoft Antitrust Case The case against Microsoft was brought buy the U.S. Department of Justice, as well as several state Attorneys General. Microsoft is accused of using and maintaining monopoly power to gain an unfair advantage in the market. The case has been under observation for a long time, but the Justice department is having trouble coming up with substantial evidence against Microsoft.
Microsoft Dilemma Essay Research Paper The Microsoft
Microsoft Dilemma Essay, Research Paper The Microsoft Dilemma During the early 1980 s, a Seattle based company named Microsoft began it s business campaign. Lead by a young computer programmer, Bill Gates, Microsoft would soon become the largest computer software maker in the world. This title did not come without a heavy price.
For Some Odd And Strange Reason Essay
, Research Paper 1/29/01 For Some Odd & Strange Reason It was a cold and blistering December morning on the campus of SUNY Brockport. Waking up and going to class on these dreadful mornings are a students worst nightmare. But for some odd and strange reason, something possessed me to get up early and retrieve a hot cup of java from the college coffee shop, Jitterbugs.
Indonesia Essay Research Paper IndonesiaThis report will
Indonesia Essay, Research Paper Indonesia This report will be on the History in Brief of Indonesia, the Government of Indonesia, the island of Java, and the Geography of Indonesia. In early days, the region from India to Japan, including Indonesia, was known to the Europeans as the Indies. Chris Columbus was looking for a westward sea root from Europe to the Indies, when he arrived in America.
Object Oriented Programming Essay Research Paper IntroductionObject
Object Oriented Programming Essay, Research Paper Introduction Object Orientation has become more and more important in the last years. Object oriented programming was designed for re-use of codes. It is a type of programming in which programmers define not only the data structure, but also the types of operations that can be applied to the data structure.
Programming Languaguages Essay Research Paper Programming LanguagesA
Programming Languaguages Essay, Research Paper Programming Languages A programming language is a set of English-like instructions that includes a set of rules for putting the instructions together to create commands. A translator changes the English-like commands into numeric code that the computer can understand.
Web Application Servers Essay Research Paper Web
Web Application Servers Essay, Research Paper Web App Servers A new breed application platforms known as web app servers, for internet based applications, has been born. These new application development environments provide the means for internet pages to contain and transfer information to and from the client’s browser.
Java Essay Research Paper Java is the
Java Essay, Research Paper Java is the substance whose aroma is awakening the Internet community. It is a new programming language developed by Sun Microsystems that has
Java Essay Research Paper Final Term PaperThe
Java Essay, Research Paper Final Term Paper The Java Revolution Java s new-age design is leading the object-oriented programming language design revolution; allowing even greater portability, state of the art security measures, and more extensive reusability. First, a brief description of what makes a programming language object-oriented so that its importance can be realized.
Java Verses C Essay Research Paper Java
Java Verses C++ Essay, Research Paper Java vs. C++Since their inception, computers have played an increasingly important role in today s society. Advancements in technology have enabled computers to become faster and cheaper. Today, the majority of families own a home computer that is vastly more powerful than giant mainframes of years gone by.
Xml And Java Essay Research Paper XML
Xml And Java Essay, Research Paper XML and Java Abstract Most web developers are intimately familiar with HTML, which is a language for presenting information on-screen so that it can be read by a human. A new markup language is rapidly gaining attention, however. XML allows for the presentation of information which can be read by a computer program.
Microsoft Antitrust Editorial Essay Research Paper Microsoft
Microsoft Antitrust Editorial Essay, Research Paper Microsoft: The Big Bully Stealing Your Lunch Money A monopoly, by definition, is a business or group that engages in unfair and often unethical business practices to control an industry and eliminate all competition that might lessen their profits.
Is Cobol Dead Essay Research Paper There
Is Cobol Dead Essay, Research Paper There is common question being asked by many in the programming world. That question is ?Is COBOL dead?? In spite of the years of criticism and all the predictions that some new language will soon replace COBOL, COBOL continues as a language of business data processing.
Is Cobol Dead Essay Research Paper Is
Is Cobol Dead Essay, Research Paper Is COBOL dead? To be completely honest, I originally had no idea. I knew that I took it as programming class last semester, but I didn’t know how it applied to the business world. Nor, had it ever crossed my mind in the 3+ months that I used it. The fact that you asked the question made me wonder myself, so I had to do some reading.
Pbs Essay Research Paper PROCESS BASED SECURITY
Pbs Essay, Research Paper PROCESS BASED SECURITY, WHAT IS IT AND HOW IT WILL CHANGE YOUR COMPUTER?S LIFE This note is for the purpose of explaining a new way to implement operating system security called process-based security. First, an explanation of traditional operating system security is given. Next, an explanation of process-based security is given.
Making A Web Page Essay Research Paper
Making a Web Page For my science project I chose to create a web (internet) page, dealing with science. This project consists of using a computer and a html editor to create a page that can be found on the internet. The next paragraph will explain how to make an internet page. The steps to making a web page to post on the internet, is very easy.
Java Project Essay Research Paper Jennifer
Java Project Essay, Research Paper // Jennifer Farley // Java Term Project import java.awt.*; import java.applet.*; public class scroll extends java.applet.Applet implements Runnable {
Differences Between Java And C Essay Research
Paper DIFFERENCES BETWEEN JAVA AND C++1 INTRODUCTION Since its release in 1995, Java has been hyped in many places, including computer magazines, broadcast news, and the Internet, as the solution to all problems in the application development community. As it has only been around for approximately 4 years now, it is still emerging into the programming language market.
Apple Vs Pc Essay Research Paper Apple
Apple Vs Pc Essay, Research Paper Apple vs. The World Apple vs. The World In past years, Apple was on a downward spiral, but now the Mac is back on the right track. The interim CEO Steve Jobs has brought them from expected quarterly loses to now, first quarter net income of some 150 millions dollars. The question still remains, is Apple back to stay? With the Windows driven world of today, can Apple assert them self to claim market share? Apple?s stunning new hardware, user-friendly operating system, and drive for incredible new technology, will not only compare Apple to traditional PC and software maker but will stun the rest of the computer world along the way.
Conditional And Iterative Data Types Essay Research
Paper Conditional and Iterative A programming language cannot be a programming language with out its conditional and iterative structures. Programming languages are built to accomplish the task of controlling computer input and output. A programmer must use every tool available to complete his/her given tasks, and conditional as well as iterative statements are the most basic items of programming which must be mastered.