HTML - Loading Dynamic Options On Select On Scroll Event
I have a long list (say, 10,000) to be populated in the html select (Multiple with size, say 10 visible at a time) control. I don't want to populate all the items initially. Hence, Initially, I will load top 100 items and whenever user scrolls down and reaches the bottom of the list (say, after crossing 85th item), I want to populate the next 100 items (101th to 200th). I am using javascript to populate the options.
The question is: 1. How to identify that the user is reaching the bottom of the control? Is there any way to identify whether a option is visible or not to the user? Thanks in advance, R. Amirdha Gopal. Similar Tutorialshi , is there any way to override IE browser's scroll event? my Aim is to scroll a Div on scroll of browser scroll. i can use the following code but before i scroll the div the whole webpage's body is getting scrolled. where i need to scroll particular div "myDiv" window.onscroll = window_onscroll; function window_onscroll(){ document.getElementById("myDiv").scrollLeft =document.body.scrollLeft; } Thanks R I have a SELECT selection list (standard code), in a form which is 200px wide (located in the sidebar of a web page). Some of the OPTION elements in the list can be quite long. In FF, this isn't a problem as when you click on the dropdown arrow, the dropdown box is widened so each option text can be seen fully. But in IE, the dropdown box is limited to 200px wide, so you can't fully see some of the options. Is there any way to solve so you can fully see the options in IE? Thanks, James Hey, just a quick question... How would i go about using an image as a select option in a form? i know its possible as ive seen it around on a few sites before, but im not sure how to do it myself. tried the obvious: <select name="stars"> <option value="1"><img src="MYIMAGE"></option> </select> but oviously that doesnt work. any help would be greatly appreciated. I have a select option that I want to categorize the values for. I want a space (if possible) between the categories and I want to show the category heading before the options for each category. The "value" for the non-heading options is a unique id that I get from an array taken from a database. I am populating the select using an asp for loop. Here is an example: Code: <select> <%For i = 0 to UBound(Controls, 2) - 1)%> <option value="<%=Controls(0, i)%>"><%=Controls(1, i)%></option> <%Next%> </select> Any idea on how I can do this? Thanks a ton in advance!!! Hello, I am new to the forum and html in general... I came across this website: http://ricardovilloria.com/ and what i like about it that pages of work load without re-loading the whole page again. It is really simply done - yet I cannot see how. I don't understand what is: http://ricardovilloria.com/work/03 is it a folder? how come it doesn't have .html extension? I tried downloading it - it seems that there is an index.hml that has elements on the page/website that are always stay, in this case header and the list of links on the right. But how the other pages load into this one with only a click? the website is clearly not a php website...? how is this done? I appreciate any help thanks alimdar Hello, I have a table (with one cell). The table can be quite big (200 items) so I would like the user to be able to scroll it up and down... and I want the user to be able to add and delete an item. I have done something with javascript but it is not complete.. the delete does not work correctly ... the scroll up and down shown the same table. I don't have a clue on how to do the add button. Could you help me please? Here is what I have done so far.... Code: <html> <head> <title>Insert/Delete Table Row using DOM</title> <link rel="stylesheet" type="text/css" href="style.css"> <style type="text/ccs"> <!-- form {border:1px solid blue;} div {border:1px solid red; width:150px; overflow:auto;} .selectBox { font-size:xx-small;overflow:auto;} #tblSample td,th {padding:0.5em;} .classy0 { background-color: #234567; color:#89abcd;} .classy1 {background-color: #89abcd; color:@234567;} --> </style> <%@ include file="javascriptLib.html" %> <script language="JavaScript" type="text/JavaScript"> <!--- oculta el script para navegadores antiguos var INPUT_NAME_PREFIX = 'inputName'; // this is being set via script var TABLE_NAME = 'items_list'; // this should be named in the HTML var LABEL_NAME = 'label_list'; var ROW_BASE = 1; // first number (for display) var MAXLENGTH=5; function myRowObject(one,two) { this.one = one; // text object this.two = two; // input text object } function deleteCurrentRow(obj) { var delRow = obj.parentNode.parentNode; var tbl = delRow.parentNode.parentNode; var rIndex = delRow.sectionRowIndex; var rowArray = new Array(delRow); deleteRows(rowArray); reorderRows(tbl, rIndex); } function deleteRows(rowObjArray) { for (var i=0; i<rowObjArray.length; i++) { var rIndex = rowObjArray[i].sectionRowIndex; rowObjArray[i].parentNode.deleteRow(rIndex); } } function reorderRows(tbl, startingIndex) { if (tbl.tBodies[0].rows[startingIndex]) { var count = startingIndex + ROW_BASE; for (var i=startingIndex; i<tbl.tBodies[0].rows.length; i++) { // CONFIG: next line is affected by myRowObject settings tbl.tBodies[0].rows[i].myRow.one.data = count; // text // CONFIG: next line is affected by myRowObject settings tbl.tBodies[0].rows[i].myRow.two.name = INPUT_NAME_PREFIX + count; var tempVal = tbl.tBodies[0].rows[i].myRow.two.value.split(' '); tbl.tBodies[0].rows[i].className = 'classy' + (count % 2); count++; } } } function clearTable(option) { var tbl = document.getElementById(TABLE_NAME); if (option != 0) tbl= document.getElementById(LABEL_NAME); //var lastRow = tbl.tBodies[0].rows.length; var lastRow = tbl.rows.length; var i=lastRow-1; while (i>=0) { tbl.deleteRow(i); i--; } } function showRow (val) { var tbl = document.getElementById(TABLE_NAME); var nextRow = tbl.tBodies[0].rows.length; //var nextRow=tbl.rows.length; var iteration = nextRow + ROW_BASE; var row = tbl.tBodies[0].insertRow(nextRow); row.className = 'classy' + (iteration % 2); var cell0 = row.insertCell(0); var textNode = document.createTextNode(iteration); cell0.appendChild(textNode); var cell1 = row.insertCell(1); var txtInp = document.createElement('input'); txtInp.setAttribute('type', 'text'); txtInp.setAttribute('name', INPUT_NAME_PREFIX + iteration); txtInp.setAttribute('size', '77'); txtInp.setAttribute('value', val); txtInp.readOnly = true; cell1.appendChild(txtInp); } function addRowToTable(val,num) { var tbl = document.getElementById(TABLE_NAME); var nextRow = tbl.tBodies[0].rows.length; var iteration = nextRow + ROW_BASE; if (num == null) // appends to the end of the table { num = nextRow; } else // Insert at row num { iteration = num + ROW_BASE; } // add the row var row = tbl.tBodies[0].insertRow(num); // CONFIG: requires classes named classy0 and classy1 row.className = 'classy' + (iteration % 2); // CONFIG: This whole section can be configured // cell 0 - index var cell0 = row.insertCell(0); var textNode = document.createTextNode(iteration); cell0.appendChild(textNode); // cell 1 - input text var cell1 = row.insertCell(1); var txtInp = document.createElement('input'); txtInp.setAttribute('type', 'text'); txtInp.setAttribute('name', INPUT_NAME_PREFIX + iteration); txtInp.setAttribute('size', '62'); txtInp.setAttribute('value', val); // iteration included for debug purposes txtInp.readOnly = true; cell1.appendChild(txtInp); // cell 2 - delete button //----------------------- var cell2 = row.insertCell(2); var btnEl = document.createElement('input'); btnEl.setAttribute('type', 'button'); btnEl.setAttribute('value', 'Delete'); btnEl.onclick = function () {deleteCurrentRow(this)}; cell2.appendChild(btnEl); // Store the myRow object in each row row.myRow = new myRowObject(textNode,txtInp); } function paintTable(index) { var maxLine=index+MAXLENGTH; clearTable(0); // add Row with delete and insert options //---------------------------------------- services=document.forms[0].items.value; if ((services != null) && (services != "")) { var services_array=services.split("|"); sLength=services_array.length ; if (services_array.length < maxLine) maxLine=sLength; // add Row with delete options //----------------------------- for (var i=index; i < maxLine; i++) { val=services_array[i]; //showRow(1,val); addRowToTable(val); } showLabel(index,sLength); } } function showLabel(index,max) { clearTable(1); next_val=index+MAXLENGTH; prev_val=index-MAXLENGTH; var tbl = document.getElementById(LABEL_NAME); var nextRow = tbl.tBodies[0].rows.length; // add Previous and/or Next buttons //--------------------------------- var row = tbl.tBodies[0].insertRow(nextRow); var celNo=0; if (index !=0) { var cell0 = row.insertCell(celNo); var btnEl0 = document.createElement('input'); btnEl0.setAttribute('type', 'button'); btnEl0.setAttribute('value', 'Previous'); btnEl0.onclick = function () {paintTable(prev_val)}; cell0.appendChild(btnEl0); celNo++; } if (next_val <= max) { var cell1 = row.insertCell(celNo); var btnEl1 = document.createElement('input'); btnEl1.setAttribute('type', 'button'); btnEl1.setAttribute('value', 'Next'); btnEl1.onclick = function () {paintTable(next_val)}; cell1.appendChild(btnEl1); } } // end hiding from old browsers --> </script> </script> </head> <body onLoad=paintTable(0)> <form onSubmit="return false" method="post" name="my_form" action=""> <table border= "2" cellspacing="0" id="items_list" > <tbody></tbody> <input type=hidden name="items" value="1|2|3|4|5|6|7|8|9|10|11"> </table> <P><P><table border="1" id="label_list"> <tbody></tbody> </form> </body> </html> Please, help me! Thanks I have a select box like so Code: <select name="something" Size=10 multiple style="font-family:monospace; font-size:8pt"> <option value='opt1'>Option 1</option> <option value='opt2'>Option 2</option> <option value='opt3'>Option 3</option> ... <option value='opt9000'>Option 9000</option> </select> Now Let's say that I wanted opt45 to be preselected, how do I get the select box to position the scroll bar to where opt45 would be in the list. I've figured out how to preselect things, but the user can't tell because it's 35 lines below the select box. Can anyone help me out? I've set up a test site for a project where I have a scrollable table within an iFrame. Techincally, its an iFrame within an iFrame which gets you to a scrollable table I also added an auto-scroll with anchor-links. Everything finally works, but I really want to remove the horizontal-scroll bar that shows up, while keeping the vertical-scroll bar. (Upon testing, I found without the vertical-scroll bar, the anchor-links and auto-scroll don't work correctly.) here's the link to the test site: http://www.thegrandamerican.com/ here's the line of code I think is the correct place to make corrections: <iframe id="myiframe" name="myiframe" src="oprah june 09_news.htm" width="900" height="475" scrolling="yes" overflow-y: scroll></iframe> The hierarchy works as follows: index.htm > spotlight_news.htm > oprah june 09_news.htm The reason for all the iframes is to have elements on the higher pages that will stay in place, such as a music player and dynamic menu bar. other notes and associated files (for the auto scroll) a smooth-src-comments.js smooth.pack.js Thanks. - J Hi, I want to load a window with loading image on a button click. The new window is having an other content so before loading the actual content i want to disapear the loading image from the new window. I tried with html like <html> <img src=".." /> --------------------- Actual content " display:none " ----------------------- <script> actual contentid.display:block; img.display:none; </script> </html> But in this method am seing the image after some time lanching the window. i want to c the image right after launcing the window till my actual content loads. can anybody suggest something for this,..... http://www.heresmary.com I just finished uploading my site, and I noticed that when I click on a link the page loads then loads again a split second after. Does this happen to anyone else? If so can anyone give me any advice about it? Ive been looking EVERYWHERE for a site with a code for a scroll box with a trasparent scroll bar, Ive seen the code where I can edit the size of the box as well as the color of the box itself and I know how to do THAT. how do I make it where the code displays the scroll code as well so I can fully customize it? it seems that its always hidden.. Hi All, I would like to create a drop down box that contains number 1-50. I know I can do this using the following <option value="1">1</option> <option value="2">2</option> Can someone tell me a method for doing his a better way rather than having 50 option values? p.s is the speaking advert at the bottom of this forum the most annoying thing ever. Does nothing for me as a new site visitors other than make me want to leave. I have turned the sound off now but its real pants. Thanks all Kind Regards wedmonds I have a menu bar, viewable at http://muskmagazine.com/february/index.html, where I want some columns not to have a hyperlink but to keep the default cursor. I have tried not including the href but this then changes the cursor from default. Not being to savvy with HTML I could do with some help. Thanks Justin Sample menu code: <li><a href="#">about us</a> <ul> <li><a href="pressrelease.html">press releases</a> <li><a href="letterstoeditor.html">letters to the editor</a> <li><a href="newsletter.html">newsletter</a> <li><a href="contact.html">contact</a> <li><a href="aboutus.html">mission statement</a> </ul> </li> css code: http://muskmagazine.com/february/menu/fsmenu.css ello everyone. I'm looking for a new way to display information effectively and neatly on my website. I have looked into tables ( which I am not a fan of ), also Javascript displaying clickable tabs allowing information to be displayed when tabs are clicked. My website is animal related so i need to be able to display somewhat like shown below; Does anyone have any other ideas of how I could display this information without making my website look rubbish? Thanks Jake Hi guys, Can someone please help me with what to do with my forms; I have a form built that when someone clicks submit I want a number of actions to occur: - The information they provided to be emailed to me somehow - A message to pop up saying that the form was successfully submitted. - And to redirect them back to my home page. How do I do this?? What code do I need to use?? And is there some way that I can get the filled out form emailed to me without them having to send it?? (i.e. not using "mailto") Any help here would be really appreciated. Thanks, TroubleShooter..."yeah right!" Hi All! I'm using the Option Group/ optgroup/ Select features within a form and would like to initially display all options without having to click the arrow button to "reveal" the selections. I can't seem to find the option to allow this. Of course I can switch to a hyperlinked list, but have made extensive Option Group and would like to continue to use them. Thanks in advance!! Hello All! Is there a way to specify "no-indent" on the <optgroup> tag. When using this tag, all the options get indented and it wastes a lot of space on the screen. Any ideas would be great. Example: <select name="blah"> <optgroup label="hello"> <option style="color: #ff0000" value="test">test</option </optgroup> </select> as you can see, the style tag works for color, but I can't find any css that will put the indent to zero. thanks. Hi, Is it possible in HTML to have the list box <select >, with some of the option with different Font , may be just BOLD or italic will do my job. This is because i want to separate some option with others. Like: tableName1 ColumnName1 ColumnName2 ColumnName3 tableName2 ColumnName1 ColumnName2 ColumnName3 I want to display these in LIST box, it will be good if tablename are in BOLD or in different Font. Also i have to make them unclickable. Right Now i am doing this via: but this approach is not looking good Code: function selectionChange( selectElementID ){ if ( document.getElementById( selectElementID ) ) { var selectBox = document.getElementById( selectElementID ) ; if ( selectBox.options[ selectBox.selectedIndex ].value == "unSelectable" ){ alert ( "Select any Table, not the Schema " ); selectBox.selectedIndex = -1; } }else{ alert ( "Debug: check the code given id: '" + selectElementID + "' is not valid." ); } } Thanks Rakesh Juyal Hello All! I don't have access to any kind of server side scripting. The file I am making has to be able to run on a desktop other than the scripting for the search functions. I have a few sites that I am incorporating their search function into the HTML doc. It's a time saver but I am only having 1 hiccup. The design. I was not aware on how to incorporate into a radio button and/or drop down to search each site separately. Some of them require hidden fields that make this a challenge anyhow. I'm not sure how to design the page in order to make this work fluently. I currently have a top frame with the navigation bar and the bottom frame as the main window. When a user clicks the link, it will load another top frame doc with the nav bar and a search window for that site clicked on. So when the user types in the information, it submits it to the site and shows the results on the main frame. If they click another link, it displays a search box for that site, and same thing. However, I was wondering if there was a cleaner way of doing this? I am really interested in keeping a navigation bar but it looks cluttered with a search bar. I'm having to create a separate page for each search bar and add the navigation bar to each one. Then if something changes with the nav bar, I have to go back and fix each page. I'd really be happy to only need one nav bar. My goal would be to figure a way to keep a navigation bar, clean up the page, and keep each search function handy. I could create a 3rd frame but I think it would feel more cluttered. Here is the menu bar. Of course, this is just an example. "Form" is name of top frame. Code: <ul class="menu"> <li><a href="choose.htm" class="active"><Span>Home</span></a></li> <li><a href="Tool.htm" target="form" onClick="top.body.location='www.example.com/sitewheresearchislocated';"><Span> etc.... </ul> And here is the frame page. Code: <frameset rows="80, 1*"> <frame frameborder=0 scrolling="no" noresize="noresize" src="choose.htm" name="form" framespacing="0" border="0"> <frame frameborder=0 noresize="noresize" src="main.htm" name="body" framespacing="0" border="0"> </frameset> <script type="text/javascript"> function test() { var customer = document.docNameSuggestor.customer.value; var project = document.docNameSuggestor.project.value; var doc_type = document.docNameSuggestor.doc_type.value; var string='<table border="1" cellpadding="1" cellspacing="1"><tr>' + '<td><p>Suggested filename is: ' + customer + '_' + project + '_' + doc_type + '.<extension>' + '</p></td>' + '</tr>' + '<tr>' + '<td><p>Suggested storage path is: ...\\' + customer + '\\' + project + '\\' + doc_type + '</p></td>' + '</tr></table>'; document.getElementById("fileName").innerHTML= string; } </script> <form name="docNameSuggestor" > <td width="60%"> <p>Which customer is this document for?</p> <select name="customer" > <option>Please select</option> <option value="Ci">Ci</option> <option value="VF">VF</option> <option value="H3">H3</option> </select> <td width="60%"> <p>Which project is this document for?</p> <select name="project" > <option>Please select</option> <option value="AX1.0">AX1.0</option> <option value="AXP2.0">AX2.0</option> </select> <td width="60%"> <p>Which type of document is this?</p> <select name="doc_type"> <option>Please select</option> <option value="CRequirements">Requirement Spec</option> <option value="SRequirements">Software Requirement Spec</option> </select> <input type="submit" name="submit" value="Submit" onClick="test()"> <form action="file.html" method="post" target="_blank"></form> </form> These are my codes, Q1.How can I open results in a new window after user submit selected options? Q2:How can I populate the specific field with choices based on what user has selected from customer drop-down Please help. Any suggestions are appreciated. |