Unit 14. Other Features (III)


Adding external code

 

Sometimes we would like to introduce into our pages some things we have seen published in others in internet.

You can see Source code of these pages through View menu of Internet Explorer, and then the Source code option, or view the page in contextual menu by right-clicking on it and then selecting the View source code option. By doing this you can consult the code that has been used to make the page, and used it for your own pages.

Viewing the font code is useful to check the page's structure, the use of behaviours (programmed in JavaScript code), and other sets of JavaScript routines .

For example, click here to open a page in which there is an effect in the status browser's bar, that shows a marquee, who's text is JAVASCRIPT CODE - DREAMWEAVER MX 2004 TUTORIAL- TEACHERCLICK

If you look at the page's source code you will find the javascript code used to create that effect in the status bar. The code is the following:

<SCRIPT language=JavaScript>

<!--

strcnt=0;

mensaje=" JAVASCRIPT CODE - DREAMWEAVER MX 2004 TUTORIAL- TEACHERCLICK ";

function scroller()

{

window.status=mensaje.substring(strcnt++,mensaje.length+1);

if(strcnt>mensaje.length)

strcnt=0;

setTimeout("scroller()",200);

}

//-->

</SCRIPT>

This code has to go between <HEAD> and </HEAD> labels, and add onload="scroller()" inside the <BODY> label, resulting in:

<BODY onload="scroller()">

This code is not too complicated, and you could add it to your own pages without problems in order to show the messages you want.

On many occasions it can be diffcult to understand the code, and even more so if you don't have a programming language knowledge. If you don't know the code, you can make the copy of the mistaken or incomplete JavaScript code , insert it in a erroneous zone of html code, etc.

The important thing to remember about JavaScript functions, is that they are between the lines.

<HEAD> ... <SCRIPT language=JavaScript> <!--

and

//--> </SCRIPT> ... </HEAD>

 



  Ir a la página anterior Índice del curso  Ir a la siguiente página  

Page. 14.3

Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
© aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited.
November-2005.