Javascript Reference - Tutorials - Links
Great Javascript Reference Guide
http://www.devguru.com/Technologies/ecmascript/quickref/javascript_index.html
Decent Javascript Tutorials
http://www.pageresource.com/jscript/index6.htm
http://www.w3schools.com/js/default.asp
Debug
Alert(“test”)
Parse()
Preloading
Images
if
(document.images)
{
folder_close2 = new Image();
folder_close2.src = "images/folder_close2.gif";
folder_open2 = new Image();
folder_open2.src = "images/folder_open2.gif";
}
Right
Click Menu
oncontextmenu=\"javascript:menuHolderID = '" + intID
+ "' ; makeMenu('Folder Menu', 'New Bookmark,New Link,New Folder') ;return
false \"
function makeMenu(itemTitle, itemList)
{
//alert('making div:' + document.body.childNodes.length);
if (document.all.MenuDiv != null)
{
document.all.MenuDiv.removeNode(true);
}
// div setup
var oDiv
= document.createElement("DIV")
oDiv.id = 'MenuDiv'
oDiv.width = '100px'
oDiv.height = 110
oDiv.style.margin = '0'
oDiv.style.padding = '10 10 10 10'
oDiv.style.position = 'absolute'
oDiv.style.top = window.event.offsetY
oDiv.style.left = window.event.offsetX
//alert("mouseX:" + mouseX + " screenX:" + window.event.screenX + " clientX:" +
window.event.clientX)
//alert("mouseY:" + mouseY + " screenY:" + window.event.screenY + " clientY:" +
window.event.clientY + " just Y:" + window.event.y + " offsetY:"
+ window.event.offsetY)
oDiv.style.zIndex = 100000
oDiv.style.backgroundColor = 'white'
oDiv.style.border = 'black 1px solid'
// menu header
var oTable2 = document.createElement("TABLE")
oTable2.cellSpacing
= '0'
oTable2.id
= 'MenuTitleTable'
oTable2.style.tableLayout
= 'fixed'
oTable2.marginBottom
= '0'
oTable2.style.padding
= '0'
oTable2.style.border
= '0'
oTable2.style.fontSize
= 'xx-small'
oTable2.style.fontFamily
= 'Arial'
oTable2.width
= "100%"
oDiv.appendChild(oTable2)
var oTR
= oTable2.insertRow()
oTR.height = 20
var oTD
= oTR.insertCell();
oTD.colSpan = "2"
oTD.id = "MenuTitle"
oTD.vAlign = "bottom"
oTD.align = "left"
oTD.style.fontBold = true;
oTD.style.fontFamily= "Verdana"
oTD.style.fontWeight = "Bold";
oTD.style.color = "white"
oTD.bgColor = '#7f1788'
oTD.width = "100%"
oTD.style.borderBottom = 'black 2px solid';
oTD.innerText = itemTitle
// END Menu
// Choices
var oTable
= document.createElement("TABLE")
oTable.cellSpacing = '0'
oTable.id = 'MenuDivTable'
oTable.style.tableLayout = 'fixed'
oTable.marginBottom = '0'
oTable.style.padding = '0'
oTable.style.border = '0'
oTable.style.fontSize = 'xx-small'
oTable.style.fontFamily = 'Arial'
oTable.width = "100%"
arrMenuItems = itemList.split(',');
for (var i=0;
i<arrMenuItems.length;
i++)
{
var oTR
= oTable.insertRow()
oTR.height = 20
//
add cell
var oTDsp
= oTR.insertCell();
oTDsp.width = 20
switch(arrMenuItems[i])
{
case "New Bookmark":
//alert("yes")
oTDsp.innerHTML = "<img
src='images/version3_globe.gif'>"
break;
case "New Link":
oTDsp.innerHTML = "<img
src='images/link.gif'>"
break
case "New Folder":
oTDsp.innerHTML = "<img
src='images/folder_close.gif'>"
break
default:
// oTD.innerText
= arrMenuItems[i]
break;
}
var oTD
= oTR.insertCell();
oTD.id = "true"
oTD.vAlign = "bottom"
oTD.align = "left"
oTD.innerText = arrMenuItems[i]
oTD.onclick = new Function('MenuClick("' + arrMenuItems[i] + '","' + itemTitle
+ '")')
oTD.onmouseover = new Function('this.bgColor = "#DFC5E1"' )
oTD.onmouseout = new Function('this.bgColor = "white"')
}
oDiv.appendChild(oTable)
// END Choices
// cancel
option
var oTable3 = document.createElement("TABLE")
oTable3.cellSpacing
= '0'
oTable3.id
= 'MenuTitleTable'
oTable3.style.tableLayout
= 'fixed'
oTable3.marginBottom
= '0'
oTable3.style.padding
= '0'
oTable3.style.border
= '0'
oTable3.style.fontSize
= 'xx-small'
oTable3.style.fontFamily
= 'Arial'
oTable3.width
= "100%"
oDiv.appendChild(oTable3)
var oTR
= oTable3.insertRow()
oTR.height = 20
var oTDsp
= oTR.insertCell();
oTDsp.width = '62px'
var oTD
= oTR.insertCell();
oTD.id = "MenuTitle"
oTD.onclick = new Function('killMenu()');
oTD.style.fontSize = 'x-small';
oTD.width = '48px'
oTD.bgColor = '#999999'
oTD.innerHTML = 'Cancel'
oTD.onmouseover = new Function('this.bgColor = "#DFC5E1"')
oTD.onmouseout = new Function('this.bgColor = "#999999"')
oTD.style.color = "white"
window.setTimeout(Function('killMenu()'),10000)
if (document.body.childNodes.length
> 0) {
document.body.insertBefore(oDiv, document.body.childNodes(0))
}
else {
document.body.insertBefore(oDiv, window)
}
}
VB
Debugging
On Error Resume Next
Dims
Dim runAll
As String
Dim arrList(40) As Variant
Data
Dim DBConn As
ADODB.Connection
Set DBConn = New ADODB.Connection
DBConn.CommandTimeout = 50000
DBConn.open "Provider=SQLOLEDB; Data Source=ohow2ka5;
Initial Catalog=master; User Id=sa; Password=19wazee"
Dim rsMain As ADODB.Recordset
Set rsMain = New ADODB.Recordset
vsql = "SELECT * FROM Recall_Field INNER JOIN Recall_Project
ON Recall_Field.recall_project_id_fk = " _
& " Recall_project.recall_project_id "
rsMain.open vsql, DBConn, 1, 1
Do While Not rsMain.EOF
vFieldName = rsMain("field_name")
FSO
File Combiner
Dim strAllFileswells
strAllFileswells = ""
Dim objFolder
Dim objFSO
Dim fso
Dim FileName
' create the FSO and Folder objects
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder("C:\Inetpub\ftproot\Recall\GoodDatabyfield")
For Each objFile In objFolder.Files
FileName = objFile.Path
Set objTextStream = fso.OpenTextFile(objFile.Path, 1) '-- For
strFileContents = objTextStream.ReadAll
strAllFileswells = strAllFileswells
+ strFileContents
objTextStream.Close
Next
Set file = fso.Createtextfile("C:\Inetpub\ftproot\Recall\New\oxy_recall.txt")
file.write (strAllFileswells)
Set file = fso.Createtextfile("C:\Inetpub\ftproot\Recall\New\oxy_recall_logs.txt")
file.Close
Set file = Nothing
Web Parse using XMLHTTP
Dim objXMLReq As New MSXML2.XMLHTTP
strURL = “http://sunh18:8082/recall43/cgi/browse.cgi”
objXMLReq.open "post", strURL, False (new 2 params can
be username/pass)
DataString = “what=DO-QUERY&write=out&RECALL_PROJECT_NAME=usa_louisiana_o”
objXMLReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
Dim strStatus As String
strStatus = objXMLReq.Status
objXMLReq.send dataString
Dim reportstring As String
reportstring = objXMLReq.responseText
String
Instr()
vLastChar = (InStr(tdValue, "<")) - vFirstChar
Mid()
vWell = Mid(tdValue,
vFirstChar, vLastChar)
Right()
Replace()
strDate = Replace(strDate, "/", "")
Select
Case
Select Case x
Case 0
Y=1
Case 1
Y=2
End Select