In article <fa9bacd0.0405050947.ac08931@posting.google.com> ,
ksorman@shaw.ca enlightened us with...[color=blue]
> Can any one please help me...I am new to JavaScript and I have been
> struggling with this code for days now and can't figure it out.
>
> I would like to get the Buttons to correspond with the action to
> either a) generate numbers b) Prompts a user to locate a web page c)
> go to previous page in history list d) Loads next page in history list
> e) Promps the user for a URL and loads the web page in a new window f)
> and Re-Sizes the window.
>
> Please view my coding below, the only button that seems to work is
> 'Print'.
>
> What am I doing incorrectly here?[/color]
Lots. See code below. Tested in Mozilla and IE.
Fix that random number function, too. It seems to only return 0 or 100.
The home button still doesn't work. I don't think there's a window.home.
Check into that. Same for the find button.
Forward won't work unless there is actually a page forward in history.
Vice versa with back.
<HTML>
<HEAD>
<TITLE>Numbers per Loto Winners - JavaScript Button Action</TITLE>
<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
<!--
function DrawNumbers( )
{
for (var x=1; x<7;x++)
{
var num = Math.round(Math.random( ))*100;
document.forms["FrmNumbers"].elements["txtnum"+x].value = num;
}
}
function my_prompt( )
{
var strFind;
strFind=prompt("Weekly Employees");
window.find(strFind)
}
function my_back( )
{
window.back( );
}
function my_forward( )
{
window.forward( );
}
function my_home( )
{
window.home( );
}
function openwindow( )
{
window.open("http://www.cdicollge.com");
}
function my_print( )
{
var response;
response = confirm("Do you wish to print this page?");
if (response == true)
window.print( );
else
alert("Printing has been rejected");
}
function ResizeBy( )
{
var Width = window.outerWidth / 2;
var Height = window.outerHeight / 2;
window.resizeBy(Width,Height);
}
function ResizeTo ( )
{
window.resizeTo(300,300);
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<H1 Align=center> <Font Face=Arial Color=Red> Weekly Employee Lottery
Draw </Font></H1>
<Center>
<Font Face=Arial Size=3 Color=Blue>
<FORM NAME="FrmNumbers">
Number 1<INPUT TYPE="text" NAME="txtnum1" VALUE="0" SIZE="10"><BR>
Number 2<INPUT TYPE="text" NAME="txtnum2" VALUE="0" SIZE="10"><BR>
Number 3<INPUT TYPE="text" NAME="txtnum3" VALUE="0" SIZE="10"><BR>
Number 4<INPUT TYPE="text" NAME="txtnum4" VALUE="0" SIZE="10"><BR>
Number 5<INPUT TYPE="text" NAME="txtnum5" VALUE="0" SIZE="10"><BR>
Number 6<INPUT TYPE="text" NAME="txtnum6" VALUE="0"
SIZE="10"><BR><BR><HR><HR>
<INPUT TYPE="button" NAME="cmdDraw" VALUE="Generate Numbers"
onClick="DrawNumbers ( )">
</FORM>
<FORM NAME="buttonAction">
<INPUT TYPE="button" NAME="buttonPrompt" VALUE="Find"
onClick="my_prompt( )">
<INPUT TYPE="button" NAME="buttonBack" VALUE="Go Back"
onClick="my_back( )">
<INPUT TYPE="button" NAME="buttonForward" VALUE="Go Forward"
onClick="my_forward( )">
<INPUT TYPE="button" NAME="buttonHome" VALUE="Home"
onClick="window.home( )">
<INPUT TYPE="button" NAME="buttonWindow" VALUE="Open Window"
onclick="openwindow()">
<INPUT TYPE="button" NAME="buttonPrint" VALUE="Print"
onClick="my_print()">
<INPUT TYPE="button" NAME="buttonResizeBy"VALUE="Resize"
onClick="ResizeBy(-50,-50)">
<INPUT TYPE="button" NAME="buttonResizeTo"VALUE="Resize"
onClick="ResizeTo(300,300)">
</FORM>
</FONT>
</CENTER>
</BODY>
</HTML>
--
--
~kaeli~
No one is listening until you make a mistake.
http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace