[ RADIO BUTTON Auswahlmenue]
Mit diesem
Skript können Sie eine RadioButton-Menüleiste erstellen. Bei
Wahl einer Option wird in einem Fenster eine Beschreibung der gewählten
Seite angezeigt. Durch Drücken des Let's Go Buttons wird die gewählte
Seite aufgerufen.
[ zwischen <head> und </head>]
<script>
<!-- Activate
Cloaking Device
// Set in
dataBase() function - used as array index.
var recnum="";
// Used to
initialize arrays.
function initArray()
{
this.length = initArray.arguments.length;
for (var i = 0; i < this.length; i++)
{ this[i] = initArray.arguments[i]; }
}
// Creating
arrays.
var rcrd =
new initArray();
var address
= new initArray();
rcrd[1] =
"Test Page 1.";
address[1]
= "test1.htm";
rcrd[2] =
"Test Page 2.";
address[2]
= "test2.htm";
rcrd[3] =
"Test Page 3.";
address[3]
= "test3.htm";
rcrd[4] =
"Test Page 4.";
address[4]
= "test4.htm";
// Called
by onClick for each radio button - determines & displays message and
URL.
function dataBase(leapto)
{
for (var i = 0; i < 4; i++)
{
if (leapto.buttons[i].checked)
{ recnum = leapto.buttons[i].value; }
}
if ( (rcrd[recnum] != null) && (rcrd[recnum]
!= "") )
{ document.leapto.display.value = rcrd[recnum]+"\r\n\r\n"+address[recnum];
}
}
// Called
by Lets Go button - loads pre-selected page.
function leapTo()
{
if ( (address[recnum] != null) && (address[recnum]
!= "") && (recnum != "") )
window.location= address[recnum];
else
alert("\Wähle erst ein radio button.");
}
// Called
by Full Window button - loads file to full window for easy saving.
function WinOpen()
{
alert('\nPage will load to full screen.\n\nUse View/Document Source from
menu bar to view source.\n\nUse File/Save As from menu bar to save.\n\nClose
new window to return to this page. ');
window.open("radioleap3.html","DisplayWindow","menubar=yes,scrollbars=yes");
window.open("radioleap3.html","DisplayWindow","menubar=yes,scrollbars=yes");
// double for Macs
}
// Deactivate
Cloaking -->
</script>
[ zwischen <body> und </body>[
Im
folgenden Beispieltext sind die anzuzeigenden Objekte wegen der besseren
Darstellungsmöglichkeiten in mehrere Tabellen eingebettet. Die Darstellungsweise
kann natürlich frei gewählt werden.
<p><form
NAME="leapto"></center>
<center><table
COLS=2 WIDTH="80%" >
<tr>
<td>
<table
COLS=1 WIDTH="80%" BGCOLOR="#CC0000" >
<tr>
<td><input
TYPE="radio" NAME="buttons" VALUE="1" onClick="dataBase(this.form)"><b><font
color="#00FFFF">Test Page 1</font></b></td>
</tr>
<tr>
<td><input
TYPE="radio" NAME="buttons" VALUE="2" onClick="dataBase(this.form)"><b><font
color="#000000">Test Page 2</font></b></td>
</tr>
<tr>
<td><input
TYPE="radio" NAME="buttons" VALUE="3" onClick="dataBase(this.form)"><b><font
color="#800000">Test Page 3</font></b></td>
</tr>
<tr>
<td><input
TYPE="radio" NAME="buttons" VALUE="4" onClick="dataBase(this.form)"><b><font
color="#FFFF00">Test Page 4</font></b></td>
</tr>
</table>
</td>
<td>
<table
BORDER=0 WIDTH="500" >
<tr>
<td ALIGN=CENTER
WIDTH="350"><textarea NAME="display" ROWS=4
COLS=25 WRAP=yes></textarea></td>
<td ALIGN=CENTER
WIDTH="150"><input TYPE="button" VALUE="Lets
Go" onClick="leapTo()"></td>
</tr>
</table>
</form></td>
</tr>
</table></center>
[ Autor]
??
[ Download]
zurück