User Profile

Collapse

Profile Sidebar

Collapse
Dasty
Dasty
Last Activity: Oct 15 '09, 07:23 AM
Joined: Nov 10 '07
Location: Slovakia
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Thanks. I really love you guys.

    I ended up with this:

    [CODE=javascript]mystr.replace(/((https?|ftp):\/\/[^\s]+)/g, '<a href="$1">$1</a>');[/CODE]

    Which is enough for my needs.
    See more | Go to post

    Leave a comment:


  • Is it possible to write reg.expression for such a replace?

    My problem:

    My users will write some text into <textarea> area. All I want to do with javascript is to take that textarea.value and replace all url links there with regular <a href> and then put whole text (with replaced urls) into another div.

    Let's show it on example:

    User will write sentence:

    "This is my site http://www.try.org/see.html and I would like to replace it"...
    See more | Go to post

  • Dasty
    replied to addEventListener not working in mozilla
    ^^ as Timo said. It works fine with mozilla browsers.

    But then, you are using IE like event handling (working with window.event object) in your function. Mozilla is sending event object as parameter to even handler function (so alter your code). Yes, it's sad that you have to write different code for different browsers.

    Example for cross-browser event handling:

    [CODE=javascript]if (document.addEv entListener){...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to problem traversing through dom
    Maybe because the recursion is not written right. You got two cycles for the elements on the same level (for & while). Just remove one of them (i removed "for") :D not sure if that caused infinity loop

    [CODE=javascript]function nodeTrav(elem)
    {
    while(elem)
    {
    if(elem.nodeTyp e==1)
    {
    alert("parent node is:"+elem.paren tNode.nodeName+ " current node is:"+elem.nodeN ame);...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to Javascript lastUpdatedDate
    Why are you using the image in same url for two different states? Make different images with different urls, and just change <IMG> src based on current state of wifi. (this way you can call some page that will tell you what is the current state of wifi by XMHLHttpRequest and change image).

    But if it is not acceptable (you are generating some additional information into image file). You can always force browser to ask for new...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to problem traversing through dom
    You are using recursive calling of function, but you forgot to declare variable "i" as local variable, so of course code will mess up because all called functions in recursion share the same global "i" variable.

    Code:
    for(i=0;i<elem.childNodes.length;i++)
    change it to:

    Code:
    for(var i=0;i<elem.childNodes.length;i++)
    always check the variable's scope in recursion!
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to AJAX IE7 Problem
    You can not use innerHTML to insert XML tags into your site, even when it is specified as xhml. innerHTML just simply cant do it right. Well, firefox fixed it some time ago, but it's just FF (it is from ver 1.5 or so). But it is not problem in your case, because you are using it just as "workaround " for XML parsing. As acoder said, use responseXML property to parse XML.

    PS: One more thing about innerHTML: from my experience,...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to Add remove elements dynamically
    Code:
    var fElement = document.getElementsByName('elementname');
    alert(fElement.length);
    Code:
    var newobj = document.createElement('input');
    newobj.name = 'myname';
    document.body.appendChild(newobj);
    as an examples ...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to Javascript issues with Mozilla
    And fix referencing too, because it is invalid. Make it this way:
    Code:
    document.getElementById('LinksInternal').style.display = '';
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to How to set textbox to readonly
    Code:
    <input type=text value="Vijay" id="txt1" readonly  />
    in html

    OR
    [CODE=javascript]document.getEle mentById('txt1' ).setAttribute( 'readonly','tru e');[/CODE]
    in javascript
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to Flaky IFrame Print Issue
    No, it is not ... it something different.

    Code:
    function doPrint(){
        this.focus();
        this.print();
    }
    document.onload=doPrint();
    Look at your code closely. by doPrint(); you are calling doPrint function and you are storing result of this function into document.onload . So, you are not calling doPrint function after document is loaded as you would expect (which may cause issues as you described)....
    See more | Go to post

    Leave a comment:


  • Why so much anger? I was not telling that IE is 100% fine or better then other borwsers. The only thing i tried to say was that it's not impossible to write quite rich pages that work in IE7 and other w3c compilant browsers today. It was hard as hell ... almost impossible with IE6, but I am running quite complicated pages in IE7 and other browsers with just minor changes (and huge work-arounds for IE6). What is so bad on such a statement, that you...
    See more | Go to post

    Leave a comment:


  • Today, IE is not that evil. The problem is, that many programmers still work in Quirks mode that can be easily turned off from IE6. Is it browser's fault that programmers are not using what browsers provide? My all pages work in IE6,IE7,Opera 9.02+ and FF. And I have to say, that 99% of problems I am dealing with belong only to outdated IE6 (tho, still high % of usage). Whatever everyone keep saying, I dont have hard time with IE7. Really ... Just...
    See more | Go to post

    Leave a comment:


  • replace lines 42-70 with this code:

    [CODE=javascript]
    var response_receiv ed = false;

    function confirm_delete( )
    {
    if (response_recei ved) return true;
    var agre=confirm('a re you sure you want to delete the data???') ;
    if(!agre) return false;
    confirm_use();
    return false;
    }
    function confirm_send(us tr)
    {
    var http...
    See more | Go to post

    Leave a comment:


  • Well, you are calling asynchronous ajax request, but your code is writen like request is synchronous. So your code works like that:

    1) starting ajax request
    2) sending form
    3) getting ajax response

    So, you are getting / handling response after page is submitted (is gone), so result is weird.

    Try to change this function:

    Code:
    function confirm_delete()
    {
      var agre=confirm('are
    ...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to Add Netscape/mozilla Compatability?
    The sad part is, that acoder is actually right. Your arc90_sidenoteT XT class has fixed width of 12em which causes your overflow. :(...
    See more | Go to post

    Leave a comment:


  • Dasty
    replied to Code compatible to Mozilla
    Exactly what acoder said. Dont forget that "QQ" + i should be the id of element - not its name. I bet your problem is right there (that you are using name instead of id), bacause in IE, getElementById returns elements not only by id, but even elements with given name (which is invalid). That's why it works in IE and not in Mozilla....
    See more | Go to post

    Leave a comment:


  • Post it here or PM code to me as well. Really want see the reason too.
    (seems like it has problems when you are sending many requests as "burst")

    I got strange feeling in my stomach that I missed something simple again :)
    See more | Go to post

    Leave a comment:


  • I did not follow the purpose of your script. But you got error (typo?). in your code. you are sending id to your function as string value. But in setTimeout you forgot to add quotation marks:

    Code:
    setTimeout("start('"+itemId+"'); ", (1000));
    But your code will end up in infinity loop of calling start() for your item id (every 1 sec). But it's maybe because the code is not finished yet.
    See more | Go to post

    Leave a comment:


  • Oh, cycle ... sure. Well, if your alert(cBox.valu e) shows values, problem is somewhere else.
    Let's look at it:
    - You are creating http variable locally in function.
    - And you are creating handler for onreadystatecha nge event as local function as well.

    So, that event handler function creates closure (because it is referenced outside in instance of XHR object). But (because of cycle) all http request objects share...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...