Colorbox JQuery n00b needs help
I am trying to load a page in a colorbox So Im calling the colorbox directly but Im getting garbage. Here is the code
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<style type="text/css">
body {
margin: auto;
padding: 0;
font:15px arial,sans-serif;
}
table, th, td {
border: 1px solid black;
}
</style>
<link rel="stylesheet" href="colorbox.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script src="jquery.colorbox-min.js"></script>
<script>
var sid = "";
GetSession();
function AddAsset() {
var asset = document.getElementById("assets").value;
if(asset != '0')
{
var url = asset+".html?sid="+sid;
//window.open(url);
$.colorbox({html:url});
}
}
function ChildClose() {
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var response = xmlhttp.responseText;
//alert (response);
location.reload();
}
}
xmlhttp.open("GET","php/ReleaseSession.php?sid="+sid,true);
xmlhttp.send();
}
function GetSession() {
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var response = xmlhttp.responseText;
//alert(response);
sid = response;
}
}
xmlhttp.open("GET","php/getsession.php",true);
xmlhttp.send();
}
function getSeparatorCW() {
//alert("in function");
var id = 1;
var xmlhttp;
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
var response = xmlhttp.responseText;
var strArray = response.split("|");
buildTable(strArray);
}
}
xmlhttp.open("GET","php/loadAssets.php?assetID="+id,true);
xmlhttp.send();
}
function openWindow(id,name) {
var url = "separator.html?id="+id+"&name="+name+"&sid="+sid+"&flag=edit";
window.open(url);
}
function buildTable(strArray) {
//alert("in buildTable");
var numRows;
var assetCount = 0;
var nameCount = 0;
var assetID = [];
var assetName =[];
var numCols = 14;
var table = document.getElementById('inventory');
var headerArray = new Array("Desc","Versatile Assets","Jan 1/2012","Total Ast. Cost","Amm. Sch.",
"Jan 30 2012","Feb 30 2012","Mar 30 2012","Apr 30 2012","May 30 2012",
"Jun 30 2012","Jul 30 2012","Aug 30 2012");
for(var r=0;r<strArray.length;r++)
{
//alert("in for loop");
if(strArray[r] == "separator cw trailer")
{
//alert("in for loop if");
assetID[assetCount] = strArray[r-1];
assetName[assetCount] = strArray[r];
assetCount++;
}
}
numRows = assetCount+1;
for(x=0;x<numRows;x++)
{
var newRow = document.createElement('tr');
newRow.id = 'Row'+x;
table.appendChild(newRow);
for(y=0;y<numCols;y++)
{
if(x == 0 && y != 13)
{
var newHeader = document.createElement('th');
newHeader.id = 'Header'+x;
newHeader.innerHTML = headerArray[y]
newRow.appendChild(newHeader);
}
else
{
var newCol = document.createElement('td');
newCol.id = 'Col'+y;
if (y != 0)
{
newCol.innerHTML = "$0.00";
}
if (y == 1)
{
var paramId = assetID[nameCount];
var paramName = assetName[nameCount];
newCol.innerHTML = assetID[nameCount]+" "+assetName[nameCount++]
newCol.onclick = (function(paramId,paramName)
{
return function()
{
openWindow(paramId,paramName);
};
})(paramId,paramName);
}
newCol.title = 'Row '+(x+1)+','+'Col '+(y+1);
newRow.appendChild(newCol);
}
}
}
}
</script>
</head>
<body onload ="getSeparatorCW()">
<table id="inventory"></table>
<select id="assets">
<option value="0" selected="selected" disabled="disabled">--Select Asset--</option>
<option value="separator">Separator CW</option>
</select>
<input type="button" value="Add" onclick="AddAsset()"/>
</body>
</html>
http://larsoncomputerservices.com/de...readsheet.html is the page.
Thanks
I would go jQuery all the way.
But in the meantime, what is this: window.script1333582856829=1;
mmm I do not see such line
Originally Posted by
blak422
mmm I do not see such line
Honestly, I couldnt find it either but JS Console was throwing an error involving it. It is gone now, now you are missing a bracket '}'
Code:
$(document).ready(function(){
$.colorbox({onOpen:function(){ alert(url)} });
});
ok so I tried that to see if I was getting the url passed to the colorbox stuff and it worked now the only problem is that when the colorbox pops all I see are the borders all jacked up and idk why.
Whoah. Weird. Looks like the divs are nested wrong.
you mean on the ref page?
...? No you are having some CSS issues. All the data is there.....I think.
i just took all the css from all pages and still have the same issue. this is just weird
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks