INFO: THE HTML ABOVE HERE IS ADDED TO EVERY PAGE ON THIS SITE BEFORE DELIVERY
BY USING SSI
COMMANDS
You will find a lot of simple little Javascript
Thingies running on the FBRpages and they all seem to work ok, the buttons/menus
on this page should too!
You will also find a few add ons to augment
FORM scripts with interesting things like where the from sender came
from ( good for pracing links and verifying legitimacy), and get around
the PayPal 2(two) field (os0,os1) limits (allows
combination of more than 2 values together to populate the options windows
on PayPal shopping carts
YOU ARE BEST TO COPY THE HTML SOURCE ( do VIEW then SOURCE
then SAVE AS TEXT FILE in your browser) FROM THE PAGES THEMSELVES AS THE
TEXT HERE HAS BEEN CHOPPED UP TO FIT ACROSS THE SCREEN and might not work
OK if just cut 'n' pasted back into yours!
Go HERE
for the EXCELLENT source of some of these scripts!
....You might also try following this
link to Java Resources on Google: beware, some sites are not for beginners
TOP TIP: make sure no button names or function names
occur more than once on each page, your gee-whizz Java might not work!
WHERE TO START?: (i) Copy and paste a script (NOT the
cookies one) into one of your pages in the SAME LOCATIONS (ie in the HEAD
or BODY areas), if it doesn't work check all the lines in the source code
that were intact are STILL intact in your code... if you can't work out
what is wrong........join a newbie friendly Javascript discussion group
like this one:
SLOW!!! WEAK JAVA!
FatblokeRacing Welcomes:
(none) A.k.a:
38.103.63.62
(The IP details shown on the sign is produced using
SSI system variable values)
#1 Hide your email address whilst still displaying a click link (added
31 Aug 2003)
<a href="javascript:window.external.AddFavorite(location.href,document.title)"
target="_top" onClick="console=false">click
here to bookmark THIS PAGE</a>
put it anywhere!
#3 (i) Navigate your visitors using the memory of the browser for where
it was last (ii) Open full window page LIKE POWERPOINT, and close a window!!!!
(added 23 June 2002)
looks like this, it only "knows" where the current window has
visited so try it on your site ater adding it to a few pages:
<input type="button" value=" <-- Back a Page"
onClick="history.go(-1)" name="button5">
<input type="button" value="Forward a Page-->"
onClick="history.go(1)" name="button22">
<span class="minute"><span class="minute"><span
class="minute">
OVERKILL CORNER!!!:
ALWAYS HAVE ONE of the "CLOSE WINDOW" buttons ON THE FULL
SCREEN WINDOW YOU OPEN
AS it is FULL SCREEN without browser navigation!!!!
looks like this:
<script>
<!--
function fullwin(){
window.open("yourURLhere","bfs","fullscreen,scrollbars")
}
//-->
</script>
<input type="button" onClick="fullwin()" value="Open
Site in Full Screen" name="button3">
<input type="button" value="Close the Window" onClick="window.close('fs')"
name="button4">
</h3>
#4 Open a sized window on click of a button (added 23 June 2002)
Put this in the head <head> </head> section:
<SCRIPT LANGUAGE="JavaScript">
function myscript()
<!-- From Fatblokeracing.org -->
{
var page ="mypage.htm";var windowprops = "width=425,height=400,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";window.open(page,
"",windowprops);
}
When you set up the window sizes place a page in there with everthing
you need to a nice table forced to have a width of about 25 pixels less
than the width=, also unless your table is short have scrollbars set to
yes, DON'T set height bigger than say 600 unless you tune the size by
trying the page out
function doPopup2() {
url="http://www.fatblokeracing.org/resist.htm";
width = 425; // width of window in pixels
height = 600; // height of window in pixels
delay = 20; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}
// End -->
</script>
ADD this to the body tag:
OnLoad="doPopup();"
like so:
<body OnLoad="doPopup();" bgcolor="#FFFFFF">
#6 Load a page on the click of a menu choice without a "GO"
button... See below ;) (added 23 June 2002)
Looks a bit like like this: each line is a displayed option ( ie.
"option selected" line shows the text displayed on load)
CAREFUL: If you use this script more than ONCE on a page you need
to rename select name & form name to make them different between occurances
of the pulldown.
#7 Load a page in the existing Browser Window on the click of a button!
see http://www.ihatethebmwmini.org
(added 23 June 2002)
VERY SIMPLE but good when you want a choice to launch a URL put this
in your body HTML:
<SCRIPT LANGUAGE="JavaScript">
function opensite()
{self.location.replace('yoururl.htm')}
</script>
#8 Put this in the top of any page in the <BODY> and it will
bust any frameset it is opened in to occupy the top frame!! (added 24
Dec 2002) this will stop people opening your page in their framesets....
try http://www.imm2004.co.uk!!! this routes to www.imm2004.org and breaks
us out of the original hosts frameset watch
<SCRIPT LANGUAGE="JavaScript">
<!--
if (window != top) top.location.href = location.href;
// -->
</SCRIPT>
#9
Try using cookies!: this puts a cookie called fatblokeracingjava on
the viewing machine that lasts for a year, if it is a first visit it
launches javawelcome.html as a new window, if the visitor returns it
opens javawelcomeback.html...
IMPORTANT: please do a "find and replace" to change "fatblokeracingjava"
to yourname for YOUR cookie!
TRY HITTING "REFRESH" on your browser and see if a DIFFERENT
window opens now you are visiting the page AGAIN ;) (added 23 June 2002)
This Script opened the welcome box you got when you came to this page!
THIS LOT GOES IN THE <HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var expDays = 365; // number of days the cookie should last
var page = "javawelcome.html";
var windowprops = "width=450,height=400,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
var returnpage = "javawelcomeback.html";
var windowprops = "width=450,height=400,location=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no";
function GetCookie (fatblokeracingjava) {
var arg = fatblokeracingjava + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}
function SetCookie (fatblokeracingjava, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = fatblokeracingjava + "=" + escape (value)
+
((expires == null) ? "" : ("; expires=" + expires.toGMTString()))
+
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
function DeleteCookie (fatblokeracingjava) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (fatblokeracingjava);
document.cookie = fatblokeracingjava + "=" + cval + ";
expires=" + exp.toGMTString();
}
var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
}
else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}
function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
<script language="JavaScript">
function myprint()
{
window.print();
}
// End -->
</script>
Finally, to print the page off!!
#11 .... Embed Referring URL and other Viewer information
into Forms! (added 15 12 02)
These MUST be between the <Form> and </form> tags to work!!
Check your form script will support them too, if you try one out and the
form script returns a default value expect that your "tweak"
is incompatible
A QUESTION!
How can you combine values inputted in a form to form a third hidden
value?
eg. existing hidden field is:
<input type=hidden name="subject" value="IMM2004
pre registration RECEIVED">
another 2 are filled in by the submitter: email address and real name
Set up hidden fields in your forms to embed in the form where the viewer
came from (Their IP etc AND the refering URL) some form scripts support
other functions you can stuff things into!!!!
SSI must be enabled for some of this to work!!!! try anyway to see if
it is....
REFERRING URL
<script language="JavaScript">
<!-- Begin
var fromurl = document.referrer;
document.write("<input type=hidden name=return_link_url value='"
+ fromurl + "'>");
// End -->
</script>
This hidden field can be used to set a return link on form submission
to take them back where they came from ( FormMail.cgi
from Matts Scripts supports this) this function NEEDS SSI to be enabled!!
<script language="JavaScript">
<!-- Begin
var fromurl = document.referrer;
document.write(fromurl);
// End -->
</script>
***** THIS displays the Referring URL NEEDS
SSI to be enabled!!!!
AND gives a REFERRING URL output like this (follows in bold)....
this will be blank if you didn't come here from another page.. check
it AGAIN click here!!
<script language="JavaScript">
<!-- Begin
var fromurl = document.referrer;
document.write("<input type=hidden name=referringURL value='"
+ fromurl + "'>");
// End -->
</script>
***** THIS inserts the Referring URL as a HIDDEN form field entry NEEDS
SSI to be enabled!!!!
REFERRING IP Address and the like
<script language="JavaScript">
<!-- Begin
var fromip = '<!--#echo var="REMOTE_ADDR"-->';
document.write("<input type=hidden name=referringIP value='"
+ fromip + "'>");
// End -->
</script>
***** THIS inserts the Referring IP as a HIDDEN form entry NEEDS SSI
to be enabled!!!!
#echo var="REMOTE_ADDR" gives an output like this (follows in bold):
38.103.63.62
(Not ALL might not be supported by your server)
#echo var="REMOTE_HOST" gives (follows in bold) : (none)
#echo var="HTTP_USER_AGENT" tells you their Browser (follows in bold):
CCBot/1.0 (+http://www.commoncrawl.org/bot.html)
you could use HTTP_USER_AGENT in the script above
<script language="JavaScript">
<!-- Begin
var fromhost = '<!--#echo var="REMOTE_HOST"-->';
document.write("<input type=hidden name=remoteHOST value='"
+ fromhost + "'>");
// End -->
</script>
***** THIS inserts the Remote_Host as a form entry NEEDS SSI to be enabled
!!!!
#12 Combining form field values to be used elsewhere
in the form as hidden values!!!!
this tells the function to execute on submit and give the from a name
"registration"
you also need the line about the hidden field "subject" as
yet without a value!!!!
then add this javascript between the form tags (email and realname are
2 of the formfield values:
<script language="JavaScript">
<!-- Begin
function onFormSubmit()
{
var email = document.registration.email.value; // form value 1
var realname = document.registration.realname.value; // form value 2
document.registration.subject.value = "IMM2004 PreReg TRADER
Form From: " + email + " / " + realname; // set new value
return true;
}
// End -->
</script>
this generates a value for the field "subject" of
subject: IMM2004 PreReg TRADER Form From: johnbullas@xxxx.com / John
Bullas
and this is added tothe email the form sends!!!
#13 Combinng form inputs to work with the
limited number of fields in the PAYPAL shopping cart! ( added 31 Aug 2003)
<input type="hidden" name="on0" value="Club
and Club name (if applicable)">
<input type=hidden name="os0">
<input type="hidden" name="on1" value="Car
Numbers and Arrival details">
<input type=hidden name="os1">
to tell Paypal the headings for the cart entires and to expect values
for 0s0 and os1!!!!
this script THEN combines them on form submission
<script language="JavaScript">
<!-- Begin
function onFormSubmit()
{
var clubornotvar = document.bookingsub.clubornot.value; // form value
1
var clubnamevar = document.bookingsub.clubname.value; // form value 2
var carnosvar = document.bookingsub.carnos.value; // form value 3
var arrdayvar = document.bookingsub.arrday.value; // form value 4
var arrtimevar = document.bookingsub.arrtime.value; // form value 5
var numvegesvar = document.bookingsub.numveges.value; // form value 5