-
Posts
120 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Everything posted by watagal
-
GreetingsWith Dan's help, I've come to the conclusion that frames do not play well. Therefore, I'm converting my framesets to a single table with <div> statements defining the 'frame' areas.Now I want to load external (file) HTML code in the <div> area by setting the innerHTML in JS. Should I approach this by parsing the HTML file, forming a large string, and then set the innerHTML?As always, Thanks
-
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,
-
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
-
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"
-
GreetingsHow do I test if a passed variable is an object of a string?Thanks
-
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
-
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
-
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.
-
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
-
No, the frameset are in main.htm and ths JS function togPanel() is defined in another htm file which is subsequently loaded into one on the frames.Does this help clerify things?TY
-
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.
-
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
-
GreetingsI've been fussing and researching this all night. What is the syntax for including a variable (sFrameName) in the following: var oDiv = top.+sFrameName+.getElementById('divXX'); Thanks
-
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,
-
Thanks, is there a way to refer to the frame by ID name (ie "frmMain")?Thanks again,
-
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,
-
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,
-
For those who may be interested -- concerning the XMLHttpRequest.open() method, I found on Mozilla:Ajax:Getting Started the following: 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
-
Thanks, I got it to work now in FF107 using a local path (file://D:/...).This signature stuff from Mozilla adds another level of complexity, I'm sure it is all for good. Oh well...Thanks again,wg
-
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
-
Sorry, I found my mistake. Misspelled 'status' in my 'getAjaxData()' function. Told ya I needed fresh eyes. thanks Rimer for helping out.Again sorry! watagal
-
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,
-
Thanks, is there time penalty if the <database> does exists and have thousands of records?WG
-
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
-
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.