Jump to content


  • Posts

  • Joined

  • Last visited

xbl1's Achievements


Member (2/7)



  1. Hi;I'd like to ask you a question;why my mouse cursor does not sit in the position of the leftmost and topmost of a bbcode form. Thanks.my form as following;bbcode form <form action="story_verify1.php" method="post" name="editform" onsubmit="return checkForm(this)"><table id="editform"><tr> <td id="story">My story</td></tr> <tr> <td> <input type="button" class="button" value="bold" name="bold" onclick="javascript:tag('b', '[b]', 'bold*', '[/b]', 'bold', 'bold');" onmouseover="helpline('bold')" /> <input type="button" class="button" value="italic" name="italic" onclick="javascript:tag('i', '[i]', 'italic*', '[/i]', 'italic', 'italic');" onmouseover="helpline('italic')" /> <input type="button" class="button" value="underline" name="underline" onclick="javascript:tag('u', '[u]', 'underline*', '[/u]', 'underline', 'underline');" onmouseover="helpline('underline')" /> <input type="button" class="button" value="quote" name="quote" onclick="javascript:tag('q', '[quote]', 'quote*', '[/quote]', 'quote', 'quote');" onmouseover="helpline('quote')" /> <input type="button" class="button" value="code" name="code" onclick="javascript:tag('c', '', 'code', 'code');" onmouseover="helpline('code')" /> <input type="button" class="button" value="url" name="url" onclick="javascript:tag('url', '[url]', 'url*', '[/url]', 'url', 'url');" onmouseover="helpline('url')" /> <input type="button" class="button" value="img" name="img" onclick="javascript:tag('img', '', 'img', 'img');" onmouseover="helpline('img')" /> <br /> Font size: <select name="fontsize" onchange="font('[size=' + this.form.fontsize.options[this.form.fontsize.selectedIndex].value + ']', '[/size]'); this.selectedIndex=2;" onmouseover="helpline('fontsize')" class="form_elements_dropdown"> <option value="50%" >Tiny</option> <option value="75%" >Small</option> <option value="100%" selected="selected" >Normal</option> <option value="150%" >Large</option> <option value="200%" >Huge</option> </select> Font color: <select name="fontcolor" onchange="font('[color=' + this.form.fontcolor.options[this.form.fontcolor.selectedIndex].value + ']', '[/color]'); this.selectedIndex=0;" onmouseover="helpline('fontcolor')" class="form_elements_dropdown" > <option value="black" style="color:black">Black</option> <option value="silver" style="color:silver">Silver</option> <option value="gray" style="color:gray">Gray</option> <option value="maroon" style="color:maroon">Maroon</option> <option value="red" style="color:red">Red</option> <option value="purple" style="color:purple">Purple</option> <option value="fuchsia" style="color:fuchsia">Fuchsia</option> <option value="navy" style="color:navy">Navy</option> <option value="blue" style="color:blue">Blue</option> <option value="aqua" style="color:aqua">Aqua</option> <option value="teal" style="color:teal">Teal</option> <option value="lime" style="color:lime">Lime</option> <option value="green" style="color:green">Green</option> <option value="olive" style="color:olive">Olive</option> <option value="yellow" style="color:yellow">Yellow</option> <option value="white" style="color:white">White</option> </select> <br /> <input type="text" name="helpbox" size="75" class="helpbox" readonly="readonly"/> </td></tr><tr> <td> Post:***<br /> <textarea rows="10" cols="50" name="Content" class="form_elements_text" id="thread"> <?php echo trim(stripslashes($_SESSION['story_content'])); ?> </textarea> </td></tr> <tr> <td colspan="2" class="security_check"> <?php $_SESSION['fvalue']=rand(0,9); echo $_SESSION['fvalue']; ?> + <?php $_SESSION['svalue']=rand(0,9); echo $_SESSION['svalue']; ?> = <input type="text" name="result" /> ** </td></tr><tr> <td colspan="2" id="post"> <input type="submit" name="Post" value="Post" class="button" /> <input type="submit" name="preview" value="Preview" class="button"/> <input type="reset" value="Reset" class="button" onclick="javascript:confirm_reset();"/> </td></tr></table></form> bbcode.js //Variables for controlling opening and closing tags (function tag)var b = 2;var i = 2;var u = 2;var q = 2;var mail = 2;var url = 2;var img = 2;//Function for creating non-font tagsfunction tag(v, tagadd, newbut, tagclose, oldbut, name){ var r = document.selection.createRange().text;rr = tagadd + r + tagclose;if(r){document.selection.createRange().text = rr;}else{if (eval(v)%2 == 0){eval("window.document.editform."+name+".value = newbut;");var content = window.document.editform.content.value;window.document.editform.content.value = content + tagadd;window.document.editform.content.focus();}else{eval("window.document.editform."+name+".value = oldbut;");var content = window.document.editform.content.value;window.document.editform.content.value = content + tagclose;window.document.editform.content.focus();}eval(v+"++;");}}//Function for adding font color and size tagsfunction font(bbopen, bbclose) { var r = document.selection.createRange().text; rr = bbopen + r + bbclose; if(r) { document.selection.createRange().text = rr; }else{ var post = document.editform.post; post.value += bbopen +r+ bbclose; post.focus(); } return;} function smilie (tag) { var myField; tag = ' ' + tag + ' '; if (document.getElementById('thread') && document.getElementById('thread').type == 'textarea') { myField = document.getElementById('thread'); } else { return false; } if (document.selection) { myField.focus(); sel = document.selection.createRange(); sel.text = tag; myField.focus(); } else if (myField.selectionStart || myField.selectionStart == '0') { var startPos = myField.selectionStart; var endPos = myField.selectionEnd; var cursorPos = endPos; myField.value = myField.value.substring(0, startPos) + tag + myField.value.substring(endPos, myField.value.length); cursorPos += tag.length; myField.focus(); myField.selectionStart = cursorPos; myField.selectionEnd = cursorPos; } else { myField.value += tag; myField.focus(); } } //Helpbox messagesbold_help = "Bold text: [b]text[/b]";italic_help = "Italic text: [i]text[/i]";underline_help = "Underline text: [u]text[/u]";quote_help = "Quote text: [quote]text[/quote] or [quote=name]text[/quote]";code_help = "Code display: ";img_help = "Insert image: ";url_help = "Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]";fontcolor_help = "Font color: [color=red]text[/color] Tip: you can also use color=#FF0000";fontsize_help = "Font size: [size=50%]small text[/size]";//Function for displaying help information// Shows the help messages in the helpline windowfunction helpline(help) { var helpbox = document.editform.helpbox; helpbox.value = eval(help + "_help");}//Function to confirm resetfunction confirm_reset () { if(confirm("If you continue you will loose everything you have entered so far. \n \n" + "Click OK to proceed and start again. \n \n Alternatively click cancel to continue " + "working on your post.")) { return true; } else { return false; }}//Check the form submission for errorsfunction checkForm() { var subject = document.editform.subject; var post = document.editform.post; //Check to make sure post lengths are sensible if (subject.value.length < 2 && post.value.length < 2) { alert("This is a short post!" + " \n \n " + "We require that each post (and subject) \n" + "be at least 2 characters long. \n \n" + "Go back and try again."); return false; } else { if (subject.value.length < 2) { alert("We require that the subject \n" + "be at least 2 characters long. \n \n" + "Go back and try again."); return false; } else { if (post.value.length < 2) { alert("We require that each post \n" + "be at least 2 characters long. \n \n" + "Go back and try again."); return false; } else { return true; } } }}
  2. xbl1

    W3 Validator

    i pasted my website address to W3 to validate it, then it give me the error massage. But now, i get the source code from right click on the page, and validate it on the W3 again. It passed. <!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=utf-8" /><title>Yourheadstone.com</title><style type="text/css">* {padding:0; margin:0;}body{ padding:0; border:0; background-image:url(../images/bg_images/2.jpg); margin:0;}#container { width:1024px; height:1005px; margin:30px auto; background-image:url(../images/container_images/5.jpg); border-top: 7px solid #80B2E6; border-right: 5px solid #ADC2DA; border-bottom: 6px solid #ADC2DA; border-left: 5px solid #ADC2DA;}#headertop{ width:1020px; height: 90px; color:#0066CC; font-size:70px; padding-left:200px; float:left;}.logo{ margin-left:65px; margin-top:20px; font-style:italic;}a{ color:#0066CC; text-decoration: none;}#headermiddle{ width:1020px; height: 45px; float:left;}#headermiddle_left{ width:600px; height: 45px; float:left;}#headermiddle_right{ width:400px; height: 45px; float:left;}form{ width: auto; height: 38px; text-align:center; background-color:#000000;}input{ line-height: 25px; font-size: 18px; height: 30px; width: 195px;; }#headerbottom{ width:1020px; height: 45px; background-color:#0AC20A; float:left;}.pagenums{ color:#0C14F7;}.page{ color:#0C14F7;}.mypage{ background-color:#A7A8B8;}img { border-style:none;}#leftcolumn{ width:150px; height:560px; float:left;}#middlecolumn{ border-top: 7px solid #0A0A0A; border-right: 5px solid #948F91; border-bottom: 6px solid #A89D9F; border-left: 5px solid #8C8587; padding:10px; width:720px; height:560px; float:left; background-color:#FFFFFF;} .submittime{ color:#00010A; width:150px; height:20px; float:left;}#rightcolumn{ width:100px; height:560px; float:left;} </style></head><body><div id="container"><div id="headertop"> <a href="index.php"> <span class="logo"> your headstone</span> </a></div><div id="headermiddle"><div id="headermiddle_left"><a href="index.php"> <img src="../images/flower.gif" alt="image" /></a></div><div id="headermiddle_right"><form action="../search_pinboard/search_pinboard_process.php" method="post"><input type="text" name="search" value="" size="30"/><input type="submit" value="search" /></form></div></div><div id="headerbottom"><div id="result">Total 2 images.<br /></div> page 1 of 1-- <a class="mypage" href='/search_pinboard/search_pinboard.php?pagenum=1'> 1 </a></div><div id="leftcolumn"> </div><div id="middlecolumn"><a href="../pinboard/pinboard_massage.php?id=3">i am testing</a><br />Only photo:Images of dead Melbourne son on stolen camera<br /><br />Royal lookalikes:Kate and Mary\\\\\\\\\\\\\\\'s double date for charity<br /><br />Lazy extreme:Wife\\\\\\\\\\\\\\\'s food spiked to make her stay-at-home mum<br /><br />Dead babysitter:Couple had drug-fuelled affair with teen help<br /><div class="submittime"></div><br /><br /><a href="../pinboard/pinboard_massage.php?id=2">job test me</a><br /><img src="../images/biggrin.gif" alt="image" /> <img src="../images/smile.gif" alt="image" /> Only photo:Images of dead Melbourne son on stolen cameraRoyal lookalikes:Kate and Mary\\\'s double date for charityLazy extreme:Wife\\\'s food spiked to make her stay-at-home mumDead babysitter:Couple had drug-fuelled affair with teen help<br /><div class="submittime"></div><br /><br /></div><div id="rightcolumn"> </div></div></body></html>
  3. xbl1

    W3 Validator

    Hi;I am implementing a search engin by php, and i alway to have a error massage when i validate my page by the W3 Validator, error massage as following, could any one help, thanks.end tag for "div" omitted, but OMITTAG NO was specifiedQuery was emptyYou may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">". my code <?php $rows = get_number_of_rows(); function get_number_of_rows(){ include("../condatabase.php"); mysql_query("SET NAMES 'utf8' COLLATE 'utf8_general_ci'"); $q=getsql("affair with teen"); $result=mysql_query($q,$con)or die(mysql_error()); $rows = mysql_num_rows($result); return $rows; } function getsql($search_str){ $sql = "SELECT DISTINCT COUNT(*) as occurences,id, subject, content FROM pinboard WHERE ("; while ( list ( $key,$val ) = each ( $search_str ) ) { if( $val!='' && strlen ( $val ) > 0 ) { $sql .= "((subject LIKE '%".$val."%' OR content LIKE '%".$val."%')) OR"; } } $sql=substr ( $sql,0, ( strLen ( $sql )-3 ) );//this will eat the last OR //$sql .= ") GROUP BY subject ORDER BY occurences DESC LIMIT 10"; $sql .= ") GROUP BY subject ORDER BY occurences DESC "; return $sql; } ?> but when i direct assign value to $sql="SELECT DISTINCT COUNT(*) as occurences,id, subject, content FROM pinboard WHERE (((subject LIKE '%affair%' OR content LIKE '%affair%')) OR((subject LIKE '%teen%' OR content LIKE '%teen%'))) GROUP BY subject ORDER BY occurences DESC"and validate my page by W3 validator, it has not report any error, pefect.Could anyone tell me, why please.
  4. Hi;My problem is i could not print out value after i inserted echo "<div class=\"hints\">; and echo "</div>"; please see the highline .I am implementing an auto suggestiion for search engin.response.php<?php$q=$_GET["q"];include("../condatabase.php");$sql="SELECT content FROM articles WHERE content like '%".$q."%'"; $result = mysql_query($sql); $a[]=""; $m[]=""; while($row = mysql_fetch_array($result)){ $m.= $row['content']; } //$final = preg_match_all("/talking a[a-zA-Z]*/", $string); $term="/" . $q . "[a-zA-Z\s]*" . "/"; preg_match_all($term, $m,$f); $count=count($f[0]);$f[0]=array_unique($f[0]); $i=0;while($i<$count){ $a[$i]=($f[0][$i]);echo "<div class=\"hints\">; echo $a[$i]; // i could not print out this value, but it can do without two div*****************echo "</div>"; $i++;}?>-------------------------------------------------------------------index.php<html><head><script type="text/javascript">function showHint(str){var xmlhttp;if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; }if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } }xmlhttp.open("GET","response.php?q="+str,true);xmlhttp.send();}</script></head><body><h3>Start typing a name in the input field below:</h3><form action="">First name: <input type="text" id="txt1" onkeyup="showHint(this.value)" /></form> </body></html>
  5. i will convert it into one dimension array
  6. but why i could not print out the 2 elements from the array of the final, it just print out the "Array" <?php$string="talking animails and get rid off talking about this facebook"; $term="talking a"; preg_match_all("/talking a[a-zA-Z]*/", $string,$final); $i=0; while($i<2){ echo $final[$i]; $i++; }?>
  7. Hi;How could i extract specific words out of a string and put into an array, please.Eg;$string="talking animails and get rid off talking about this facebook";$term="talking a";The final result will be:$final[]="talking animails, talking about ",
  8. Hi;How could i get rid off the repeat words from an array? Thankseg;$a[]="the , think , this , that , the , their , that , the , the , those";i just want the array reduce to "the, think, that,those".
  9. The following is respone.php, it works. <?phprequire_once('db.php'); include('classes/stem.php'); include('classes/cleaner.php'); if( !empty ( $_POST['search'] ) ) $string = $_POST['search']; function get_stemmer($string){ $stemmer = new Stemmer; $stemmed_string = $stemmer->stem ( $string ); return $stemmed_string; } $string=explode(" ",$string); $size=sizeof($string); $i=0; $stemmed_string=""; while($i<$size){ $word=get_stemmer($string[$i]); $stemmed_string .= " " . $word; $i++; } $clean_string = new jSearchString(); $stemmed_string = $clean_string->parseString ( $stemmed_string ); echo $stemmed_string . "<br />"; $new_string = ''; foreach ( array_unique ( split ( " ",$stemmed_string ) ) as $array => $value ) { if(strlen($value) >=3) { $new_string .= " " .$value.' '; } } echo $new_string . "<br />"; $new_string = substr ( $new_string,0, ( strLen ( $new_string ) -1 ) ); echo $new_string . "<br />"; if ( strlen ( $new_string ) > 3 ) $split_stemmed = split ( " ",$new_string ); $sql = "SELECT DISTINCT COUNT(*) as occurences,id, title, subtitle FROM articles WHERE ("; while ( list ( $key,$val ) = each ( $split_stemmed ) ) { if( $val!='' && strlen ( $val ) > 0 ) { $sql .= "((title LIKE '%".$val."%' OR subtitle LIKE '%".$val."%' OR content LIKE '%".$val."%')) OR"; } } $sql=substr ( $sql,0, ( strLen ( $sql )-3 ) );//this will eat the last OR $sql .= ") GROUP BY title ORDER BY occurences DESC LIMIT 10"; echo $sql . "<br />"; $result=mysql_query($sql,$con)or die(mysql_error()); $total = mysql_num_rows ( $result ); if($total>0){ while($row = mysql_fetch_array($result)){ echo $row['id'].'------'.$row['title']."\n"; echo ' -------- '.$row['subtitle']."\n"; } } ?>
  10. the problem is the auto suggest is not working, when i type any of string into textbox, does not auto offer suggestion as google search engine does.i want to do as following: Whenever a keyup event on a textbox occur, a function in javascript is called which uses ajax to send the input in the textbox to the server The server receives the input and check for any matches in the database The matched result is sent back to the client side javascipt code, ajax, and then the result is shown in an absolute positioned div just under the input box.
  11. yes, there are some errors in his code, but i have fixed the search size and it works for searching string from database now, but i still not figure out about the form and javascript part----do the auto suggestion thing, anywhere thanks:)
  12. I am implementing a Ajax auto suggestion search from database. I find an example from http://www.roscripts.com/Ajax_autosu...abase-154.html . I have not problem with the php part about search from database, but i got a problem from the search from, i added a listerner to input tag, but it still not auto suggest anyword when i type any of word, Could any one help me, Thanks. <html> <head> <title>roScripts - Ajax auto-suggest</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="lib/prototype.js" type="text/javascript"></script> <script src="src/scriptaculous.js" type="text/javascript"></script> <script src="src/unittest.js" type="text/javascript"></script> <script src="lib/builder.js" type="text/javascript"></script> <script src="src/controls.js" type="text/javascript"></script> <script src="src/effects.js" type="text/javascript"></script> <link rel="stylesheet" href="css/style.css" type="text/css" /> </head> <body> <div id="container"> <form method="post" action="response.php"> <label for="testinput">Search</label><br /> <input type="text" id="search" name="search" autocomplete="off" class="input" value="" onkeyup="autoSuggest();" /><br /> <div id="update" style="display:none;position:relative;"></div> <input type="image" name="register" class="submit-btn" src=" http://www.roscripts.com/images/btn.gif" alt="submit" title="submit" /> </form> <script type="text/javascript" language="javascript" charset="utf-8"> function autoSuggest(){ new Ajax.Autocompleter('search','update','response.php', { tokens: ','} ); Autocompleter.show(); } </script> </div> </body> </html>
  13. xbl1

    Zoom In Function

    Thanks for comeing here, i have knowed how to do it already
  14. Hi;I'd like to ask some advice how to have a built zoom in function for a picture like the following page, http://www5.mydavinci.com/Pesonalized-Art/...cil-Sketch.htmlthanks
  • Create New...