Jump to content

xbl1

Members
  • Posts

    214
  • Joined

  • Last visited

Everything posted by xbl1

  1. i think you are right. It doen't affect the performance when i changed their name of properties and method.I found it from google, i will give up this code, because i got another one and i feel it is easier to understand than this one.Thanks
  2. i am sorry that i confuse you.My question is;1) does the .undefined is like the prebuild object's property? for example, the .length property of String of object.2) .initDone: what does it means ? 3) what the following code does?var BBCode = function(){ window.undefined = window.undefined; this.initDone = false; } 4) what the following code does? and what does the ._target means?BBCode.prototype.init = function(t){ if(this.initDone)return false; if(t == undefined)return false; this._target = t? document.getElementById(t) : t; this.initDone = true; return true; } 5) what does the following code do?BBCode.prototype.noForm = function(){ return this._target == undefined; }
  3. Hello; I got a problem to understand a program which use for users to simply format their post, and they realted with the prototype object.i got some question from the following code;1) window.undefined = window.undefined;this.initDone = false;return this._target == undefined;The above all from the follwoing code which i had highlighted.does the undefined and initDone and _target are prebuild property, if so, but i could not find them http://www.w3schools.com/js/default.asp to see what they do. or they just named by user.2)what the following function do?var BBCode = function(){ window.undefined = window.undefined; this.initDone = false; } Does it create a new instance of BBCode object?what does the window.undefined = window.undefined; and this.initDone = false; do?3)BBCode.prototype.init = function(t){ if(this.initDone) // what does it means here? return false; if(t == undefined) // what does it means here? return false; this._target = t? document.getElementById(t) : t; // what does it means here?this.initDone = true; return true; } 4)BBCode.prototype.noForm = function(){ return this._target == undefined; // what does it means here?} <html><head><script type="text/javascript"> var BBCode = function(){ window.undefined = window.undefined; this.initDone = false; } BBCode.prototype.init = function(t){ if(this.initDone) return false; if(t == undefined) return false; this._target = t? document.getElementById(t) : t; this.initDone = true; return true; } BBCode.prototype.noForm = function(){ return this._target == undefined; } </script> </head><body><script type="text/javascript">//////////////////////////////////////////////////// insertcode is used for bold, italic, underline and quote and just // wraps the tags around a selection or prompts the user for some // text to apply the tag to BBCode.prototype.insertCode = function (tag, desc, endtag) { if(this.noForm()) return false; var isDesc = (desc == undefined ¦¦ desc == '')? false : true; // our textfield var textarea = this._target; // our open tag var open = '['+tag+']'; var close = '[/'+((endtag == undefined)? tag : endtag)+']'; if (!textarea.setSelectionRange) { var selected = document.selection.createRange().text; if (selected.length<=0) { // no text was selected so prompt the user for some text textarea.value += open+((isDesc)? prompt("Please enter the text you'd like to "+desc, "")+close : ''); }else{// put the code around the selected text document.selection.createRange().text = open+selected+((isDesc)? close : ''); }} else { // the text before the selection var pretext = textarea.value.substring(0, textarea.selectionStart); // the selected text with tags before and after var codetext = open+textarea.value.substring(textarea.selectionStart, textarea.selectionEnd)+((isDesc)? close : ''); // the text after the selection var posttext = textarea.value.substring(textarea.selectionEnd, textarea.value.length); // check if there was a selection if (codetext == open+close) { //prompt the user codetext = open+((isDesc)? prompt("Please enter the text you'd like to "+desc, "")+close : ''); }// update the text field textarea.value = pretext+codetext+posttext; }// set the focus on the text field textarea.focus(); }//////////////////////////////////////////////////////////// inserts an image by prompting the user for the url BBCode.prototype.insertImage = function (html) { if(this.noForm()) return false; var src = prompt('Please enter the url', 'http://'); this.insertCode('img='+src); }/////////////////////////////////////////////////////////////////// inserts a link by prompting the user for a url BBCode.prototype.insertLink = function (html) { if(this.noForm()) return false; this.insertCode('url='+prompt("Please enter the url", "http://"), 'as text of the link', 'url') } </script><script type="text/javascript"> var bb = new BBCode(); </script> <input type="button" onclick="bb.insertCode('B', 'bold');" value="B" title="Bold text" /> <input type="button" onclick="bb.insertCode('I', 'make italic');" value="I" title="Italic text" /> <input type="button" onclick="bb.insertCode('U', 'underline');" value="U" title="Underlined text" /><input type="button" onclick="bb.insertImage();" value="Image" title="Inset an image" /> <input type="button" onclick="bb.insertLink();" value="Link" title="Insert a link" /><br /> <textarea id="ttt" name="ttt" rows="20"></textarea> <script type="text/javascript"> bb.init('ttt'); </script> </body></html>
  4. Hello; i 'd like to ask you some questions to make a submit foum which we use in this forum for postting new topic, please. some question as following;1) like the top bar of sign- B I U S etc, are they make by button and using in submit form or something else.2) If i highlight a sentence in the textarea, and then click on the a buton for the sign of B, and then the sign of ['b'] and [/'b'] will come out, and the sentence will sit between then automaticaly.how can i do that?do i need a action listener to listen whether i highline a senetnce? and how can the two signs suddenly jump up and sit in the right, position?3) before i display these masage on the screen, do i need to one word by one word to check whether they have special sign like B I U link etc.Thanks
  5. hello; i 'd like to ask you some like idea to make a submit foum which we use in this forum for postting new topic, please.some question as following;1) like the top bar of sign- B I U S etc, are they make by button and using in submit form or something else.2) If i highlight a sentence in the textarea, and then click on the a buton for the sign of B, and then the sign of B- and will come out, and the sentence will sit between then automaticaly.how can i do that?do i need a action listener to listen whether i highline a senetnce? and how can the two signs suddenly jump up and sit in the right, position?3) before i display these masage on the screen, do i need to one word by one word to check whether they have special sign like B I U link etc.Thanks
  6. xbl1

    refresh problem

    Hi justsomeguy, reportingsjr;I had solve the refresh problem already. i am using Post method to pass the cid value from edit2.php to edit3.php without using session varible, and make the text filed invisible and readonly.<input type="text" style="visibility:hidden;" name="cid[]" size=1 value=" <? echo $row['Cid'] ?>" readonly="readonly"> But why i do like that, there is the refresh problem any more. Could you annalysis the reason to me?And also if you are free, could you help me to solve the refresh problem by useing the session varible to pass the cid value, i am keen to know how to do that. Thanks.
  7. xbl1

    refresh problem

    I am almost there now, haha. i added the redirect code to the end of edit3.php as following, they work. <?echo"<meta http-equiv='Refresh' content='1; URL=index.php'>";?> or <?phpecho "<meta http-equiv=\"refresh\" content=\"1;URL=http://www.businessfind101.com/\">";?> But the problem for me, it work in funny way.after i edit the form from edit2.php, and then it gos to the edit3.php, the funny thing is here, it automatically go back to the index.php by itself. that is not good way to back, i need it back to index.php when i press the back from the top button of bar.and also i find another strange thing as well. After i redirect back to index.php from the edit3.php by automatically (althoght i don't like it), i will find another refersh problem as well when i click on the back from the index.php.and the masage as following;Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. and the top of the address bar has : http://www.businessfind101.com/edit2.phpCould you tell me how solve these problem?
  8. xbl1

    refresh problem

    Hi justsomeguy;You are right, there is not value in the edit2.php after i redict back to edit2.php from edit3.php. Becaue the value get from edit.php, but now i don't excute the edit.php to let it pass value to edit2.php. This is why i has the refresh problem. Thanks a lot, you give me a very good analysis, i understand it now.What i am doing for the code? I want to let the user update their data by themself, and save it back to database. and i do that by the following step as what you said from last thread.1) ask the user name by a formbut here, i will pass the user cid to eddit2.php by attached the cid value to a textbox as well, for later use.2) base on the user name, i will select the user data out of database, then diplay on a screen to let the user edit their detail, after finish that, i will save the update data to database.and also i will receied the cid value which it is from edit.ph, and put it into the session varible for edit3.php use.3) in the edit3.php, according the cid value which from edit.pho, and processing it from edit2.php, i will update the user's data. then redirect back to previous page.The above is all i want to do.But you are right, that doesn't make sence to redirect back to edit2.php, because it is just a submit form, nothing else.so i will redirect to another page.but after i added the redirect code on, it give me some massage as following;Warning: Cannot modify header information - headers already sent by (output started at /home/biznisfi/public_html/edit3.php:6) in /home/biznisfi/public_html/edit3.php on line 43the code i added as following; this is edit3.php<?session_start();?><? $con = mysql_connect("localhost", "biznisfi_xbl","1968rich");if (! $con){die('Could not connect: ' . mysql_error());} mysql_select_db("biznisfi_xbl", $con);if(isset($_SESSION['Cid']))$cid=$_SESSION['Cid'];$arrtopic = $_REQUEST['topic'];if(is_array($arrtopic)){foreach($arrtopic as $value) $sql = "update Customer2 set Topic='$value' where Cid= '$cid'";mysql_query($sql);}$arrdes=$_POST['des'];if(is_array($arrdes)){foreach($arrdes as $value)$sql = "update Customer2 set Des='$value' where Cid='$cid'";mysql_query($sql);}unset($_SESSION['Cid']);?><?phpheader("Location: index.php");?> even i change the redirtect to www.ebay.com, it does not help. Could you tell what's problem here, Thanksand the index.php like the following, it just use to link to the edit.php, etc, nothing else, not value problem in here. <html><head><style type="text/css"></style></head><body> <center> <a href='tologin.php'>login</a> <a href='index.php'> Search </a> <a href='submit.php'>submit your words</a> <a href='eUserName.php'>Delete your words</a> <a href='eUserE.php'> Edit your words </a> <a href='oTopic.php'> OverView Topic </a> </center> <center> <form name="input" class="id1" action="st1.php" method="get"> Search: <input type="text" name="SText"> <input type="submit" value="Submit"> </form> </center></body></html>
  9. xbl1

    refresh problem

    Hi reportingsjr;After i added the test code on, the parser does not say anything, but it bring a lot of submit form from edit2.php, and never stop, but i can go to the edit3.php page, and also the refresh problem still there.<form action='edit3.php' method="POST"><?$row_result = mysql_fetch_array($result) or die(mysql_error());while($row = $row_result){$_SESSION['Cid']=$row['Cid'];?><input type="text" name="topic[]" maxlength=30 value="<? echo $row['Topic'];?>"><br><TEXTAREA name="des[]" wrap=on cols="50" class="TA" rows="10" onkeyup="this.value = this.value.slice(0, 200)"> <? echo $row['Des'];?> </TEXTAREA> <input type="submit" value="Submit"></form>
  10. Hello; how to make a button with disable and invisible? or let the button has light blue color? Thanks<input type="button" value="Hello world!">
  11. xbl1

    refresh problem

    Thanks a lot, i will going test it.
  12. xbl1

    refresh problem

    it may be my coding problem. after i added the header, it give me the masage like that;Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/biznisfi/public_html/edit2.php on line 36this code from edit2 and start on the line 36<form action='edit3.php' method="POST"><?while($row = mysql_fetch_array($result)){$_SESSION['Cid']=$row['Cid'];?><input type="text" name="topic[]" maxlength=30 value="<? echo $row['Topic'];?>"><br><TEXTAREA name="des[]" wrap=on cols="50" class="TA" rows="10" onkeyup="this.value = this.value.slice(0, 200)"> <? echo $row['Des'];?> </TEXTAREA> <input type="submit" value="Submit"></form>
  13. xbl1

    refresh problem

    Sorry, it does not make any different.
  14. xbl1

    refresh problem

    Hello Kristian_C;Sorry to bother again;Last night the code work very well, there was not refresh problem since i added a code as you said. but this morning, the refresh problem come back again, i didn't change my code. Please help i give you all the code i got;edit.php<html><body><form action='edit2.php' method="POST"><? $con = mysql_connect("localhost", "xxx","xxxx"); if (! $con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xxxx", $con); $result = mysql_query("select * from Customer2 where UserName='$_POST[userName]'");while($row = mysql_fetch_array($result)){ ?><input type="radio" name="Cid[]" value="<? echo $row['Cid']; ?>"><? echo $row['Des'];?><br><?}?><input type="submit" value="submit"><input type="reset" value="reset"></form></body></html> edit2.php <?php session_start(); ?><html><head><STYLE>.TA {scrollbar-3dlight-color:palegreen;scrollbar-arrow-color:yellow;scrollbar-base-color:blue;scrollbar-darkshadow-color:orange;scrollbar-face-color:aqua;scrollbar-highlight-color:blue;scrollbar-shadow-color:teal}</STYLE></head><body><? $con = mysql_connect("localhost", "xxxx","xxxxxxxx");if (! $con){die('Could not connect: ' . mysql_error());}mysql_select_db("xxxxxxx", $con);$arrCid=$_POST['Cid'];if(is_array($arrCid)){foreach($arrCid as $value)$result = mysql_query("select * from Customer2 where Cid='$value'"); } ?><form action='edit3.php' method="POST"><?while($row = mysql_fetch_array($result)){$_SESSION['Cid']=$row['Cid'];?><input type="text" name="topic[]" maxlength=30 value="<? echo $row['Topic'];?>"><br><TEXTAREA name="des[]" wrap=on cols="50" class="TA" rows="10" onkeyup="this.value = this.value.slice(0, 200)"> <? echo $row['Des'];?> </TEXTAREA> <input type="submit" value="Submit"></form><?}?></body></html> edit3.php <?session_start();?><? $con = mysql_connect("localhost", "xxxx","xxxx");if (! $con){die('Could not connect: ' . mysql_error());}mysql_select_db("xxxx", $con);if(isset($_SESSION['Cid']))$cid=$_SESSION['Cid'];$arrtopic = $_REQUEST['topic'];if(is_array($arrtopic)){foreach($arrtopic as $value) $sql = "update Customer2 set Topic='$value' where Cid= '$cid'";mysql_query($sql);}$arrdes=$_POST['des'];if(is_array($arrdes)){foreach($arrdes as $value)$sql = "update Customer2 set Des='$value' where Cid='$cid'";mysql_query($sql);}unset($_SESSION['Cid']);?><?echo"<meta http-equiv='Refresh' content='1; URL='http://www.businessfind101.com/edit2.php'>";?>
  15. xbl1

    refresh problem

    >Hmm, try add it like this at the end :><?>echo"<meta http-equiv='Refresh' content='1; URL=edit2.php'>";>?>Thanks a lot, it work now.
  16. xbl1

    refresh problem

    i added to the edit3 as following; unset($_SESSION['Cid']); echo"<meta http-equiv='Refresh' content='1; URL=edit2.php'>";but it give me some error masage after i add the code.Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/biznisfi/public_html/edit2.php on line 40and the following code from edit2.php which it stat from the line of 40;<form action='edit3.php' method="POST"><?while($row = mysql_fetch_array($result)){ $_SESSION['Cid']=$row['Cid'];?><input type="text" name="topic[]" maxlength=30 value="<? echo $row['Topic']; ?>"><br> <TEXTAREA name="des[]" wrap=on cols="50" class="TA" rows="10" onkeyup="this.value = this.value.slice(0, 200)"> <? echo $row['Des']; ?> </TEXTAREA> <input type="submit" value="Submit"></form>
  17. xbl1

    refresh problem

    Hello; i got a refresh problem. i got two php page at the movement, which they called edit2.php and edit3.php. when i submit a form from edit2.php to edit3.php, then i could not come back from edit3.php to edit2.php.Could you tell why, please. The following is warning masage;Warning: Page has Expired The page you requested was created using information you submitted in a form. This page is no longer available. As a security precaution, Internet Explorer does not automatically resubmit your information for you. To resubmit your information and view this Web page, click the Refresh button. edit2.php <?session_start();?><html><head> <STYLE> .TA {scrollbar-3dlight-color:palegreen; scrollbar-arrow-color:yellow; scrollbar-base-color:blue; scrollbar-darkshadow-color:orange; scrollbar-face-color:aqua; scrollbar-highlight-color:blue; scrollbar-shadow-color:teal} </STYLE></head><body> <? $con = mysql_connect("localhost", "#*$!x","#*$!xx"); if (! $con) { die('Could not connect: ' . mysql_error()); }mysql_select_db("#*$!#*$!", $con); $arrCid=$_POST['Cid']; if(is_array($arrCid)){ foreach($arrCid as $value) $result = mysql_query("select * from Customer2 where Cid='$value'"); } ?><form action='edit3.php' method="POST"><?while($row = mysql_fetch_array($result)){ $_SESSION['Cid']=$row['Cid'];?><input type="text" name="topic[]" maxlength=30 value="<? echo $row['Topic'];?>"><br> <TEXTAREA name="des[]" wrap=on cols="50" class="TA" rows="10" onkeyup="this.value = this.value.slice(0, 200)"> <? echo $row['Des'];?> </TEXTAREA> <input type="submit" value="Submit"></form><?}?></body></html> edit3.php <?session_start();?><? $con = mysql_connect("localhost", "#*$!#*$!","#*$!#*$!"); if (! $con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("#*$!#*$!", $con); if(isset($_SESSION['Cid'])) $cid=$_SESSION['Cid']; $arrtopic = $_REQUEST['topic']; if(is_array($arrtopic)){ foreach($arrtopic as $value) $sql = "update Customer2 set Topic='$value' where Cid= '$cid'"; mysql_query($sql); } $arrdes=$_POST['des']; if(is_array($arrdes)){ foreach($arrdes as $value) $sql = "update Customer2 set Des='$value' where Cid='$cid'"; mysql_query($sql); } unset($_SESSION['Cid']);?>
  18. Hello; how to put diffentent sentence into differnt rows in TextArea? please. For eaxmple, i will select all data about topic from database, and display them onto a TEXTAREA. But i want the different topics into different rows. How i can do that? Thanks. <form> <TEXTAREA cols="50" rows="10" wrap=off> <? while($row = mysql_fetch_array($result)) echo $row['Topic']; ?> </TEXTAREA> </form>
  19. i will change it to int, but how i can let it starts from 1000 by 1 Automaticly
  20. Hello; How i can create a attribute auto start with aaaa by 1.for example; create table tset2(cid int primary key auto_increment, topic varchar(100), content varchar(100), referNo varchar start "aaaa" auto_increment,full text(topic, content, referNo))i want the referNo auto start with aaaa by 1
  21. xbl1

    some ideas, Please

    Hello; i'd like to you some ideas plaese.i got a table in database, and their structure as following;table name: BookCid Topic Content1 ss ss2 ss ssI want to display all the topic from the database into a table. if i click on a topic, then i can known the correspondence's Cid, and base on that, i willdisplay the correspondence Content.And the table should like the link has a table picture The problem for me, in website, what kind of knowledge can help me to has a table like i say? :eek:
×
×
  • Create New...