Jump to content

Sharkadder

Members
  • Posts

    119
  • Joined

  • Last visited

Sharkadder's Achievements

Member

Member (2/7)

0

Reputation

  1. Hi there, It is ok i sorted this now, happens that i had a parent outcome id field in my table and so each sub-outcome had a parent id which was linked to the main outcome ID. All i did was get the main outcome ID's from the database in ascending order, and then search for each sub-criteria who had that main outcome ID as their parent...then i was able to capture the information in the order i needed. Many thanks, Mark
  2. Hi there, I have an SQL table which has a field within it that holds data within a row. The field holds data for outcomes which can be listed as follows: Outcome 1 1.1 1.2 Outcome 2 2.1 2.2 1.3 Outcome 4 4.1 4.2 Outcome 3 3.1 1.4 etc. Basically, they are not in order as people have been typing them into the database table in a random order. Is there a way i can get it so that it shows everything to do with outcome 1 under outcome 1 etc. once i pull the rows from the database? e.g. Outcome 1 1.1 1.2 1.3 1.4 Outcome 2 2.1 2.2 etc. I have tried assending and decsending orders but they obviously show the numeric data first. Currently i am having to use several foreach loops in PHP to sort out the ordering and would like a more efficient way of doing this. Was not sure if i could do a command in MySQL direct. I am using MySQL 5.0 Many thanks
  3. Thanks dude i have added that code in now. I have got it all working and even the .value is now working which is really good since i modified the code to what you said. If i stumble across any other problems i shall post on here but i think it is sorted now, going to do some testing tomorrow on my script :-). Mark
  4. Hi dude, Thank you once again for the reply. Basically i have a loop which loops through all of the table rows from within a table, each iteration of the loop uses the number i which increments each time the loop goes around. This is why i have code such as: document.getElementsByTagName("tr") <---the i here is the TR element number for whichever iteration the loop is on. So if we look at what i am trying to achieve, I am trying to change the id and name of a select element and three input elements within TD tags using Javascript, alternatively i could use jQuery. I cannot use any server side languages as i allow people to add in a new row to the table by clicking on a button and so Javascript or Jquery is needed to re-number all of the ID's. e.g. i have a row which contains 4 cells, 1 is a select drop down box and the other three all contain an input box. Do you think that you could give me an example of how this could be achieved, and code which will work when using internet explorer? All i need to do is get the element from inside the TD tag and replace the ID and Name value from within it. Is there any way i can make use of GetElementbyID or GetelEmentByName and change the ID or name that way without innerHTML? Many thanks and hope you can help me with this problem..i try to stay away from Javascript and i mostly program in PHP but this has to be client side without needing to refresh the page, Mark
  5. Hi there and thank you for the reply. I have tried just about everything and silly internet explorer keeps kicking back error messages! Beginning to get frustrating now. Do you know of any function where i can pass it the tag name i am wanting to send HTML to e.g."document.getElementsByTagName("tr")" and to then replace the HTML to update the table row without innerHTML I have tried the following and it just does not work! //inside the head of the document function replaceHtml(el, html) { var oldEl = typeof el === "string" ? document.getElementById(el) : el; /*@cc_on // Pure innerHTML is slightly faster in IE oldEl.innerHTML = html; return oldEl; @*/ var newEl = oldEl.cloneNode(false); newEl.innerHTML = html; oldEl.parentNode.replaceChild(newEl, oldEl); /* Since we just removed the old element from the DOM, return a reference to the new element, which can be used to restore variable references. */ return newEl;}; //inside the body newHTML = document.getElementsByTagName("tr")[i].innerHTML.replace(document.getElementsByTagName("tr")[i].cells[j].childNodes[0].id,nameandid).replace(document.getElementsByTagName("tr")[i].cells[j].childNodes[0].name,nameandid).replace(document.getElementsByTagName("tr")[i].cells[j].childNodes[2].id,calendarid).replace(document.getElementsByTagName("tr")[i].cells[selecttdid].childNodes[0].name,selectname); //work around for innerHTMLdocument.getElementsByTagName("tr") = replaceHtml(document.getElementsByTagName("tr"),newHTML); IE just states an invalid procedure call on the line: var oldEl = typeof el === "string" ? document.getElementById(el) : el; Think you could amend my code to maybe work or perhaps tell me an alternative function. Many thanks, Mark
  6. Hi there, I have recently been trying some code out to replace the innerHTML contents from within a table row, i am now to discover that Internet Explorer which a lot of people still use insists of making innerHTML properties read only, although the code works flawlessly in Firefox and Google Chrome. The code i have currently got is shown below: document.getElementsByTagName("tr").innerHTML = document.getElementsByTagName("tr").innerHTML.replace(document.getElementsByTagName("tr").cells[j].childNodes[0].id,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[0].name,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[2].id,calendarid).replace(document.getElementsByTagName("tr").cells[selecttdid].childNodes[0].name,selectname); As you can see from the above code i am trying to tell a tag name TR which has an index of i innerHTML to change to itself but with some things replaced. You don't need to know what i am replacing inside the code as that code is all fine. What i would like to know is, what work around do i have to change the innerHTML using Javascript or JQuery? Some people have said to stick it into a Div tag but the problem is that the table is inside of a form and i am sending the elements from a form to a different page and so i would rather keep it inside the table row. I have also read that innerHTML can be used to modify specific cells from within a table i.e. contents inside a TD tag. Does anybody know how i can modify my code accordingly so that the debugger stops spitting out the "operation" error messages when i put debugging on due to trying to write to innerHTML? I have also tried using outerHTML and didn't seem to work either: document.getElementsByTagName("tr").outerHTML.replace(document.getElementsByTagName("tr").innerHTML,document.getElementsByTagName("tr").innerHTML.replace(document.getElementsByTagName("tr").cells[j].childNodes[0].id,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[0].name,nameandid).replace(document.getElementsByTagName("tr").cells[j].childNodes[2].id,calendarid).replace(document.getElementsByTagName("tr").cells[selecttdid].childNodes[0].name,selectname)); You will notice in the above i am trying to replace the innerHTML of an element(a TR tag at number i) with some things removed and again, because i am trying to modify the innerHTML...it was a no go again. Finally i have tried to modify a value property in internet explorer and this time it spits out a 5007 error saying that it is unable to set the value of the property, anybody know how i can get around this? My code again for this is below to what i currently tried: document.getElementById("unitstartdate"+totaltablerows).value = startdate; The ID's do exist and again this code worked fine in firefox and chrome, just not IE. I think i am more after a work around for both situations rather than you understanding what i am actually trying to replace etc. as the replace part of the code is fine, just will not write to HTML in Internet explorer using innerHTML, outerHTML or change a value of an element as mentioned. Any ideas are great. Mark
  7. Hi, I solved the problem with the following function, although it does require a loop. Not sure if there is a more efficent way but my page seems to load fine with it: //dropdown is the dropdown you selected and theForm is the formfunction checkselected(theForm, dropdown){for (i=0; i<theForm.length; i++) { //myval.options[myval.selectedIndex].innerHTML if (theForm.elements[i].type == "select-one") { if (dropdown.options[dropdown.selectedIndex].innerHTML == theForm.elements[i].options[theForm.elements[i].selectedIndex].innerHTML && theForm.elements[i].name != dropdown.name) { alert("You have already selected this unit. Please choose a different one."); //change index on selected dropdown back to zero dropdown.selectedIndex = 0; } }}}
  8. Hi there, I have 10 drop down boxes on a page where people can select some units they wish to study. Obviously people can pick more than one unit and so i want to avoid them from picking the same unit twice in each of the drop down boxes. I have looked into the disable function on drop down boxes but cannot figure out how i would go about disabling a drop down selection entry using Javascript. So far i have looked at the following jquery function below but it will not work on my php page as i do not have access to the head of the document on the platform i am on and just the body: $('select').change(function() { var ary = new Array(); $('select option:selected').each(function() { if ($(this).val().length > 0) { ary.push($(this).val()); } }); $('select option').each(function() { if ($.inArray($(this).val(), ary) > -1) { $(this).attr('disabled', 'disabled'); } else { $(this).removeAttr('disabled'); } });}); The example above is the sort of thing i am after but having studied the code, without it being in the head of the document it will not work and so it does not work when i change entry in the dropdown list. Does anybody have any modifications to the code or examples i can use to find out the values of all other dropdown's on a form and to then disable an index in the others where one is already selected on that index? Obviously i would need something to enable selections again. Even an alert box stating that the unit has already been picked and resetting back to original value would do. Many thanks, Mark
  9. w3fools sounds American to me...not to stereotype, most American's are decent people but it's normally a bored idiot from there who create websites slating other people. Do people have bothing better to do? If there is a problem on w3schools then why not just e-mail them/post on here and just say say "this, that and t'other is wrong, can you please fix it?" Why bother being so bored you want to create a new website just bsically causing chaos...somebody obviously has a lot of time on their hands.Besides, w3fools website doesn't even look good, looks like it was created in front page by some teenager who has clearly not grown up fully yet. How much vertical scrolling do they need? The only type of websites that can get away with that are forums, online stores, and social networking websites.I just don't see why they needed to create another website linking to other places when they could have just been helpful and posted on here any problems instead of slating a website millions of people use in order to learn the basics of website design/development. They're obviously just trying to trive traffic away or some rubbish, i think they should spend their time more wisely and create a website to do something useful.
  10. thanks dude it worked a charm...always helpful and full of the answers.I did contemplate a lookup table but this way works ok :-).
  11. Hi there,I currently have a mysql database which i would like to use to get values from a database. One of the columns in the database holds a value and if more than one value exists for an entry, the values are split up by commas for that row under the ClubID column. Here is a copy of my current query: $query="SELECT * FROM FootballPlayers WHERE ClubID LIKE '%$squad' COLLATE utf8_bin ORDER BY CASE WHEN Positions LIKE 'GK%' THEN 1 WHEN Positions LIKE 'RB%' THEN 2 WHEN Positions LIKE 'LB%' THEN 3 WHEN Positions LIKE 'SW%' THEN 4 WHEN Positions LIKE 'CD%' THEN 5 WHEN Positions = 'D' THEN 6 WHEN Positions LIKE 'RW%' THEN 7 WHEN Positions LIKE 'LW%' THEN 8 WHEN Positions LIKE 'DM%' THEN 9 WHEN Positions LIKE 'CM%' THEN 10 WHEN Positions LIKE 'AM%' THEN 11 WHEN Positions = 'M' THEN 12 WHEN Positions LIKE 'FW%' THEN 13 WHEN Positions LIKE 'ST%' THEN 14 WHEN Positions = 'A' THEN 15 ELSE 16 END"; Ok i would like the query above to search the database and to show items where ClubID is like $squad. $squad is always a number or more than one number split up by commas, e.g. 100 or 1,2,3,4 etc.The rest of the query is fine where it displays the rows depending on what playing position they equal. The problem is that if $squad is equal to a range of numbers split up by commas they it will not find anything and just show blank. e.g. if $squad = "2" and i am looking at ClubID column for a ClubID which contains "2" then nothing seems to get displayed as ClubID might say "1,2" or "2,8" etc. My question is, how can i search the database so that after the WHERE clause i can see if part of the string $squad is in the column ClubID for the current row.I have tried using LOCATE and FIND_IN_SET but i cannot appear to get them to work, maybe the right syntax is all i need :-). I am using mysql version 5.0 and the variable i search the database with is created using PHP. Any help is apprechiated.Thanks,Mark
  12. www.domain-website-hosting.com (the one im registered with)i am on the delux linux plan.you get 1 terrabyte transfer per month and 100gb of space per monthvery good and only costs me 4.50 per month.about £50 for the year and domains are only £3.99/year through them.supports php,.java,pearl,asp.net,mysql etc.also allows forwarding, sub domains, domain directory pointing etc.worth a check out
  13. EDITno i dont want the content from another page at the position you said in the previous post.what i want is content from another page called menu.htm to be imported at that position.sorry about using // for start of comments im used to commenting that way in another program lol.but yeh thats exactly where i want it as you said, i want the menu.htm code to be imported at that position in the left column.If its not possible by adding a link, ill just have to use a template in dreamweaver and update all my pages, just means i have to convert them all over to dreamweaver first.as for question 2 if anybody has a way to display the matrix style text next to a picture on same line that'd be great. <p><a href="http://sharkadder.com/mark/menuexample.html"><center><img src="/mark/htmlenter.jpg"style="padding:5px;border:5px solid white; width="250" height="200"/></a> <div id="matrix" "style=="display:inline"; "padding:5px;border:5px solid white; width="250" height="200">Sharkadder Software</div></center></p> <!-- the above code is the part of second page i am refering to -->
  14. yes i want the content at the position you said in the previous post.sorry about using // for start of comments im used to commenting that way in another program lol.but yeh thats exactly where i want the menu.htm code to be imported.If its not possible by adding a link, ill just have to use a template in dreamweaver and update all my pages, just means i have to convert them all over to dreamweaver first.as for question 2 if anybody has a way to display the matrix style text next to a picture on same line that'd be great. <p><a href="http://sharkadder.com/mark/menuexample.html"><center><img src="/mark/htmlenter.jpg"style="padding:5px;border:5px solid white; width="250" height="200"/></a> <div id="matrix" "style=="display:inline"; "padding:5px;border:5px solid white; width="250" height="200">Sharkadder Software</div></center></p> <!-- the above code is the part of second page i am refering to -->
  15. ok heres my sample code for the page, ive cut all the content out and just left it as i need, ive also commented the code:<html><head><link rel="stylesheet" type="text/css"href="2c-hd-lc-static-layout.css" /><link rel="stylesheet" type="text/css"href="2c-hd-lc-static-presentation.css" /><style type="text/css">A:link {text-decoration: none}A:visited {text-decoration: none}A:active {text-decoration: none}A:hover {font-size:24; font-weight:bold; color: red;}</style> </head><body><div id="hdr"> //layout for header from css layout file will go here</div><div id="lh-col"> // layout for menu section from ccs file will go here</div><div id="rh-col"> // layout for main content from css file will go here</div></body></html>thats my basic page layout, there it says "div id="lh-col"> thats where i am the content importing from menu.htm, although i can use the dreamweaver way.The code for my other page if you were refering to question 2 is as follows:<html><head><TITLE>Sharkadder Software,moto gp,Fast Food Fighter and Games Creation</TITLE><META name="description" content="Sharkadder,motogp,Fast Food Fighter,moto gp,Games,software Creation,Game Leagues and games downloads"><META name="keywords" content="Sharkadder,Sharkadder Software,FPS,Games,Software,game leagues,DarkBasic,Game Maker,Games Creation,Dark Basic,Game Downloads,downloads"><style type="text/css">.matrix { font-family:Lucida Console, Courier, Monotype; font-size:10pt; text-align:center; width:10px; padding:0px; margin:0px;}</style><script type="text/javascript" language="JavaScript"><!--var rows=11; // must be an odd numbervar speed=50; // lower is fastervar reveal=2; // between 0 and 2 only. The higher, the faster the word appearsvar effectalign="default" //enter "center" to center it.var w3c=document.getElementById && !window.opera;;var ie45=document.all && !window.opera;var ma_tab, matemp, ma_bod, ma_row, x, y, columns, ma_txt, ma_cho;var m_coch=new Array();var m_copo=new Array();window.onload=function() { if (!w3c && !ie45) return var matrix=(w3c)?document.getElementById("matrix"):document.all["matrix"]; ma_txt=(w3c)?matrix.firstChild.nodeValue:matrix.innerHTML; ma_txt=" "+ma_txt+" "; columns=ma_txt.length; if (w3c) { while (matrix.childNodes.length) matrix.removeChild(matrix.childNodes[0]); ma_tab=document.createElement("table"); ma_tab.setAttribute("border", 0); ma_tab.setAttribute("align", effectalign); ma_tab.style.backgroundColor="#000000"; ma_bod=document.createElement("tbody"); for (x=0; x<rows; x++) { ma_row=document.createElement("tr"); for (y=0; y<columns; y++) { matemp=document.createElement("td"); matemp.setAttribute("id", "Mx"+x+"y"+y); matemp.className="matrix"; matemp.appendChild(document.createTextNode(String.fromCharCode(160))); ma_row.appendChild(matemp); } ma_bod.appendChild(ma_row); } ma_tab.appendChild(ma_bod); matrix.appendChild(ma_tab); } else { ma_tab='<ta'+'ble align="'+effectalign+'" border="0" style="background-color:#000000">'; for (var x=0; x<rows; x++) { ma_tab+='<t'+'r>'; for (var y=0; y<columns; y++) { ma_tab+='<t'+'d class="matrix" id="Mx'+x+'y'+y+'"> </'+'td>'; } ma_tab+='</'+'tr>'; } ma_tab+='</'+'table>'; matrix.innerHTML=ma_tab; } ma_cho=ma_txt; for (x=0; x<columns; x++) { ma_cho+=String.fromCharCode(32+Math.floor(Math.random()*94)); m_copo[x]=0; } ma_bod=setInterval("mytricks()", speed);}function mytricks() { x=0; for (y=0; y<columns; y++) { x=x+(m_copo[y]==100); ma_row=m_copo[y]%100; if (ma_row && m_copo[y]<100) { if (ma_row<rows+1) { if (w3c) { matemp=document.getElementById("Mx"+(ma_row-1)+"y"+y); matemp.firstChild.nodeValue=m_coch[y]; } else { matemp=document.all["Mx"+(ma_row-1)+"y"+y]; matemp.innerHTML=m_coch[y]; } matemp.style.color="#33ff66"; matemp.style.fontWeight="bold"; } if (ma_row>1 && ma_row<rows+2) { matemp=(w3c)?document.getElementById("Mx"+(ma_row-2)+"y"+y):document.all["Mx"+(ma_row-2)+"y"+y]; matemp.style.fontWeight="normal"; matemp.style.color="#00ff00"; } if (ma_row>2) { matemp=(w3c)?document.getElementById("Mx"+(ma_row-3)+"y"+y):document.all["Mx"+(ma_row-3)+"y"+y]; matemp.style.color="#009900"; } if (ma_row<Math.floor(rows/2)+1) m_copo[y]++; else if (ma_row==Math.floor(rows/2)+1 && m_coch[y]==ma_txt.charAt(y)) zoomer(y); else if (ma_row<rows+2) m_copo[y]++; else if (m_copo[y]<100) m_copo[y]=0; } else if (Math.random()>0.9 && m_copo[y]<100) { m_coch[y]=ma_cho.charAt(Math.floor(Math.random()*ma_cho.length)); m_copo[y]++; } } if (x==columns) clearInterval(ma_bod);}function zoomer(ycol) { var mtmp, mtem, ytmp; if (m_copo[ycol]==Math.floor(rows/2)+1) { for (ytmp=0; ytmp<rows; ytmp++) { if (w3c) { mtmp=document.getElementById("Mx"+ytmp+"y"+ycol); mtmp.firstChild.nodeValue=m_coch[ycol]; } else { mtmp=document.all["Mx"+ytmp+"y"+ycol]; mtmp.innerHTML=m_coch[ycol]; } mtmp.style.color="#33ff66"; mtmp.style.fontWeight="bold"; } if (Math.random()<reveal) { mtmp=ma_cho.indexOf(ma_txt.charAt(ycol)); ma_cho=ma_cho.substring(0, mtmp)+ma_cho.substring(mtmp+1, ma_cho.length); } if (Math.random()<reveal-1) ma_cho=ma_cho.substring(0, ma_cho.length-1); m_copo[ycol]+=199; setTimeout("zoomer("+ycol+")", speed); } else if (m_copo[ycol]>200) { if (w3c) { mtmp=document.getElementById("Mx"+(m_copo[ycol]-201)+"y"+ycol); mtem=document.getElementById("Mx"+(200+rows-m_copo[ycol]--)+"y"+ycol); } else { mtmp=document.all["Mx"+(m_copo[ycol]-201)+"y"+ycol]; mtem=document.all["Mx"+(200+rows-m_copo[ycol]--)+"y"+ycol]; } mtmp.style.fontWeight="normal"; mtem.style.fontWeight="normal"; setTimeout("zoomer("+ycol+")", speed); } else if (m_copo[ycol]==200) m_copo[ycol]=100+Math.floor(rows/2); if (m_copo[ycol]>100 && m_copo[ycol]<200) { if (w3c) { mtmp=document.getElementById("Mx"+(m_copo[ycol]-101)+"y"+ycol); mtmp.firstChild.nodeValue=String.fromCharCode(160); mtem=document.getElementById("Mx"+(100+rows-m_copo[ycol]--)+"y"+ycol); mtem.firstChild.nodeValue=String.fromCharCode(160); } else { mtmp=document.all["Mx"+(m_copo[ycol]-101)+"y"+ycol]; mtmp.innerHTML=String.fromCharCode(160); mtem=document.all["Mx"+(100+rows-m_copo[ycol]--)+"y"+ycol]; mtem.innerHTML=String.fromCharCode(160); } setTimeout("zoomer("+ycol+")", speed); }}// --></script></head><body bgcolor="#000000"><p></p><span style="padding:5px;border:5px solid red; background: white"><center><img src="/mark/sharkadder.png"></center><p><center><img src="/mark/software.png"></center></p></span><p></p><br></br><p><a href="http://sharkadder.com/mark/menuexample.html"><center><img src="/mark/htmlenter.jpg"style="padding:5px;border:5px solid white; width="250" height="200"/></a> <div id="matrix" "style=="display:inline"; "padding:5px;border:5px solid white; width="250" height="200">Sharkadder Software</div></center></p><br><center><span style="color:#FFFFFF; font-size:20px">Last Update - 20th February 2007(Server back online/updates)</center><center><font size="2"><a href="http://www.addme.com">Add Me! - Search Engine Optimization</a></font> </center></html>for some reason the matrix style text just displays underneath the image, not next to it, but if i use 2 images they both show next to eachother.i could use a table but ive always been told not to use tables on website and try and avoid that approach.
×
×
  • Create New...