SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast Igloo's Avatar
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Textarea Functions

    Hello,

    I have a textarea inside a form that I'd like to be able to carry out a few different Javascript functions on.

    The things I'd like to be able to do are:

    1. copying the entire contents to the clipboard
    2. finding a certain user entered search term without having to refresh
    3. opening a new window with the contents of the textarea and displaying them in this new window


    I have already tried to do them, but they have not worked. Returning errors and the like.

    Thankyou,

    Igloo...

  2. #2
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please post your code so that others may help you correct it!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!

  3. #3
    SitePoint Enthusiast Igloo's Avatar
    Join Date
    Dec 2002
    Location
    Australia
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've got the copy function to work, as well as the preview function using the following code:

    Code:
    // ################################################################
    function preview(element) {
    	var new_window = window.open(", ", 'preview', 'toolbar = 0, location = 0, directories = 0, menubar = 0, scrollbars = 1, resizable = 0, statusbar = 0');
    
    	new_window.document.write("" +element.value+ "");
    }
    
    // ################################################################
    function copy(element) {
    	element.focus();
    	element.select();
    
    	if (document.all) {
    		var copy_range = element.createTextRange();
    
    		copy_range.execCommand("Copy");
    	}
    }
    However, I wouldn't know where to start on making a function to search a textarea of a user inputted term. This, is what I'm asking for in assistance

    Thankyou,

    Igloo...

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Igloo
    However, I wouldn't know where to start on making a function to search a textarea of a user inputted term.
    TextRange Object
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •