www.webdeveloper.com
Results 1 to 10 of 10

Thread: Colorbox JQuery n00b needs help

  1. #1
    Join Date
    Mar 2012
    Posts
    41

    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

  2. #2
    Join Date
    Feb 2012
    Location
    Pensacola, FL
    Posts
    337
    I would go jQuery all the way.
    But in the meantime, what is this: window.script1333582856829=1;

  3. #3
    Join Date
    Mar 2012
    Posts
    41
    mmm I do not see such line

  4. #4
    Join Date
    Feb 2012
    Location
    Pensacola, FL
    Posts
    337
    Quote Originally Posted by blak422 View Post
    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)}});
    });

  5. #5
    Join Date
    Mar 2012
    Posts
    41
    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.

  6. #6
    Join Date
    Feb 2012
    Location
    Pensacola, FL
    Posts
    337
    Whoah. Weird. Looks like the divs are nested wrong.

  7. #7
    Join Date
    Mar 2012
    Posts
    41
    you mean on the ref page?

  8. #8
    Join Date
    Mar 2012
    Posts
    41
    http://larsoncomputerservices.com/de...separator.html

    that is the ref page, and the divs look fine to me

  9. #9
    Join Date
    Feb 2012
    Location
    Pensacola, FL
    Posts
    337
    ...? No you are having some CSS issues. All the data is there.....I think.

  10. #10
    Join Date
    Mar 2012
    Posts
    41
    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
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.19957 seconds
  • Memory Usage 2,947KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (10)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates