Jump to content

Revos

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Revos's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok, done..now it works but to show it I do style="display:'block;'", in IE it works fine but in FIREFOX it is not working good and table messes up, how can I solve it?
  2. Ok I solved the problem but there is a new one now.. What I did is putting TR and TD style="display:'none;'", in IE it works great but in FF it just messes us, how can I solve it?
  3. done, but still it clears the page and then makes the text box..and I don't must use it..I just don't know any other ways..
  4. I am trying to do that when someone will press the button, it will create in the same page new input textbox, what I did is: function blabla() { document.write("<tr><td> bla") document.write(":</td><td><input name='Option") document.write("' type='text' /></td></tr>") } Everything is great, it does make a new textbox but it clears the page and then makes only new text box..I want it to create new text box in the same page, below the button, how? thanks.
  5. ok let me change my question, what it wrong in this code in IE? [code] if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) { var caretPos = textarea.caretPos; var temp_length = caretPos.text.length; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2; if (temp_length == 0) { caretPos.moveStart("character", -text2.length); caretPos.moveEnd("character", -text2.length); caretPos.select(); } else textarea.focus(caretPos); } [/code]
  6. let me tell you what happens: [code] if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) { var caretPos = textarea.caretPos; var temp_length = caretPos.text.length; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2; if (temp_length == 0) { caretPos.moveStart("character", -text2.length); caretPos.moveEnd("character", -text2.length); caretPos.select(); } else textarea.focus(caretPos); } [/code] the IF part suppost to check if it's IE but when I use IE it doesn't do the IF part and goes to the last ELSE part, why?!
  7. it is not going to this part: [code] if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) { var caretPos = textarea.caretPos; var temp_length = caretPos.text.length; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2; if (temp_length == 0) { caretPos.moveStart("character", -text2.length); caretPos.moveEnd("character", -text2.length); caretPos.select(); } else textarea.focus(caretPos); } [/code] it is skiping this and going to the last ELSE part!
  8. I got this code from this site and here it works GREAT in both FF and IE. [code] function surroundText(text1, text2, textarea) { // Can a text range be created? if (typeof(textarea.caretPos) != "undefined" && textarea.createTextRange) { var caretPos = textarea.caretPos; var temp_length = caretPos.text.length; caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text1 + caretPos.text + text2 + ' ' : text1 + caretPos.text + text2; if (temp_length == 0) { caretPos.moveStart("character", -text2.length); caretPos.moveEnd("character", -text2.length); caretPos.select(); } else textarea.focus(caretPos); } // Mozilla text range wrap. else if (typeof(textarea.selectionStart) != "undefined") { var begin = textarea.value.substr(0, textarea.selectionStart); var selection = textarea.value.substr(textarea.selectionStart, textarea.selectionEnd - textarea.selectionStart); var end = textarea.value.substr(textarea.selectionEnd); var newCursorPos = textarea.selectionStart; var scrollPos = textarea.scrollTop; textarea.value = begin + text1 + selection + text2 + end; if (textarea.setSelectionRange) { if (selection.length == 0) textarea.setSelectionRange(newCursorPos + text1.length, newCursorPos + text1.length); else textarea.setSelectionRange(newCursorPos, newCursorPos + text1.length + selection.length + text2.length); textarea.focus(); } textarea.scrollTop = scrollPos; } // Just put them on the end, then. else { textarea.value += text1 + text2; textarea.focus(textarea.value.length - 1); } } [/code] I use it so: [code] <input type="button" onClick="window.location.href='javascript:void(0)'; surroundText('[I]', '[/I]', document.FormPost.Post); return false;" value=" I" style="border-right-width:1px; border-bottom-width:1px; border-top-width:1px;border-left-width:1px; font-family:Arial; font-style:italic; font-size:12px" /> [/code] Why it is not working it Internet Explorer? In FireFox it is working GREAT!
  9. Ok, for question 1 I found a half solution..works onliy in IE, how can I make it work in FF as well? this is the full code: [code] <script LANGUAGE="Javascript"> var globalCursorPos; // global variabe to keep track of where the cursor was //sets the global variable to keep track of the cursor position function setCursorPos() {   globalCursorPos = getCursorPos(FormPost.Post); } //This function returns the index of the cursor location in //the value of the input text element //It is important to make sure that the sWeirdString variable contains //a set of characters that will not be encountered normally in your //text function getCursorPos(textElement) {   //save off the current value to restore it later,   var sOldText = textElement.value; //create a range object and save off it's text   var objRange = document.selection.createRange();   var sOldRange = objRange.text; //set this string to a small string that will not normally be encountered   var sWeirdString = '#%~'; //insert the weirdstring where the cursor is at   objRange.text = sOldRange + sWeirdString; objRange.moveStart('character', (0 - sOldRange.length - sWeirdString.length)); //save off the new string with the weirdstring in it   var sNewText = textElement.value; //set the actual text value back to how it was   objRange.text = sOldRange; //look through the new string we saved off and find the location of //the weirdstring that was inserted and return that value   for (i=0; i <= sNewText.length; i++) {     var sTemp = sNewText.substring(i, i + sWeirdString.length);     if (sTemp == sWeirdString) {       var cursorPos = (i - sOldRange.length);       return cursorPos;     }   } } //this function inserts the input string into the textarea //where the cursor was at function insertString(stringToInsert) {   var firstPart = FormPost.Post.value.substring(0, globalCursorPos);   var secondPart = FormPost.Post.value.substring(globalCursorPos, FormPost.Post.value.length);   FormPost.Post.value = firstPart + stringToInsert + secondPart; } </SCRIPT> [/code] works only in IE =\ and for question 2, no this is not what I am looking for, I am looking for something that will put the cursor and focus textarea, let me show you an example: textarea value is "Cool" I want to put the cursor and put focus here "C|ool" | means cursor, how do I do it?
  10. Hi guys, 1. I am having a problem with setting focus in a specific place, I am using "focus()" how can I control where it will make the focus? I mean after how many chars.. 2. I have a textarea and a button, when I press the buttun the value in textarea is textarea value + "A". Now, it adds "A" only in the end, what I want is that when I will press the button it will add "A" to the place where the cursor is. For example: the value in text area is "Cool" and the cursor is here "Co|ol"[| means cursor] the value after I press the button will be "CoolA", and I want it to be "CoAol". Thanks.
  11. Tried it already... listen I got 2 pages, with page 1 I create a cookie\session. With page 2 I will check if the cookie\session exists. I want to create a cookie\session with page1 and close page1 and open page2, with page2 to check if cookie\session exists then show example.."blabla" and when I will close page2 the cookie\session will be deleted...is it possible?
  12. I have a problem: I got page name X and it creates a cookie and opens page named Y in page Y I check it cookie exists. now if I dont put expire it deletes the cookie when I close page X and open page Y. I want to create a cookie in page X(I know how) I want to delete a cookie when I close page Y(how?)
  13. How can I delete a cookie when I close page or change address? example I got page named X, when I close that page or change address to anyother I want to delete cookie name Y, how?
  14. Thank you very much! oh and if you are making something huge that is a hell of a work...
  15. I tried this code: [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>Document</title> </head> <input name="Txt" type="text" value="123" /> <input name="Button1" type="button" value="Bla" onClick= "Document.form.Txt.value = "444" /> <body> </body> </html>[/code] but it doesn't work..
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.