Redirecting a page:
If you have a long address, and servers that give you short addresses do not have good storage capacity or transfer rate data with this code you can do that by typing an address another opens, you just must insert this code in the short domain index.html putting your current address where it is green:
<HTML>
<HEAD>
<TITLE> Redirecting by </ TITLE>
<SCRIPT LANGUAGE = "JavaScript">
location.href = 'http: /';
</ SCRIPT>
</ HEAD>
<BODY>
Open a Web in Pop Up:
With this code we will do that by entering our page automatically opens another, for example. another our website, a section we want to show, advertising, etc.
<Script language = 'JavaScript'> window.open ( '', 'geoflotante', ''); </ script>
Not help select the text of our website:
With this code we will prevent visitors select the text of our page and then copy it to the other side.
<Script language = "JavaScript">
<! - Begin
disableselect function (e) {
return false
}
reenable function () {
return true
}
document.onselectstart = new Function ( "return false";) <- leave no room, I seemed to me that if I left!
if (window.sidebar) {
document.onmousedown = disableselect
document.onclick = reenable
}
// End ->
</ Script>
hours remaining to end the day:
With this code we insert a small little clock that indicates the countdown of the hours, minutes and seconds remaining to end the day.
<Body>
<P> The clock ... </ p>
<Form name = "Clock">
<Input type = "text" size = 7 name = "time" value = "mm: hh: ss" title = "Time remaining to end the day">
<Script language = "JavaScript">
<! -
var tiempoAtras;
updateReloj ();
updateReloj function () {
var time = new Date ();
var hour = 23-time.getHours ();
var minutes = 59-tiempo.getMinutes ();
var seconds = 59-time.getSeconds ();
tiempoAtras = (time <10)? time: time;
tiempoAtras + = ((minutes <10) "0": "";) + minutes; <- Leave no room, I was me to this if I left!
tiempoAtras + = ((seconds <10) "0": "";) + seconds; <- Leave no room, I was me to this if I left!
document.Reloj.tiempo.value = tiempoAtras;
setTimeout ( "updateReloj ()", 1000);
}
// ->
</ Script>
</ Form>
</ Body>
Recommend Page Via E-Mail:
With this code we can do that if a visitor liked our website, recommends it to a friend by typing their email address in the box, by clicking on "Recommend this site" a mail message is sent with the subject "I think you may be interested in this page ... "and in the message body full address where the code and the title of it appears.
<Form name = "eMailer">
SEND THIS PAGE TO A FRIEND
<br>
Indicate your e-mail:
<br>
<Input type = "text" name = "address" size = 25>
<br>
<Input type = "button" value = "recommen this website!" onclick = "mailThisUrl ();">
</ Form>
<Script language = "JavaScript1.2">
var good;
checkEmailAddress function (field) {
// The following expression must be all on one line ...
goodEmail var = field.value.match (/ b (^ (S + @) + ((com) |.. (.net) |
(.edu) | (.mil) | (.gov) | (.org) | (.. {2,2})) $) b / gi);
if (goodEmail) {
good = true
} Else {
alert ( 'Please enter a valid e-mail')
field.focus ()
field.select ()
good = false
}
}
u = window.location;
m = "I think you may be interested this page ...";
mailThisUrl function () {
good = false
checkEmailAddress (document.eMailer.address)
if (good) {
// The following expression must be all on one line ...
window.location = "mailto:" + document.eMailer.address.value + + m + "& body =" + document.title + "" + u; "subject =?"
}
}
</ Script>
Create a form or Guestbook:
With this code we can create a form to complete the visitor. Or a guestbook, then the visitor press the "send" button, the data will be sent to your mailbox.
Where it says <TD ALIGN = RIGHT> Name: </ TD> can edit for example <TD ALIGN = RIGHT> Nick: </ TD>
He said: <H2> Guestbook of </ H2>
<FORM ACTION = "mailto: " method = "post">
<TABLE>
<TD ALIGN = RIGHT> Name: </ TD>
<TD> <INPUT type = "text" size = 36 name = "name"> </ TD>
<TR> <TD ALIGN = RIGHT> E-mail address: </ TD>
<TD> <INPUT type = "text" size = 36 name = "address"> </ TD>
<TR> <TD ALIGN = RIGHT> Subject: </ TD>
<TD> <INPUT type = "text" size = 36 name = "source"> </ TD>
<TR> <TD ALIGN = RIGHT> Your Comments: </ TD>
<TD> <TEXTAREA rows = 5 cols = 30 name = "comments"> </ textarea> </ TD>
</ TABLE>
<INPUT type = "reset" value = "Clear All"> <input type = "submit" value = "Submit">
</ FORM>
explanatory table of links:
I surprise your guests with this amazing trick. Hovering the mouse over the link, the explanation of that link appears in a box with the number of words you want to put. You only have to replace my addresses for yours, and the desired text for yours.
<P>
<Script language = "JavaScript"> <! -
write function (phrase) {document.desplaza.cuadro.value = sentence; }
// -> </ Script>
</ P>
<Table border = "0">
<Tr>
<Td width = "200"> <p align = "center"> <strong> Options. </ Strong> </ p>
<P> <a href = "
onmouseover = "writes ( 'Page principaln ---------------- nn When you click on this link directly go to the home page of my website');"> Page
Main </a> <br>
<A href = "
onmouseover = "writes ( 'MaxZizzen ----------- nn This link will take you to an incredible website' ');"> MaxZizze </a> <br>
<A href = "/pages/chat"
onmouseover = "writes ( 'Chat MaxZizzn -------------- nn This link will take you to chat incredible website');"> Glossary </a> <br>
</ P>
</ Td>
<Td> <form name = "scroll">
<P> <textarea name = "box" rows = "8" cols = "30"
wrap = "physical"> </ textarea> </ p>
</ Form>
</ Td>
</ Tr>
</ Table>
Insert a sound or background music:
If you want visitors to listen to a song while visiting the Web, or simply receive a melody presentation style, this is the code you were looking for. You just must save the sound in the root directory of your server and insert the following HTML code.
The song will be calling sonido.mid:
<BGSOUND SRC = "sonido.mid" LOOP = none>
<WIDTH = 200 HEIGHT = 55 AUTOSTART = "true" loop = "false" HIDDEN = "true">
It is recommended to use sounds in "midi" format that are lighter weight.
Create a link to download:
If we want to put files so that the visitors can download to their computers, we just upload that file to our server and insert in our website the following HTML code example is the name of your file:
<a href="ejemplo.exe"> </a> description link
There is no command to start the download. What happens is that a file type not recognized by the browser, it starts automatically download it wherever it appears. Example: If the browser fails to open a "zip" (compacted) file starts downloading automatically.
Underline a link when mouse:
With this code we can achieve that as well known effect when mouse over a link, this is underlined. We can have a color before visiting the link, and you have another once visited.
<STYLE type = "text / css">
<! -
A: link {color: red; TEXT-DECORATION: none}
A: visited {color: gray; TEXT-DECORATION: none}
A: active {TEXT-DECORATION: none}
A: hover {COLOR: blue; TEXT-DECORATION: underline} ->
</ STYLE>
</ P>
<P> <a href="l1.htm"> l text you want. </a> <br>
<a href="l2.htm"> other text. </a> <br>
<a href="l3.htm"> Another text. </a> <br>
</ P>
Transforming a crosshair cursor:
Transforms Windows flechita classic look in a shot.
said: <style type = "text / css">
<! -
body {cursor: crosshair}
->
</ Style>
Comment on a link in the status bar:
Hovering the mouse over the desired link, we will see in the status bar a comment on it. For example RemixadosOn positioned the mouse over and look in the status bar. (To display well on this page pass the mouse several times, as there is another similar code that clogs).
<A href = "
onmouseout = "window.status = ''"
onmouseover = "window.status = 'Here appears the message you want'; return true">
RemixadosOn </a>
Hinder copy of page:
With this simple action we can make it more difficult access to source-code or copying images from our site. When visitors click the right mouse button, a message will emerge previously created by us. Remember that some people do not like this type of lock. We have to decide whether to include it or not in our pages.
We can place it before the <html> tag or after the <body>.
<Script language = JavaScript>
right function (e) {
if (navigator.appName == 'Netscape' && (|| e.which e.which == 3 == 2)) {
alert ( "Place your message here.";); <- Leave no room, I was me to this if I left!
return false;
}
else if (navigator.appName == 'Microsoft Internet Explorer' &&
(Event.button event.button || == 2 == 3)) {
alert ( "Place your message here.";); <- Leave no room, I was me to this if I left!
return false;
}
return true;
}
document.onmousedown = right;
if (document.layers) window.captureEvents (Event.MOUSEDOWN);
window.onmousedown = right;
</ Script>
Note: To avoid this trick, there is also a contratruco, if you go to a page that has this trick will not let you copy images or text, you just must click with the right mouse button on the status bar without releasing it drag to the image. Ready, the menu will open as if the page was not locked to the copy. Keep in mind that very few people know this trick, so quiet you can use the trick lock.