Results 1 to 7 of 7

Thread: Javascript Replace function - Object doesn't support this property or method

  1. #1
    Join Date
    Mar 2010
    Posts
    182

    Javascript Replace function - Object doesn't support this property or method

    Hello,
    I am trying to create a form that will submit a new post to the database. When I write the code for it in javascript it does not work.
    This is what I have tried
    Code:
    function PreviewText()
    {
    
      var gen=window.open('','preview','height=400,width=500');
      var stbdy
      stbdy=document.PostNews.Body.value;
      stbdy=stbdy.Replace(/vbcrlf/g, "<br>");
    Any help on this is appreciated. Thank you for your help

  2. #2
    Join Date
    Nov 2009
    Posts
    343

    Re: Javascript Replace function - Object doesn't support this property or method

    Hello,
    You can see the code below. See if it helps
    Code:
    var url = document.getElementById("recordnum");
    var mytit;
      tempy {                                       // we use tempy/catch blocks to hide errors
        var temp = document.getElementsByTagName('temp');      // we have to iterate through every temp b/c we can't get to the mytit otherwise
        for(i = 0; i < temp.length; i++) {               // for every temp in the document
          var x=temp[i].getElementsByTagName('TD');         // get all of the Columns
          if (x.length == 2 && x[0].innerHTML == "mytit") {  // if the row has 2 columns and the first one has the text of mytit
            mytit = x[1].innerHTML.replace(/(<([^>]+)>)/ig,""); // stempip out all of the HTML so we just have text
           if (debug > 0) alert('found mytit: ' + mytit);      // just a debug notice
          }
        }
    } catch (e) {}
    
    var mymytit = mytit;
    document.mytit = mymytit
    //alert(mymytit);

  3. #3
    Join Date
    Nov 2009
    Posts
    446

    Re: Javascript Replace function - Object doesn't support this property or method

    Hello,
    See if this is what you need.
    Code:
    Array.prototype.unique = function () {
       var test = new Array();
       o:for(var x = 0, n = this.length; x < n; x++)
       {
          for(var a = 0, y = test.length; a < y; a++)
          {
             if(test[a]==this[x])
             {
                continue o;
             }
          }
          test[test.length] = this[x];
       }
       return test;
    }

  4. #4
    Join Date
    Nov 2009
    Posts
    583

    Re: Javascript Replace function - Object doesn't support this property or method

    Hello,
    Just have a look at the following two methods
    Code:
    function export
    {
    exmp=window.showModalDialog(saveas.jsp, "export", 'set the requird properties here');
    if (exmp)
    document.location.replace(exmp);
    }
    And
    Code:
    function down
    {
    var urltest="<%=request.getContextPath()%>"+"/temp.jsp";
    var pdf=urltest+"?reportName="
    window.returnValue=pdf;
    self.close();
    }

  5. #5
    Join Date
    Nov 2009
    Posts
    518

    Re: Javascript Replace function - Object doesn't support this property or method

    Hello,
    This is the syntax of the code you are looking for, you will have to insert your code in the syntax.
    Code:
    <html>
    <body>
    <div id="trgt"></div>
    <script>
    var trgt;
        function init()    {
            trgt = document.getElementById('trgt');
            trgt.innerHTML = 'stuff'; 
    }
    init();
    </script>
    </body>
    </html>

  6. #6
    Join Date
    Nov 2009
    Posts
    330

    Re: Javascript Replace function - Object doesn't support this property or method

    Hello,
    Here is the modified code
    Code:
    <html>
    <body>
    <div id="target"></div>
    <script>
    var test = "";
    for(var idx in target)
    {
    test += "("+idx+","+target[idx]+")";
    }
    alert(test);
    </script>
    </body>
    </html>

  7. #7
    Join Date
    Nov 2009
    Posts
    446

    Re: Javascript Replace function - Object doesn't support this property or method

    Hello,
    You can try the following code, though I am not sure that this is what you are looking for
    Code:
    <script type="text/javascript">
    function setValues()
    {
    var blst = document.myform.bhd_headings;
    var plst = document.myform.pib_headings;
    
    var bval = '' // String of selected base_heading ids to
    map
    var pval;
    
    for ( i=1; i<blst.options.length; i++ ) {
    if ( blst.options[i].selected ) {
    if ( !bval ) {
    bval = bval +
    blst.options[i].value;
    }
    else {
    bval = bval + ':' +
    blst.options[i].value;
    }
    }
    }

Similar Threads

  1. C# Equivalent Of Javascript's Location.replace() Function?
    By ASHER in forum Software Development
    Replies: 6
    Last Post: 16-05-2010, 01:20 AM
  2. javascript replace function not working
    By Cornnelius in forum Software Development
    Replies: 5
    Last Post: 13-05-2010, 12:12 AM
  3. Replies: 5
    Last Post: 11-03-2010, 05:45 AM
  4. Definition of a property line in a method
    By Zool in forum Software Development
    Replies: 3
    Last Post: 23-11-2009, 02:46 PM
  5. What is the property of dhtml innertext method
    By Unnat in forum Windows Software
    Replies: 3
    Last Post: 12-08-2009, 10:16 AM

Tags for this Thread

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
  •  
Page generated in 1,717,160,636.76380 seconds with 16 queries