Jump to content

watagal

Members
  • Posts

    120
  • Joined

  • Last visited

Posts posted by watagal

  1. You're targeting the document in a frame, aren't you? And the object has no properties. Well, that is simply because those documents are not allowed to be targeted!

    Thanks DanYes, I am targeting a document in another frame in the same frameset and/or perhaps in a parent frameset. All are mine (ie they are local to my website).The funny (strange) thing is I can target them with this function below -- as long as I put in the alert() statement - it works. Only when I remove the alert(), it produces the error "Error: oDiv has no properties".
    function togElementDisplay(sFrameID,sElementID) {	if (sFrameID != "")	{  var oDiv = top.frames[sFrameID].document.getElementById(sElementID);	} else {  var oDiv = document.getElementById(sElementID);	}//	alert(oDiv);	oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}

    I'm wondering if there is timing issue? Is there a work around?Thanks again for all the help,

  2. Can you post the full code instead of snippets please?

    Frameset:
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Notebook</title></head><frameset framespacing="0" border="0" frameborder="0" rows="75,*,25">	<frame name="frmHeader" scrolling="no" noresize target="main" src="SupportPages/header.htm" marginwidth="0" marginheight="0">	<frameset cols="200,*">		<frame name="frmToc" src="SupportPages/toc.htm" marginwidth="0" marginheight="0" scrolling="auto" target="_self">		<frameset rows="101,*,10">			<frame name="frmTopicHeader" src="SupportPages/login_header.htm" scrolling="yes" marginwidth="0" marginheight="0" target="_self">			<frame name="frmTopicMain" src="SupportPages/login_main.htm" marginwidth="0" marginheight="0" scrolling="yes" target="_self">			<frame name="frmComment" src="SupportPages/comments.htm" marginwidth="0" marginheight="0" scrolling="no" target="_self">		</frameset>	</frameset>	<frame name="frmFooter" src="SupportPages/footer.htm" marginwidth="0" marginheight="0" scrolling="no" noresize target="_self">	<noframes>	<body>	<p>This page uses frames, but your browser doesn't support them.</p>	</body>	</noframes></frameset></html>

    HTML header.htm:

    <html><head>	<meta http-equiv="Content-Language" content="en-us">	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">	<title>Main Header</title>	<base target="main">	<script language="javascript" src="../../Code/JS/GuiUtils.js"></script>	<script language="javascript" src="../../Code/JS/browserUtils.js"></script>	<script language="javascript">		function loadSignInPages() {			loadPage2Frame(top.frames['frmTopicHeader'],'login_header.htm');			loadPage2Frame(top.frames['frmTopicMain'],'login_main.htm');			togElementDisplay('','divWelcomeName')			togElementDisplay('frmTopicMain','divRegister')//			togElementDisplay(top.frames['frmTopicMain'],'divRegister')		}	</script></head><body text="#EFFEEB" bgcolor="#000000" topmargin="0" leftmargin="0" rightmargin="0" bottommargin="6" marginwidth="0" marginheight="0">	<table width="100%" id="table1" cellspacing="0" cellpadding="0" height="75" style="border-width: 0px">		<tr>			<td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #008080; padding-bottom: 5px">			<p style="margin-left: 15px; margin-top: 0; margin-bottom: 0">			<span style="letter-spacing: 0px">			<font face="Mistral" color="#008080" style="font-size: 55pt">My</font><font face="Mistral" color="#008080" style="font-size: 48pt">'s 			Notebook Series</font></span></p>			<p style="margin-top: 6px; margin-bottom: 0" align="left"> </td>			<td style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #008080; padding-bottom: 5px" valign="top">			<table border="0" id="table2" cellspacing="0" cellpadding="0" width="100%" height="100%">				<tr>					<td width="100%" valign="top" align="right" height="12">						<div id="divMemberCmds" style="display:none">							<p style="margin-right: 30px; margin-top: 6px; margin-bottom: 0">							<font face="Tahoma" size="1" color="#99CCFF">								<span style="cursor: pointer" onclick="togPanels()">My Account</span>							</font>							<font face="Tahoma" size="1" color="#FFFFFF"><b> | </b></font> 							<font face="Tahoma" size="1" color="#99CCFF">								<span style="cursor: pointer" onclick="togPanels()">Sign Out</span>							</font>							</div>						<div id="divGuestCmds" style="display:none">							<p style="margin-right: 30px; margin-top: 6px; margin-bottom: 0">							<font face="Tahoma" size="1" color="#99CCFF">							<span style="cursor: pointer" onclick="loadSignInPages()">								Register Now							</span>							</font><font face="Tahoma" size="1" color="#C0C0C0">							</font>						</div>					</td>				</tr>				<tr>					<td valign="top" align="right">						<font color="#FFFFFF" face="Tahoma">							<div id="divWelcomeName">								<p style="margin-right: 30px">								Welcome!								</p>							</div>						</font>					</td>				</tr>			</table>			</td>		</tr>	</table></body></html>

    My GuiUtils.js:

    function welcome(sWho){	var o = top.frames['frmHeader'].document.getElementById('divWelcomeName');	o.innerHTML = "<p style='margin-right: 30px'>Welcome "+sWho+"!</p>";}//	Toggle Single Element on/off//		togElementDisplay('frameTopicMain','divTab2');function togElementDisplay(sFrameID,sElementID) {	if (sFrameID != "")	{		var o = top.frames[sFrameID].document.getElementById(sElementID);	} else {		var o = document.getElementById(sElementID);	}//	alert(oDiv);	o.style.display = (o.style.display == "none") ? "block" : "none";}//	Swap Multiple Elements on/off - i.e. Tab Panels//  	var aElementIDs = ['divTab1','divTab2','divTab3'];						// Defined Once in HTML file//		onclick="swapElementDisplay('frameTopicMain','divTab2',aElementIDs);"	// function swapElementDisplay(sFrameID,sElementID,aElementIDs) {	for (var i=0; (i < aElementIDs.length); i++) {		if (sFrameID != "")	var o = top.frames[sFrameID].document.getElementById(aElementIDs[i]);		else 				var o = document.getElementById(aElementIDs[i]);				if (sElementID != aElementIDs[i])	o.style.display = "none";		else								o.style.display = "block";	}}

    I think this is all, thanks for helping out

  3. GreetingsHere's the function that works with the 'alert()' statement and doesn't work when I comment it out. Please help, I'm just not getting this one.

    function togElementDisplay(sFrameID,sElementID) {	if (sFrameID != "")	{  var oDiv = top.frames[sFrameID].document.getElementById(sElementID);	} else {  var oDiv = document.getElementById(sElementID);	}//	alert(oDiv);	oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}

    Error = "Error: oDiv has no properties"

  4. Did you know that you can test the output of a certain string?Before you use the string as the ID of the frame, maybe you should alert() it to see what JavaScript actually understands from it. :)

    Thanks Dan -- I put in an alert(sFrameID) and it did report back the name of the frame I was sending it. The funny thing is as soon as I put in the alert() statement, the function worked. As soon as I removed the alert() statement, it fails again with the same error.Any other ideas.Thanks
  5. Greetings,I'm loading a page into an ajoining frame -- I got it working by hardcoding the frame's ID, but when I pass it the frame's ID -- it breaks.Here's what work:

    function loadPage2Frame(sURL) {top.frames["frameMain"].location=sURL;}

    Here's what DOES NOT work:

    function loadPage2Frame(sFrameID,sURL) {top.frames[sFrameID].location=sURL;}  // where sFrameID = "frameMain"

    I get "Error: top.frames[sFrameID] has no properties".I've tried:

    top.frames["\""+sFrameID+"\""].location  // Double quotestop.frames["'"+sFrameID+"'"].location  // single quotes

    Any ideas on how to do this?thanks

  6. Thanks all - I got it to work with:

    function togPanel(sFrame,sDivID) {	if (sFrame != "") {		var oDiv = window.parent.frames[sFrame].document.getElementById(sDivID);	} else {		var oDiv = document.getElementById(sDivID);	}	oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}

    "sFrame" var can either be the frame's index number or the 'name' or 'id' property in the <frame> element. This navigates across frames to toggle a <div> element on/off Thanks for pointing me in the right direction.

  7. I need you to post ALL the code for ALL the pages in the frameset ......
    Here's main.htm
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Notebook</title></head><frameset framespacing="0" border="0" frameborder="0" rows="75,*,25">	<frame id="frmHeader" name="frmHeader" scrolling="no" noresize target="main" src="SupportPages/header.htm" marginwidth="0" marginheight="0">	<frameset cols="200,*">		<frame id="frmToc" name="frmToc" src="SupportPages/toc.htm" marginwidth="0" marginheight="0" scrolling="auto" target="_self">		<frameset rows="101,*,10">			<frame id="frmTopicHeader" name="frmTopicHeader" src="SupportPages/login_header.htm" scrolling="yes" marginwidth="0" marginheight="0" target="_self">			<frame id="frmTopicMain" name="frmTopicMain" src="SupportPages/login_main.htm" marginwidth="0" marginheight="0" scrolling="yes" target="_self">			<frame id="frmComment" name="frmComment" src="SupportPages/comments.htm" marginwidth="0" marginheight="0" scrolling="no" target="_self">		</frameset>	</frameset>	<frame id="frmFooter" name="frmFooter" src="SupportPages/footer.htm" marginwidth="0" marginheight="0" scrolling="no" noresize target="_self">	<noframes>	<body>	<p>This page uses frames, but your browser doesn't support them.</p>	</body>	</noframes></frameset></html>

    Here's login_main.htm

    <html><head><meta http-equiv="Content-Language" content="en-us"><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Topic Main</title><base target="_self"><script language="JavaScript">	<!--//	function togPanel(sDivID) {		var oDiv = document.getElementById(sDivID);		oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";	}	function togPanel2(iFrame,sDivID) {		if (iFrame != -1) {//			var oDiv = parent.document.getElementById(sFrame).document.getElementById(sDivID);			var oDiv = parent.document.frames[iFrame].document.getElementById(sDivID);		} else {			var oDiv = document.getElementById(sDivID);		}		oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";	}	//--></script></head><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0"		style="text-align: left" bgcolor="#000000">				<table border="0" width="100%" id="table7" cellspacing="0" cellpadding="0">					<tr>						<td valign="top">						<p style="margin: 6px 3px" align="left">						<span onclick ="togPanel('divRegister')" style="cursor: pointer">						<font color="#99CCFF" size="2" face="Tahoma">						Register Now</font><font color="#FFFFFF" size="2" face="Tahoma">						</font>						</span>						<font size="2" face="Tahoma"><font color="#FFFFFF">  --  						It's free!  						</font> 						<span onclick="togPanel2(1,'divToc');" style="cursor: pointer">							<font color="#99CCFF">TOC</font><font color="#FFFFFF"> </font>						</span>						</font></p>						<div id="divRegister" style="display:none">						<form method="POST">							<p style="margin: 6px 3px" align="left">							<table border="1" width="95%" id="table8" bgcolor="#EFFEEB">							<tr>								<td>							<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table9">								<tr>									<td width="10" align="left" height="10"></td>									<td width="479" height="10">									<p align="left"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtFirstName" size="20" type="text" value="First Name"><input name="txtLastName" size="20" type="text" value="Last Name"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtCompany" size="41" type="text" value="Company Name"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtEmail" size="60" type="text" value="Email Address"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtEmail2" size="60" type="text" value="Email Address - Confirm"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479"> </td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtLoginName" size="30" type="text" value="Login Name"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtPassword1" size="30" type="text" value="Password"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">								<p align="left">								<input name="txtPassword2" size="30" type="text" value="Password - Confirm"></td>								</tr>								<tr>									<td width="10" align="left"> </td>									<td width="479">									<p align="right">							<input type="submit" value="Register" name="btnRegister">							<input type="reset" value="Reset" name="btnRegisterReset"></td>								</tr>							</table>								</td>							</tr>						</table>						</p>						</form>						</div>						</td>					</tr>					</table>				</body></html>

    These are the 2 file, thanks for taking a look at them

  8. please post ALL your code
    parent.document.frames['framename'].document.getElementById('divid'parent.document.getElementById('frameid').document.getElementById('divid')

    Thanks again,Here's my main.htm framesets:
    <frameset framespacing="0" border="0" frameborder="0" rows="75,*,25">    <frame id="frmHeader" name="frmHeader" scrolling="no" noresize target="main" src="SupportPages/header.htm" marginwidth="0" marginheight="0">    <frameset cols="200,*">        <frame id="frmToc" name="frmToc" src="SupportPages/toc.htm" marginwidth="0" marginheight="0" scrolling="auto" target="_self">        <frameset rows="101,*,10">            <frame id="frmTopicHeader" name="frmTopicHeader" src="SupportPages/login_header.htm" scrolling="yes" marginwidth="0" marginheight="0" target="_self">            <frame id="frmTopicMain" name="frmTopicMain" src="SupportPages/login_main.htm" marginwidth="0" marginheight="0" scrolling="yes" target="_self">            <frame id="frmComment" name="frmComment" src="SupportPages/comments.htm" marginwidth="0" marginheight="0" scrolling="no" target="_self">        </frameset>    </frameset>        <frame id="frmFooter" name="frmFooter" src="SupportPages/footer.htm" marginwidth="0" marginheight="0" scrolling="no" noresize target="_self">    <noframes>    <body>        <p>This page uses frames, but your browser doesn't support them.</p>    </body>    </noframes></frameset>

    Here's my JS code:

    function togPanel(sFrame,sDivID) {if (sFrame != "none") {//var oDiv = parent.document.getElementById(sFrame).document.getElementById(sDivID);var oDiv = parent.document.frames[sFrame].document.getElementById(sDivID);} else {var oDiv = document.getElementById(sDivID);}oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}

    here's my html code which calls the above function:

    <span onclick="togPanel('frmToc','divToc');" style="cursor: pointer">TOC<span>

    I still get error: "Error: parent.document.frames has no properties" in both IE and FF. Any ideas?thanks again.

  9. var oDiv = top.var oDiv = window.opener.document.getElementById('divXX');

    Sorry, "sFrameName" is the name of a frame in the frameset. I'm trying to access the a <div> element across frames. I tried your first example: top.sFrameName.document.getElementById('divXX') - but I get the error: "sFrameName has no properties"Any other ideas?Thanks
  10. Just put the name of the frame.
    top.Framename.getElementById(sdivid)

    Thanks, I tried it both ways and I get no action:
    /*function togPanel(iFrame,sDivID) {    if (iFrame != -1)    var oDiv = top.frames[iFrame].getElementById(sDivID)    else    var oDiv = document.getElementById(sDivID);    oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}*/function togPanel(sFrame,sDivID) {    if (sFrame != "")    var oDiv = top.+sFrame+.getElementById(sDivID)    else    var oDiv = document.getElementById(sDivID);    oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}In the first function (commented out now) - I get "Object dosesn't support method".  And in the 2nd function, I get "Object Expected" error.A little bit more help please.Thanks,

  11. GreetingsI'm playing around with <div> tag and can toggle their display on/off using (in same frame) this java script:

    function togDiv(sDivID) {    var oDiv = document.getElementById(sDivID);    oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";}

    Now I want to toggle the <div> in another frame, how can I rewrite this js to access a <div> element in another frame?Thanks,

  12. GreetingsI'm investigating the best way to layout a tab interface. The tabs are defined dynamically via a query from my MySQL database using PHP - so predefined web graphics is not the solution. But I want a graphic look & feel.Beneath the graphics, I assume I should use a <table> tag with 1 row and x number of columns (or tabs).Is there a way to lay down the tab's graphics in the cell and place the tab's text over the top? Or should each cell contain another table with 6 (?) cells to handle each graphic aspect (left, left-top-corner,top, right-top-corner,right) of a tab and the tab's text in the middle-bottom cell? I hope this explains it enough.Thanks,

  13. For those who may be interested -- concerning the XMLHttpRequest.open() method, I found on Mozilla:Ajax:Getting Started the following:

    The second parameter is the URL of the page you're requesting. As a security feature, you cannot call pages on 3rd-party domains. Be sure to use the exact domain name on all of your pages or you will get a 'permission denied' error when you call open(). A common pitfall is accessing your site by domain.tld, but attempting to call pages with www.domain.tld.
    I assume since I won't be calling 3rd party sites for data retrieval, I can use relative URLs (../code/php/something.php) in my XMLHttpRequestObject.open(). If this a wrong assumption, please let know - i'm still a newbie at this. Relative seems to work in IE6 and FF107.wg
  14. Greetings,I can get the Ajax test page (see my previous post) to work in Internet Explorer v6, but it fails in FireFox107. I've traced it down to my JS "getAjaxData()" function @ "oAjax.open("GET",dataSource);". I get the following error in the js console: "Error: uncaught exception: Permission denied to call method XMLHttpRequest.open".

    function getAjaxData(dataSource,divId) {	if (oAjax) {  oAjax.open("GET",dataSource);    oAjax.onreadystatechange = function()  { 	 if (oAjax.readyState == 4 && oAjax.status == 200)	document.getElementById(divId).innerHTML = oAjax.responseText;  }  oAjax.send(null);	}}	// getAjaxData()

    "oAjax" is my XMLHttpRequest object. Can anyone point me in the right direction?TIA, watagal

  15. Greetings,I'm new at AJAX, reading "AJAX for Dummies" and can't get the first listing to work. Here's my HTML code (ajax.htm):

    <html><head>	<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">	<title>AJAX Testing</title>	<script language="javascript" src="../Code/JS/ajax.js"></script>	<script language="javascript" src="../Code/JS/browser.js"></script>	<script language="javascript">		var oAjax = new newAjaxConnection();		if (!oAjax ) alert("Ajax Error initializing XMLHttpRequest!");	</script></head><body>	<h1>Fetching Data from Server:</h1>	<form>		<input type="button" value="Display Ajax Data" onclick="getAjaxData(oAjax,'file1.txt','divAjax');"><br>		<input type="button" value="Display Browser Type" onclick="checkBrowser('divBrowser');"><br>	</form>		<div id="divAjax"><p>The fetched data will go here</p></div>	<div id="divBrowser"></div></body></html>

    The 'checkBrowser()' code works so I know my JS code is being loaded and I can write to a <div> section on my browser page.My 'ajax.js' code looks like this:

    function newAjaxConnection(){	var o = false;	// if Microsoft	try {   o = new ActiveXObject("Msxml2.XMLHTTP");	}	catch (e) {  try { 	 o = new ActiveXObject("Microsoft.XMLHTTP");  }  catch (e2) { 	 o = false;  }	}		// if not Microsoft (Mozilla, Firefox, Safari, Opera, ...)	if (!o && typeof XMLHttpRequest != 'undefined')	o = new XMLHttpRequest();	return o;}	// newAjaxConnection()function getAjaxData(oConn,dataSource,divId) {	if (oConn) {  oConn.open("GET",dataSource,true);    oConn.onreadystatechange = function() { 	 if (oConn.readyState == 4 && oConn.ststus == 200) {    document.getElementById(divId).innerHTML = oConn.responseText; 	 }  }  oConn.send(null);	}}	// getAjaxData()

    The 'file1.txt' resides in the same folder as 'ajax.htm' and contains one line that looks like this:

    <h2>************** This was fetched from the server using Ajax *********************</h2>

    I tried running it in IE6 and Firefox v1.0.7 - no luck. I'm hitting the wall and in dire need for some fresh eyes.Thanks,

  16. Greetings,I just got my PHP script working to add a new table through mysql_query("CREATE TABLE ..."). Now I would like to add a PHP check to see if the table already exists. Can someone point me in the right direction?Thanks, WG

  17. Thanks Scott,I tinkered w/ the "httpd.conf" file in Apache and restarted the Apache service in Win XP and now it works. Not really sure what fixed the problem or I would be happy to pass it on.Sorry for the bother.

  18. Greetings,I tinkered w/ the "httpd.conf" file in Apache and restarted the Apache service in Win XP and now it works. Not really sure what fixed the problem or I would be happy to pass it on.Sorry for the bother.

×
×
  • Create New...