sonicsnail
Bipolar (III) Inmate
From: Scotland Insane since: Jun 2001
|
posted 09-30-2002 23:08
hi InI, thanks for assisting.
I worked very hard to get this to where it is now, and I've probably tripled my knowledge of JS. Believe it or not, I actually got there myself in the end, before you posted ^ .
This is being done for my "job", and I've avoided doing/telling/showing anything I shouldn't online. I've created the newest version of the page with the actual steps involved, and even some of the style elements for the existing site, and I don't want to put it online with this level of detail.
Here's the code though - feel free to paste it into you notepad and test it out! There's no stylesheet or image etc though.
Here's some cool stuff I've started weaving in...
The document.write runs 3 times for every "Step" - because some Steps have 3 tickboxes. Howver, rather than rendering unrequired tickboxes for steps that only require 1 or 2, the script checks if there is a value, and only draws the <td><input... etc if required. This bit made me very happy.
I won't tell you the reasoning in detail, but when ticked, the script also adds a little content to the <textarea> on the right. This I'd achieved in the past however.
You'll get an error at some of the final stages of the steps.. this is because there is extra functionality to go in.
This made me very happy today. At f***ing last!
Thanks all. I appreciate the help, and restraint by others to force me to work this pretty simple stuff out for myself.
code:
<html>
<head>
<title>STEPbySTEP II</title>
<script>
//Declare Objects
function STEPbySTEPfix(name, option1, option2, option3, description, writethis)
{
this.name = name
this.option1 = option1
this.option2 = option2
this.option3 = option3
this.description = description
this.writethis = writethis
}
//Put Objects Into Array to allow loooooping
var STEPbySTEPfixes = new Array();
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Off", "CheckedPower", "", "", "Check (power) cabling, powersupply, powercycle", "'checkedrouterlights'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("CheckedPower", "BookFault", "", "", "There is a router fault, Book to WS", "'checkedpower'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Amber", "CheckedPhone", "", "", "Check phone, wall socket, powercycle", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("CheckedPhone", "Woosh", "", "", "Run Woosh Test", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Woosh", "BookFault", "", "", "There is a fault, Book to WS", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Green", "Yes_PwrCycd", "No_PwrCycd", "", "Has your customer already PowerCycled?", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("No_PwrCycd", "Yes_PwrCycd", "", "", "Ask customer to PowerCycle hardware", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Yes_PwrCycd", "Yes_ConnScreen", "No_ConnScreen", "", "Can customer get Connection Screen?", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Yes_ConnScreen", "User_PW_Error", "Other_Error", "", "What type of error do they get?", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Other_Error", "Run_Woosh", "", "", "Run Woosh Test", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Run_Woosh", "BookFault", "", "", "There is a fault, Book to WS", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("User_PW_Error", "Acc_OK", "Acc_Inactive", "", "Check Account in IDA, retype password", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Acc_Inactive", "", "", "", "Pull up the account in Fusion and call over a PS who will advise further", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Acc_OK", "BT_Test_OK", "BT_Test_Fail", "", "Try connecting with test details", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("BT_Test_Fail", "", "", "", "Your customers account is active, they can see the conn screen, yet cant connect with any details. Call over your PS", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("BT_Test_OK", "Test_User_OK", "Test_User_Fail", "", "Test with HG test details", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Test_User_Fail", "", "", "BookFault", "Your customer has an SSB (Service Select Barring) Problem. Book Fault", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Test_User_OK", "MegaSt_OK", "MegaSt_Fail", "", "Try connecting with customers details on the megastream", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("MegaSt_Fail", "", "", "", "There is an odd account problem - call over your PS.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("MegaSt_OK", "", "", "", "There is clearly nothing wrong with the account. There is no SSB issue. The customer must be making a User Error. If you are sure this is not the case, call over your PS.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("No_ConnScreen", "Regraded_Yes", "Regraded_No", "", "Check Workflow for recent Regrades.", "'bleh'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Regraded_Yes", "", "", "", "Talk your customer through the complex Regrade process, and how this has affected their service. Call over your PS if necessary.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Regraded_No", "IPconfig", "", "", "Run IPConfig.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("IPconfig", "CheckNetworks", "", "", "Check customers network settings.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("CheckNetworks", "Ping_Yes", "Ping_No", "", "Can customer ping the router.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Ping_Yes", "", "", "", "Check for Browser Issues - If unsure speak to your PS.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("Ping_No", "CheckCabling", "", "", "Check cabling and hardware.", "'stuff'")
STEPbySTEPfixes[STEPbySTEPfixes.length] = new STEPbySTEPfix("CheckCabling", "", "", "", "This is an odd issue - call over your PS.", "'beh'")
//Function to show/hide layer onclick
function showORhide(whichone)
{
if (whichone.style.display == "none") {
whichone.style.display = "block";
} else {
whichone.style.display = "none";
}
}
//Function to update textarea
function updatetextarea(writeme){
var addText;
addText = writeme;
var revisedMessage;
var currentMessage = document.templates.messageBox.value;
revisedMessage = currentMessage+addText+"\n";
document.templates.messageBox.value=revisedMessage;
document.templates.messageBox.focus();
return;
}
//Function to do it all!
function DoItAll(whichone,writeme)
{
showORhide(whichone);
updatetextarea(writeme)
}
</script><link rel="stylesheet" href="style.css"></head>
<body>
<table width="100%" border="0"><tr><td class="inset" width="100%">
<font color="yellow">STEPbySTEP II - <i>Beta</i>
</td><td align="right" class="Inset">
<table cellpadding="0" cellspacing="0" border="0"><tr><td><FORM ACTION="javascript:history.back(1)" METHOD="get"><INPUT TYPE="SUBMIT" VALUE="BACK" class="button"></td><td></form></td><td> </td><td><FORM ACTION="../index.htm" METHOD="get"><INPUT TYPE="SUBMIT" VALUE="HOME" class="button"></td><td></form></td></tr></table>
</td></tr></table>
<form name=templates>
<table width="100%"><tr><td width="550" valign="top">
<!-- This is the initial Step -->
<table width="500" border="0" class=sbs><tr>
<td>Router Light Status</td>
<td width="70" align="center" class="tiny">Off<br><input type="checkbox" onclick="DoItAll(Off,'putthisin')"><img src=1x1.gif width=70 height=1></td>
<td width="70" align="center" class="tiny">Amber<Br><input type="checkbox" onclick="DoItAll(Amber,'stickthis')"><img src=1x1.gif width=70 height=1></td>
<td width="70" align="center" class="tiny">Green<Br><input type="checkbox" onclick="DoItAll(Green,'stickthis')"><img src=1x1.gif width=70 height=1></td>
</tr></table>
<!-- End initial Step -->
<!-- Further steps are document.written below -->
<!-- DO NOT TOUCH BELOW HERE-->
<script>
//This loops through the objects and document.writes them
for (var index = 0; index < STEPbySTEPfixes.length; index++)
{
var item = STEPbySTEPfixes[index];
document.write("<div class=\"sbsdiv\" id=" + item.name + " style=\"display:none\"><table border=0 class=\"sbs\" width=500><tr><td>" + item.description + "</td>")
{if (item.option1 == "") {document.write("")} else {
document.write("<td width=70 align=center class=\"tiny\">" + item.option1 + "<br><input type=checkbox onclick=\"DoItAll(" + item.option1 + "," + item.writethis + ")\"><img src=1x1.gif width=70 height=1></td>")
}}
{if (item.option2 == "") {document.write("")} else {
document.write("<td width=70 align=center class=\"tiny\">" + item.option2 + "<br><input type=checkbox onclick=\"DoItAll(" + item.option2 + "," + item.writethis + ")\"><img src=1x1.gif width=70 height=1></td>")
}}
{if (item.option3 == "") {document.write("")} else {
document.write("<td width=70 align=center class=\"tiny\">" + item.option3 + "<br><input type=checkbox onclick=\"DoItAll(" + item.option3 + "," + item.writethis + ")\"><img src=1x1.gif width=7 0 height=1></td>")
}}
document.write("</tr></table></div>")
}
</script>
<!-- DO NOT TOUCH ABOVE HERE -->
</td>
<td align="right">
<textarea cols="48" rows="26" name="messageBox" wrap="virtual" class="text">
</textarea>
<input type="button" value="Select All" onClick="javascript:this.form.messageBox.focus();this.form.messageBox.select();" class="button"> <input type="reset" value="Reset" class="button">
</form>
</td>
<td width="16"> </td></tr></table>
</body>
</html>
::edit::
Yeah, InI, I need to look at cross-browser issues... I'm kind of lucky, this is intended for an intra, so I can get away with it... but I shouldn't really be lazy.
[This message has been edited by sonicsnail (edited 09-30-2002).]
|