JavaScript - Search Results Into Iframe
Hello, I'm new here and have gone through your forums looking for a fix for this but so far have not found one.
Background: I am building an intranet site for my company and do not have access to server-side as of yet. Or else I would just use a different route to accomplish my issue. Issue: I am using an external app to index and build my search engine code(Search Engine Builder Pro v2.90). This works perfect if I wrap the code in a <div> or <table> but will not show inside of an iframe. HTML: Code: <div id="search"> <!-- ************************ BEGIN of search box code ************************ --> <FORM name="formSear" action="iframetest.html" method="GET" onSubmit="return qs();" rel="nofollow" target="ifr"> <script>function qs(){var f=document.formSear;var qe=f.searWords.value;if(window.encodeURIComponent)qe=encodeURIComponent(qe);if(f.area)if(f.area.value==2){document.location="http://www.google.com/search?q="+qe;return false;}var pt=document.location.href;var iq=pt.indexOf('?');if(iq!=-1)pt=pt.substring(0, iq);if(f.action)if(f.action!="")pt=f.action;var ue=pt+"?searWords="+qe;if(f.search)ue+="&search="+f.search.value;if(f.match)ue+="&match="+f.match.value;document.location=ue;return false;}</script> <p align="right"> <INPUT name="searWords"> <INPUT name="Send" type="submit" value="Search"> <p align="left"> </FORM> <!-- ************************ END of search box code ************************** --> </div> Code: <IFRAME name="ifr" width="100%" height="90%" frameBorder=0 marginHeight=0 marginWidth=0 scrolling="auto" src=""> <script type="text/javascript" language="JavaScript" src="webdata.js"> </script> <script type="text/javascript" language="JavaScript" src="searchfunc.js"> </script> </IFRAME> searchfunc.js: Code: //Translate search result info into your language StrYourSearch="Your search"; //Your search StrNewSearch="New Search"; //New Search StrCloseWindow="Close Window"; //Close Window StrFind="Found"; //Find StrItems="item(s)"; //items strResultPage="Result Page"; //Result Page strPrevious="Previous"; //Previous strNext="Next"; //Next //Options for the search engine MatchingStrategy=0; //0:Use all words,1:Use any words,2:Use exact phrase SearchStrategy=0; //0:search all text,1:Search title,2:Search keywords,3:Search description,4:Search File name ItemsPerPage=10; //Display how many items of search result on per page MatchCaseSensitive=0; //0:Not case sensitive,1:case sensitive ResultLinkTarget=""; //default value: "", can be "_self", "_top", "_blank", "_parent" or name you defined OutPutWindowType=3; //0:same window,1:new window,2:use frame,3:use iframe OutPutNewWindowProperty="resizable=yes,scrollbars=yes,toolbar=yes,menubar=yes,location=no,directories=no,width=590,height=300"; OutPutNewWindowOpenMode=0; //0:Always open new window,1:Reuse the window opened SearchFormFrame="search"; //The search box frame name OutputTarget="_top"; //default value: "result", can be "_self", "_top", "_parent" or name you defined ChangeLinkCaseProp=0; //0:Unchanged,1:to lower case,2:to upper case NumberSearchResult=1; //0:Not display,1:Display number OutputMaxCharsPerResultText=200; //how many characters of search result text will be output, default value: 200 OutPutResultTitle=1; //0: not output,1: output OutPutResultText=1; //0: not output,1: output OutPutResultUrl=1; //0: not output,1: output OutPutResultInfo=1; //0: not output,1: output OutputFileSize=1; //0: not output,1: output OutputFileDate=1; //0: not output,1: output NoHorizLine=0; //0: has Horizontal lines,1: no NoPoweredBy=1; //0: has Powered By info,1: no arrResultTitleFont=new Array("",0,'3','Arial',0,'#0000ff',1); arrResultTextFont=new Array("",0,'2','Arial',0,'#000000',0); arrResultUrlFont=new Array("",0,'2','Arial',0,'#008000',0); arrResultInfoFont=new Array("",0,'2','Arial',0,'#000000',0); arrHitTitleFont=new Array("",0,'3','Arial',0,'#cc0033',1); arrHitTextFont=new Array("",0,'2','Arial',0,'#cc0033',0); DecorateBefore=""; //Decorate HTML code before search results DecorateAfter=""; //Decorate HTML code after search results AddLinksParameters=""; //Add parameters to the search result link ExcludedSearchWords=new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0","!","*","(",")","-","_","+","=","\\","{","}","[","]",":",";","\"","'","<",">",",",".","?","/","about","above","after","again","all","also","am","an","and","any","are","as","at","back","be","been","before","behind","being","below","but","by","can","click","do","does","done","each","else","etc","ever","every","few","for","from","generally","get","go","gone","has","have","hello","here","how","if","in","into","is","it","just","keep","later","let","like","lot","lots","made","make","makes","many","may","me","more","most","much","must","my","need","no","not","now","of","often","on","only","or","other","others","our","out","over","please","put","so","some","such","than","that","the","their","them","then","there","these","they","this","try","to","up","us","very","want","was","we","well","what","when","where","which","why","will","with","within","you","your","yourself","&"); RootReplaceURL=""; SEBWebsite="http://www.aleadsoft.com";SEBEmail="support@aleadsoft.com";SEBAuthor="ALeadSoft.com, Inc.";CurScriptType="JS";bNoSpace=0;eval(unescape("Copyright%3D%22ALeadSoft__Search_Engine_Builder%22%3BstrCode%3D%22%23%3E%23%3D%7C%25@%23+*%5E-%23%3D%7C%25%23%3D%7C%25@%23+*%5E-%23%3D%7C%25@%23+*%23%3D%7C%25@%23+*@%23+*%23%3D%7C%25@%23+*%3D%7C%25@%23+*%5E%3Ca%20href%3D%27%22%3Bvar%20s0%3D%22%22%3B%20var%20s1%3Dnew%20Array... Anything after this is just way too long to link as code here. So much that it locks my browser up if I try to highlight it all. Yes I know the .js is very unorganised but thats the format that Search Engine Builder outputs it. So I have added a rel="nofollow" target= to the <form> and tried to link it that way. I have tried dynamically calling an iframe through Jscript. If I could get all my pages to stay in another tyope of container when a link is clicked I would just use it instead. At this point I'm just looking for any ideas to fix my issue. Thank you in advance. Jalowery Edit: I was also thinking of pulling the results.html page into the iframe which is much easier. But then I can't figure out how to get the search results to be sent to the results.html page. Similar TutorialsWe are integrating a IDX feed and I can not figure out a line of code. CMS: Joomla site: http://www.craigteamreno.com Top right hand corner "Quick Search" http://www.craigteamreno.com/quicksearch.js Currently when you click the link it goes to their site with the result we want. We want it to go to our site, just like "search homes," does. I believe it is simple but my HTML is even simpler. The link should just point to a wrap page.... but I dont know how to do that. THANKS! Please try a search on my webpage (search box is located at top of sidebar on the left): http://www.americanchic.net/help Here is the code implemented on the search results page: Code: <div id="cse-search-results"></div> <script type="text/javascript"> var googleSearchIframeName = "cse-search-results"; var googleSearchFormName = "cse-search-box"; var googleSearchFrameWidth = 500; var googleSearchDomain = "www.google.com"; var googleSearchPath = "/cse"; </script> <script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script> The original code (from my Google custom search control panel) included a FrameWidth of 600 and I changed it to 500 but it didn't make a difference. Any ideas? Hi guys im trying use a live search on my website, and iv found a code on the following link: http://www.w3schools.com/php/php_ajax_rss_reader.asp i understand it all but need to tweak it to suit my needs. What i need for it to do is search multiple drop down requests, for example: 1. first name 2. last name I want it to search by what has been selected (it is not necesary that all fields need to be selected, default will be any), however in the html it states: xmlhttp.open("GET","getrss.php?q="+str,true); and it only shows 1 option, i would like it to show multiple records. and once the records are shown, I would like the option of amending the search result any time in the search. please help Hello, I need some help.. I'm using this example script and need the search results to post to a another frame and not a new window. Code: searchh.js // Multi Search - Head Script // copyright Stephen Chapman, 4th August 2005 // you may copy this clock provided that you retain the copyright notice function start() { var i = Math.floor(Math.random() * document.searchbox.engine.length); document.searchbox.engine[i].selected = true; } window.onload = start; function search() { searchTerm = document.searchbox.term.value; var searchVal = ''; if(searchTerm != '') { searchTerm = searchTerm.replace(/\s/ig, '+'); searchEngine = document.searchbox.engine[document.searchbox.engine.selectedIndex].value; switch (searchEngine) { case 'about': searchVal = 'http:\/\/search.about.com\/fullsearch.htm?terms=' + searchTerm; break; ... default: break;} if (searchVal != '') window.open(searchVal,'search'); }} Code: searchb.js //copyright Stephen Chapman, 4th August 2005 // you may copy this script provided that you retain the copyright notice document.write('<div align="center"><form name="searchbox" action="">\nSearch for: <input name="term" type="text" size="15" maxlength="80" \/> With:\n<select name="engine">\n<option value="about">About<\/option>\n<option value="accoona">Accoona<\/option>\n<option value="alltheweb">AllTheWeb<\/option>\n<option ... value="yahoo">Yahoo<\/option>\n<\/select>\n<input type="button" value="Go!" onclick="search()" \/>\n<\/form><\/div>'); Sorry but i'm just newbie , just need a little hint on what to do. Need the results to showup in frame "test1" Or if someone can direct me: looking for a multi search drop down list in a frame environment where after submitting the string the results would show in another frame Thanks Hi all, I'm having trouble paging from six to six the search results coming from a webservice, hope someone can help : Let's see it with an example: The variable that stores the number of elements of the search results array is called contentLenght. Let's say that contentLenght equals 9. Then I need a div showing 6 elements an another sowing 3 elements. If contentLenght equals 7, I need a div showing 6 elements an another showing one element. If the value of contentLenght is 18, then I need three divs containing 6 elements each.. and so on. Now the paging itself: if I have just one div there's no need for paging, but if I have two of more I have to show the page's numbers. Then when a number is clicked the present div must hide and the div containing the elements for the page number should show. Am I right with the approach? I was about to paste some code but the only way I've come out with the six to six paging is with a long if else structure, and I'm sure there's a smarter way of doing it. Thanks a ton in advance Hi all, I'm currently building a new search engine that will search around 15,000 products and would like some general advice as to the best way to approach it. I want to offer instant results, so the user will click an icon and the results change, no submit buttons or postbacks. My database is MS SQL and my frontend is ASP.Net, but for this I'm looking to develop the majority of the search functionality in JavaScript. What I'm asking really is what people recommend for the best way to approach providing instant results. My current thinking is an initial database query loads the data into XML, then use JavaScript and XSLT to filter the XML and display the results, then as filters change these can be handled by the JavaScript and XSLT rather than going back to the database. Does anyone have any general advice on the best performing way to provide this sort of functionality that ultimately will give the quickest results? Thanks in advance! Hey there everyone. I'm a bit of a newb with javascript and php so apologies if this question is a bit simple, although I can't get my head round how to go about doing it. I have a search page where a user can type in a search box, or they can use an alphabetical list to search for the record they're looking for. Eg they click 'a' and all the records beginning with the letter 'a' appear. I'd also like to have it so that each record has a number of tags, and I'd then like to be able to filter records according to which tags have been selected - preferably using checkboxes. For example, perhaps the tags would be colours and the records represented shoes. There'd be checkboxes for blue, yellow, black, brown and so on. At first all colours would be shown, but if the user clicks on brown the all but the brown shoes dissappear. like I say, I'm new to learning php so please be gentle. Also I'm using Cakephp so if there's anyway to make it easier using Cake then I'd love to know. thanks Hi all!, I'm having a few challenges trying to create a link to a "new" search from a database search results page. This maybe a better example: My goal is: To allow website visitors to searches site for i.e. "Dog Collars", the results page lists every "dog collar" and store that carries "dog collars" (in database). At that point I would like to have links (on the results page) to all brands of "dog collars" and stores that carry "dog collars". I would like to then be able to click on a "brand" (text link) of "dog collars" and then generate a new results page that lists all store and vendor information. thank you in advance! Erick p.s. this is a link to a site that has a similar featu http://69.0.211.58/~pubexpress/ami/html/index.html I'd be grateful for any help please. I've just started to build my first ever sencha app and am pleased with the results so far, but am now stuck on one thing. I've built a search form and want to be able to display the results on the same page, but this is where I'm stuck. The form works and sends the results using GET, but it doesn't send it to the correct place. I want to show it on the same page (I've built a php file called search.php to handle the results), but it reloads the whole app with the variables in the url. I've tested all of the code away from the app and it works perfectly so I know the problem isn't with the code, but more with my lack of understanding of Sencha so would be extremely grateful for any help. Code: searchForms = new Ext.TabPanel({ fullscreen: true, title: 'Search', displayField: 'text', sto searchForm, iconCls: 'search', items: [{ id: 'searchSubmit', xtype: 'form', standardSubmit : true, scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Keywords', defaults: { // labelAlign: 'right' labelWidth: '35%' }, items: [{ xtype: 'textfield', name: 'keywords', id: 'keywords', placeHolder: 'EG: Music, TV', autoCapitalize : true, required: true, useClearIcon: true }] }, { xtype: 'fieldset', title: 'Advanced Search', items: [{ xtype: 'selectfield', name: 'genre', id: 'genre', label: 'Genre', options: [{ text: 'All', value: ' ' text: 'Country', value: '1' text: 'Sci-Fi', value: '2' text: 'Western', value: '3' }] }, { xtype: 'selectfield', name: 'media', id: 'media', label: 'Media', options: [{ text: 'All', value: ' ' text: 'Music', value: '1' text: 'TV', value: '2' text: 'Movie', value: '3' }] }] }, { layout: 'vbox', defaults: {xtype: 'button', flex: 1, style: 'margin: .5em;'}, items: [{ text: 'Search', ui: 'confirm', scope: this, hasDisabled: false, handler: function(){ searchForms.submit({ url: 'search.php' }); } }, { text: 'Reset', ui: 'decline', handler: function(){ searchForms.reset(); } }] }] }] }); I've then tried to use this to display the results on the same page, but as I say this just doesn't work. It doesn't call the search.php page at all. I've made sure all of the files (except the index.js file which is in a js folder) are in the same directory as the index.html file. I've also tried to load the file in the app seperately by using: Code: Ext.regModel('mobile', { fields: [ {name: 'text', type: 'string'} ] }); var searchForm = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'search.php?keywords=test', reader: { type: 'tree', root: 'items' } } }); and that works perfectly so I know that all of the php stuff is working and does work with Sencha Touch, but I'm just not sure how to get it to only work when somebody clicks 'search' I'd be grateful for any help with this as I've spent days searching the web to get this fix, but nothing seems to be working I don't know if this is of help, but the main javascript file is: Code: var tabPanel; var homePanel = new Ext.Panel({ title: 'Home', iconCls: 'home', fullscreen: true, scroll:{direction:'vertical',threshold:7}, items: [{ html: '<center><p>Home</p></center>' }] }); var servicePanel = new Ext.Panel({ title: 'Services', iconCls: 'team', fullscreen: true, items: [{ html: '<center>Please choose a service</center>' }] }); var searchPanel = new Ext.Panel({ title: 'Search', iconCls: 'search', fullscreen: true, items: [{ html: '<center>Search</center>' }] }); var feedtabpanel = new Ext.Carousel({ title: 'More', iconCls: 'more', fullscreen: true, sortable : true, xtype:'panel', scroll:{direction:'vertical',threshold:7}, items: [ { title: 'Contact', html : '<center><h1>Contact Us</h1></center>', }, { title: 'Feedback', html : '<center><h1>Let us know what you think<h1></center>', }, { title: 'Tell a friend', html : '<center><h1>Tell your friends how much you love this app</h1></center>', } ] }); searchForms = new Ext.TabPanel({ fullscreen: true, title: 'Search', displayField: 'text', sto searchForm, iconCls: 'search', items: [{ id: 'searchSubmit', xtype: 'form', standardSubmit : true, scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Keywords', defaults: { // labelAlign: 'right' labelWidth: '35%' }, items: [{ xtype: 'textfield', name: 'keywords', id: 'keywords', placeHolder: 'EG: Music, TV', autoCapitalize : true, required: true, useClearIcon: true }] }, { xtype: 'fieldset', title: 'Advanced Search', items: [{ xtype: 'selectfield', name: 'genre', id: 'genre', label: 'Genre', options: [{ text: 'All', value: ' ' text: 'Country', value: '1' text: 'Sci-Fi', value: '2' text: 'Western', value: '3' }] }, { xtype: 'selectfield', name: 'media', id: 'media', label: 'Media', options: [{ text: 'All', value: ' ' text: 'Music', value: '1' text: 'TV', value: '2' text: 'Movie', value: '3' }] }] }, { layout: 'vbox', defaults: {xtype: 'button', flex: 1, style: 'margin: .5em;'}, items: [{ text: 'Search', ui: 'confirm', scope: this, hasDisabled: false, handler: function(){ searchForms.submit({ url: 'search.php' }); } }, { text: 'Reset', ui: 'decline', handler: function(){ searchForms.reset(); } }] }] }] }); Ext.regModel('mobile', { fields: [ {name: 'text', type: 'string'} ] }); var searchForm = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'search.php', reader: { type: 'tree', root: 'items' } } }); var store = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'areas.php', reader: { type: 'tree', root: 'items' } } }); var nestedList = new Ext.NestedList({ fullscreen: true, title: 'Location', displayField: 'text', sto store, iconCls: 'locate', }); nestedList.on('leafitemtap', function(subList, subIdx, el, e) { var store = subList.getStore(), record = store.getAt(subIdx), recordNode = record.node, title = nestedList.renderTitleText(recordNode), card, preventHide, anim; if (record) { card = record.get('card'); anim = record.get('animation'); preventHide = record.get('preventHide'); } if (card) { tabPanel.setCard(card, anim || 'slide'); tabPanel.currentCard = card; } }); var services = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'subcats.php', reader: { type: 'tree', root: 'items' } } }); var servicesList = new Ext.NestedList({ fullscreen: true, title: 'Services', displayField: 'text', sto services, iconCls: 'team', }); servicesList.on('leafitemtap', function(subList, subIdx, el, e) { var store = subList.getStore(), record = store.getAt(subIdx), recordNode = record.node, title = servicesList.renderTitleText(recordNode), card, preventHide, anim; if (record) { card = record.get('card'); anim = record.get('animation'); preventHide = record.get('preventHide'); } if (card) { tabPanel.setCard(card, anim || 'slide'); tabPanel.currentCard = card; } }); Ext.setup({ icon: 'icon.png', glossOnIcon: false, tabletStartupScreen: 'tablet_startup.png', phoneStartupScreen: 'phone_startup.png', onReady: function() { tabPanel = new Ext.TabPanel({ tabBar: { dock: 'bottom', layout: { pack: 'center' } }, fullscreen: true, ui: 'dark', animation: { type: 'cardslide', cover: true }, items: [ homePanel, nestedList, servicesList, searchForms, feedtabpanel ] }); } }) I'd like to create two dropdown (select) lists with a search button next to it so if the user chooses A in the first list and C in the second list and clicks 'search', the results return items that relate to both A and C. Practical Example: User chooses "London" in the first dropdown and "Middle Schools" in the second. Result returns the middle schools I've listed for London. How can this be done or if it can't, is there another way to achieve what I want? -edit- I found what I wanted he http://www.alistapart.com/d/complexd...ts&de=Pancakes However, now my question is what would I put in for the form "action" to populate the results? Hi, I have a search box he http://www.michael-williams.com.au/index.html I am using the below Java Script and form code to pass the entered value to search.html: <script type="text/javascript"> function searchVerify() { if(document.search.qt.value=="Enter keywords...") document.search.qt.value="";return true;} </script> <form id="search" method="get" action="search.html" onsubmit="return searchVerify()"> <p><input type="hidden" name="col" value="eu" ID="Hidden1"/><input type="hidden" name="style" value="nonpbs" ID="Hidden2"/><input type="hidden" name="nh" value="50" ID="Hidden3"/></p> <p style="float:left;"><label for="Search">Search:</label><input id="Text1" name="qt" type="text" value="Enter keywords..." class="textfield" onfocus="this.value=''" /><input type="submit" value="Go" class="button" ID="Submit1" NAME="Submit1"/></p> </form> I want to know how I can pass the entered value into the google search in the iframe on search.html. Can anyone help with this issue? Thanks. Hi there, I have a problem that I've been scouring the internet for an answer but have been unable to find a solution and wondered if anyone could offer their assistance here? I'll try to explain my problem: On my homepage (index.html), I have a search field which fires the users input (text) parameters off to another website to perform the search (ie. results.html). What I'm now trying to do is create an iframe on index.html which shows the search results on the same page (without the user having to visit the other website. Does anyone know if this is possible using javascript? The reason behind this is so that we can use the search on our old website on our new one... without having to re-invent the wheel. Any help would be greatly appreciated! Craig I have a page with a GoogleMap with a GoogleBar and I would like the GoogleBar to appear with something written in it already and to have that search executed. In other words, I would like to "write something to the GoogleBar and press Enter" automatically as soon as the map loads. How can I do this? btw: By GoogleBar, I mean the search bar that appears on the map after using the enableGoogleBar() function. view the rest of my comments works on the first page but when i extend the search results the rest of the view comments wont expand. click View all 3 comments and it will show all comments then click more button try to click the view all comments on the next comment and nothing happens but the screen jumping up to the top. http://www.runningprofiles.com/membe...ll_Script.php# Why is this?? What do i need to do to fix it? PHP Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>9lessons Applicatio Demo</title> <link href="frame.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> <script type="text/javascript" src="jquery.oembed.js"></script> <script type="text/javascript"> $(function() { $('.more').live("click",function() { var ID = $(this).attr("id"); if(ID) { $("#more"+ID).html('<img src="moreajax.gif" />'); $.ajax({ type: "POST", url: "http://www.runningprofiles.com/members/shout/data/ajax_more.php", data: "lastmsg="+ ID, cache: false, success: function(html){ $("ol#updates").append(html); $("#more"+ID).remove(); // removing old more button } }); } else { $(".morebox").html('The End');// no results } return false; }); }); $(function() { $(".view_comments").click(function() { var ID = $(this).attr("id"); $.ajax({ type: "POST", url: "../viewajax.php", data: "msg_id="+ ID, cache: false, success: function(html){ $("#view_comments"+ID).prepend(html); $("#view"+ID).remove(); $("#two_comments"+ID).remove(); } }); return false; }); }); $(function() { $(".comment_button").click(function() { var element = $(this); var boxval = $("#content").val(); var dataString = 'content='+ boxval; if(boxval=='') { alert("Please Enter Some Text"); } else { $("#flash").show(); $("#flash").fadeIn(400).html('<img src="ajax.gif" align="absmiddle"> <span class="loading">Loading Update...</span>'); $.ajax({ type: "POST", url: "update_ajax.php", data: dataString, cache: false, success: function(html){ $("ol#update").prepend(html); $("ol#update li:first").slideDown("slow"); document.getElementById('content').value=''; $('#content').value=''; $('#content').focus(); $("#flash").hide(); $("#expand_url").oembed(boxval); } }); } return false; }); //comment slide $('.comment').live("click",function() { var ID = $(this).attr("id"); $(".fullbox"+ID).show(); $("#c"+ID).slideToggle(300); return false; }); //commment Submint $('.comment_submit').live("click",function() { var ID = $(this).attr("id"); var comment_content = $("#textarea"+ID).val(); var dataString = 'comment_content='+ comment_content + '&msg_id=' + ID; if(comment_content=='') { alert("Please Enter Comment Text"); } else { $.ajax({ type: "POST", url: "comment_ajax.php", data: dataString, cache: false, success: function(html){ $("#commentload"+ID).append(html); document.getElementById("textarea"+ID).value=''; $("#textarea"+ID).focus(); } }); } return false; }); // Delete Wall Update $('.delete_update').live("click",function() { var ID = $(this).attr("id"); var dataString = 'msg_id='+ ID; var parent=$("#bar"+ID); jConfirm('Are you sure you want to delete this message?', 'Confirmation Dialog', function(r) { if(r==true) { $.ajax({ type: "POST", url: "delete_comment.php", data: dataString, cache: false, success: function(html){ $("#comment"+ID).slideUp(); } }); } return false; }); return false; }); }); </script> <style type="text/css"> body { font-family:Arial, Helvetica, sans-serif; font-size:12px; } .update_box { background-color:#D3E7F5; border-bottom:#ffffff solid 1px; padding-top:3px } a { text-decoration:none; color:#d02b55; } a:hover { text-decoration:underline; color:#d02b55; } *{margin:0;padding:0;} ol.timeline {list-style:none;font-size:1.2em;}ol.timeline li{ display:none;position:relative; }ol.timeline li:first-child{border-top:1px dashed #006699;} .delete_button { float:right; margin-right:10px; width:20px; height:20px } .cdelete_button { float:right; margin-right:10px; width:20px; height:20px } .feed_link { font-style:inherit; font-family:Georgia; font-size:13px;padding:10px; float:left; width:350px } .comment { color:#0000CC; text-decoration:underline } .delete_update { font-weight:bold; } .cdelete_update { font-weight:bold; } .post_box { height:55px;border-bottom:1px dashed #006699;background-color:#F3F3F3; width:499px;padding:.7em 0 .6em 0;line-height:1.1em; } #fullbox { margin-top:6px;margin-bottom:6px; display:none; } .comment_box { display:none;margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:50px; } .comment_load { margin-left:90px; padding:10px; background-color:#d3e7f5; width:300px; height:30px; font-size:12px; border-bottom:solid 1px #FFFFFF; } .text_area { width:290px; font-size:12px; height:30px; } #expand_box { margin-left:90px; margin-top:5px; margin-bottom:5px; } embed { width:200px; height:150px; } *{ margin:0px; padding:0px } ol.timeline { list-style:none } ol.timeline li { position:relative; border-bottom:1px #dedede dashed; padding:8px; } .morebox { font-weight:bold; color:#333333; text-align:center; border:solid 1px #333333; padding:8px; margin-top:8px; margin-bottom:8px; -moz-border-radius: 6px; -webkit-border-radius: 6px; } .morebox a{ color:#333333; text-decoration:none} .morebox a:hover{ color:#333333; text-decoration:none} #container{margin-left:60px; width:580px } </style> </head> <body> <?php include '../../../settings.php'; ?> <div align="center"> <table cellpadding="0" cellspacing="0" width="500px"> <tr> <td> <div align="left"> <form method="post" name="form" action=""> <table cellpadding="0" cellspacing="0" width="500px"> <tr><td align="left"><div align="left"> <h3>What are you doing?</h3></div></td></tr> <tr> <td style="padding:4px; padding-left:10px;" class="update_box"> <textarea cols="30" rows="2" style="width:480px;font-size:14px; font-weight:bold" name="content" id="content" maxlength="145" ></textarea><br /> <input type="submit" value="Update" id="v" name="submit" class="comment_button"/> </td> </tr> </table> </form> </div> <div style="height:7px"></div> <div id="flash" align="left" ></div> <ol id="update" class="timeline"> </ol> <ol class="timeline" id="updates"> <div id='old_updates'> <?php $small=mysql_query("select * from messages2 order by msg_id desc LIMIT 5"); while($r=mysql_fetch_array($small)) { $id=$r['msg_id']; $msg=$r['message']; ?> <div align="left" class="post_box"> <span style="padding:10px"><?php echo $msg.'....'.$id; ?> </span> </div> <?php //Here $id is main message msg_id value. $csql=mysql_query("select * from comments where msg_id_fk='$id' order by com_id "); $array = mysql_fetch_assoc($csql); $comment_count=mysql_num_rows($csql); if($comment_count>2) { $second_count=$comment_count-2; ?> <div class="comment_ui" id="view<?php echo $id; ?>"> <a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php echo $comment_count; ?> comments</a> </div> <?php } ?> <div id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <table width="80%"> <?php $small2=mysql_query("select * from comments where msg_id_fk='$id' order by com_id limit 2 "); while($rowsmall22=mysql_fetch_array($small2)) { $c_id=$rowsmall22['com_id']; $comments=$rowsmall22['comment']; ?> <div class="comment_actual_text"> <tr> <td style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" valign="top"> <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" align="left"> <tr> <td width="5%" style="VERTICAL-ALIGN: middle; TEXT-ALIGN: center"><img style="WIDTH: 30px; HEIGHT: 30px" alt="srinivas" src="http://www.gravatar.com/avatar.php?gravatar_id=7a9e87053519e0e7a21bb69d1deb6dfe" border="1" /></td> <td style="VERTICAL-ALIGN: top; TEXT-ALIGN: left"> <strong>Jarratt</strong> <?php echo $comments; ?> <br /><span style="COLOR: #a9a9a9">10 min ago - ID = <?php echo $c_id.'...'.$id;?> </span></td> </tr> </table><br /> </td> </tr> </div> <?php } ?> </table> </div> <?php } ?> </ol> <div id="more<?php echo $id; ?>" class="morebox"> <a href="#" class="more" style='display:block;width:100%;' id="<?php echo $id; ?>">more <?php echo $id; ?></a> </div> </div> </td> </tr> </table> </div> </body> </html> if it help here is ajax_more.php PHP Code: <?php include("../../../settings.php"); if(isSet($_POST['lastmsg'])) { $lastmsg=$_POST['lastmsg']; $lastmsg=mysql_real_escape_string($lastmsg); $small=mysql_query("select * from messages2 WHERE msg_id<'$lastmsg' order by msg_id desc LIMIT 2"); while($r=mysql_fetch_array($small)) { $id=$r['msg_id']; $msg=$r['message']; ?> <div align="left" class="post_box"> <span style="padding:10px"><?php echo $msg.'....'.$id; ?> </span> </div> <?php //Here $id is main message msg_id value. $csql=mysql_query("select * from comments where msg_id_fk='$id' order by com_id "); $array = mysql_fetch_assoc($csql); $comment_count=mysql_num_rows($csql); if($comment_count>2) { $second_count=$comment_count-2; ?> <div class="comment_ui" id="view<?php echo $id; ?>"> <a href="#" class="view_comments" id="<?php echo $id; ?>">View all <?php echo $comment_count; ?> comments</a> </div> <?php } ?> <div class="comments" id="view_comments<?php echo $id; ?>"></div> <div id="two_comments<?php echo $id; ?>"> <table width="50%"> <?php $small2=mysql_query("select * from comments where msg_id_fk='$id' order by com_id limit 2 "); while($rowsmall22=mysql_fetch_array($small2)) { $c_id=$rowsmall22['com_id']; $comments=$rowsmall22['comment']; ?> <div class="comment_actual_text"> <tr> <td style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" valign="top"> <table style="WIDTH: 100%; BORDER-COLLAPSE: collapse" align="left"> <tr> <td width="5%" style="VERTICAL-ALIGN: middle; TEXT-ALIGN: center"><img style="WIDTH: 30px; HEIGHT: 30px" alt="srinivas" src="http://www.gravatar.com/avatar.php?gravatar_id=7a9e87053519e0e7a21bb69d1deb6dfe" border="1" /></td> <td style="VERTICAL-ALIGN: top; TEXT-ALIGN: left"> <strong>Jarratt</strong> <?php echo $comments; ?> <br /><span style="COLOR: #a9a9a9">10 min ago - ID = <?php echo $c_id.'...'.$id;?> </span></td> </tr> </table><br /> </td> </tr> </div> <?php } ?> </table> </div> <?php } ?> <div id="more<?php echo $id; ?>" class="morebox"> <a href="#" class="more" style='display:block;width:100%;' id="<?php echo $id; ?>">more <?php echo $id; ?></a> </div> <?php } ?> Hi all, I hope you can help I have some code which: 1) Opens a URL (e.g. google.com) in a hidden iframe, then 2) Redirects the visitor to a different URL (e.g. yahoo.com) after it has loaded... This works exactly as I need. What I'd like to do is the following: 1) Open a URL (e.g. google.com) in a hidden iframe, then 2) Redirect the visitor to a different URL (e.g. yahoo.com) in a full-screen iframe 3) The address bar of the full-screen iframe should be my domain (obviously!) Here's what I have so far... Hidden iframe -> New URL Code: Code: <html> <body> <script type="text/javascript"> var page_body = document.getElementsByTagName('body'); var myframe = document.createElement('iframe'); var id = Math.random(); myframe.setAttribute('id', 'myFrame'+id); myframe.src = 'http://google.com'; //First open Google in hidden iframe myframe.setAttribute('frameborder', '0') myframe.setAttribute('width', '0'); myframe.setAttribute('height', '0'); if (myframe.attachEvent) { myframe.attachEvent('onload', function() { top.location = 'http://yahoo.com'; //Once loaded redirect to Yahoo -- but the address bar shows yahoo.com -- I want the address bar to display mydomain.com/page.html }); } else if (myframe.addEventListener) { myframe.addEventListener('load', function() { top.location = ('http://yahoo.com'); }, false); } page_body[0].appendChild(myframe); </script> </body> </html> I have an example of some code which displays the full screen iframe, but my problem is... ...I can't figure out how to redirect to this after the hidden iframe has loaded Here's an example of how I want the redirect to display -- after the initial hidden iframe has loaded: Code: <html> <head> <script type="text/javascript"> function sendParams() { document.body.style.overflow = "hidden"; } </script> </head> <body> <!--Open Yahoo.com in a full screen iframe, and disable extra scrollbar --> <iframe height="100%" width="100%" frameBorder="no" onload="sendParams()" src="http://yahoo.com"></iframe> </body> </html> I've been beating my head against the wall today trying to figure this out, and I'm fresh out of ideas. If you can help, you'll have some serious gratitude and good karma thrown your way! Best wishes, and thanks in advance, Paul Is there a way to resize an iframe dynamically so that you never get the scroll bar and essentially hide that there is an iframe? Better integration really. Basically I want to iframe a forum into my site so that the design down the sides and top which my friend does using iweb are not messed with. We have a central area which can be longer or shorter depending on the forum. Hi there everybody, I've got this problem which I can't solve myself... I've got a website which has 3 colums and is hosted on domain1.com. in the right column I've got an Iframe which loads content from domain2.com . this content are some textboxes and a datepicker tool. if I press the 'search'-button in this Iframe I would like to refresh the mainpage (from domain1.com) so that another Iframe appears in the middle column. in this column i would like to load a new form from domain2.com which contains the values that I've put in in the form from the right Iframe. Unfortunally I can't get this to work... Will somebody please help me? In this case, Let's take Google Search as example: The code is JScript .NET, which is basically a .NET version of Javascript. Regardless of language, Anyone with appending type of skill can answer my question. This code is used in Fiddler(It's a Man-in-the-middle proxy) Code: if (oSession.uriContains("&q=")) // oSession is a Fiddler object session // uriContains() function, checks for case-insensitive string from the URI { var str = oSession.fullUrl; var sAppend = "test1+test2+test3"; if (!oSession.uriContains(sAppend)) { oSession.fullUrl = str.replace( "&q=","&q="+sAppend); } } For those who are confused, It says, If &q= is present in the URI, replace/append &q= with &q=test1+test2+test3 Problem: It appends test1+test2+test3 instantly, when it sees &q= in the URL. Basically, how do I make it wait until I click the submit/search button Thank you. Update: I heard about Onsubmit() event, but not really familiar with it. How do I use it? like, should I go to google source page and edit the form id? Also, Any other methods besides Onsubmit()? I have used iframes for my site and found various javascripts so when a person clicks on say the audio page he http://www.krillmeed.com/index.html it takes them to the audio page but will load it into the index.html page. The problem is, especially with search engines, to point to that page, this is what the URL looks like to send someone to that page: http://www.krillmeed.com/?frame=0&sr...m%2Faudio.html which is not very clean at all, this is the javascript that i found that at least works: Child iframe script: Code: <script type="text/javascript"> (function(){ var qstr = '?frame=0&src=' + encodeURIComponent(location.href), lre = new RegExp('^' + location.protocol + '//' + location.hostname + '(()|(/)|(/index.html)|(/index.php))(()|(\\' + qstr + '))$'); if (!lre.test(parent.location.href)){ top.location.href = '/' + qstr; } })(); </script> Parent iframe Script: Code: <script type="text/javascript"> (function(){ function getQval(n) { if(typeof n !== 'string'){ return null; } var r = new RegExp('[?&;]' + n + '=([^&;#]*)'), m = location.search; return (m = r.exec(m))? unescape(m[1]) : null; } var f = getQval('frame'), s = getQval('src'); if(f && frames[f] && s && s.indexOf(location.protocol + '//' + location.hostname + '/') === 0){ frames[f].location.href = s; } })(); </script> Is there a "cleaner" way of doing this? This was an old code, i have yet to find a more modern one. Thank you in advance. Hi Everyone! I have a website that I'm designing where I have the need to search multiple sites at specific times. By this I mean that In some cases, we would want to search only the internet using google, or only search the site that I've created (which currently uses the jse_search.js solution), or only our company's website. I currently have four different search boxes that will search either the internet, the internal site, a separate internal site, or a third-party website, which all working fine. The problem is that the search boxes take up quite a bit of space, and the layout is becoming cumbersome. Is there a way in Javascript I could use a single search box and a drop-down list to select which method to use? The code I'm currently using is below. With the exception of the Google search function, I've modified some of the site names to general site names and paths to preserve the company's anonymity: Code in the <head> tag: Code: <script language="JavaScript1.3" type="text/javascript" src="jse_form.js"> </script> Code in the <body> tag: Code: <!--Begin Internal Site Search 1!--> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td><form name="jse_Form" onsubmit="search_form(jse_Form);return false"> <input type="text" name="d" size="30"> </tr></td> <tr><td> <input type="button" value="Internal Site Search 1" onclick="search_form(jse_Form)"> </form> </tr></td> </table> <!--End Internal Site Search 1!--> <!--Begin Internal Site Search 2!--> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td> <!--webbot bot="Search" S-Index="all" S-Fields S-Text="Search for:" I-Size="20" S-Submit="Start Search" S-Clear="Reset" S-TimestampFormat="%m/%d/%Y" TAG="BODY" b-useindexserver="1" startspan --> <form action="http://sitesearch2.idq" method="POST"><input type="text" name="UserRestriction" size="30" value> </tr></td> <tr><td style="text-align: center;"> <input type="submit" value="Internal Site Search 2"></form> </form> <!--webbot bot="Search" i-checksum="4210" endspan --> </td></tr> </table> </div> <!--End Internal Site Search!--> <!--Begin Google Search!--> <form method="get" action="http://www.google.com/search"> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td> <input type="text" name="q" size="30" maxlength="233" value="" /> </tr></td> <tr><td align="center"> <input type="submit" value="Google Search" /></td></tr> </table> </div> </form> <!--End Google Search!--> <!--Begin Third Party Search!--> <form id="keywordSearchForm" method="get" action="http://www.site3.html"> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td> <input class="input" type="text" name="keyword" size="30" /> </tr></td> <tr><td align="center"> <input type="hidden" name="origin" value="keywordsearch" /><input id="go" class="button" tabindex="0" type="submit" value="Third Party Search" /> </td></tr> </table> </div> </form> <!--End Third Party Site Search!--> |