Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Posts posted by RussellReal

  1. wildcard (catchall) subdomains.. most hosting companies will enable this for you.. I

     

    f you are on a hosting account higher than a shared hosting account, vps/vds, dedis usually you can make your own wildcard subdomain with an A Record in your dns settings..

     

    if you are on shared hosting you will want to put in a ticket or contact them directly and have them add catch-all or wildcard subdomain functionality to your hosting account..

     

    some hostings will protest this, in which case if you really want this done, you will most likely need to move to a different hosting company.. but you probably won't have to deal with this as most hosting companies will :)..

  2. mod rewrite is an apache module and I'm quite certain it is not OS Specific, you shouldn't have a problem enabling it.. Your web hosting is PROBABLY giving you this excuse because they have the hosting accounts structured in a way that they all share the same web service or something.. although I don't see why it would be a bad idea to have mod rewrite working for all of them, its such an awesome feature :)

     

    anywya, my advice to you: change webhosts they're jerkin you around

  3. uhm.. you shouldn't do the iframe method then well the way you want to you shouldn't :).. you could however load the iframe and use the bgsound attribute..  or make a very simple flash mp3 player, and actually PLAY it with the iframe.. because with an iframe you can manipulate the DOM of the iframe but you can't take just the data within it.. and even if you could find a way you can't use the source of an mp3 to play that file :)

  4. welcome :) I've been here for so long and I don't think I made an introduction yet lol.. and you don't look crazy man.. You do look a bit young, however, but that just means you're probably gonna be smarter than all of the "pros" on this site one day.. its the way the world works.. *sigh*

     

    Goodluck anyway and I'll probably be answering some of your questions lol

  5. Here you'd be better off using jQuery than writing a recursive function to scour the page for elements with 'flash' as their className :)

     

    this would do what you want..

    <script src="http://code.jquery.com/jquery-latest.min.js"></script>
    <style type="text/css">
    .flash {
    color: black;
    }
    .flash1 {
    color: blue !important;
    }
    .flash2 {
    color: purple !important;
    }
    .flash3 {
    color: green !important;
    }
    </style>
    <script type="text/javascript">
    var flashes = ['flash1','flash2','flash3'];
    var flashInterval = 200; /* in MS */
    var originalClassName = '';
    var elements;
    var timeout;
    function nextFlash(num) {
    	if (++num > flashes.length) { num = 1; elements.attr('class',originalClassName) }
    	timeout = setTimeout("nextFlash("+num+")",flashInterval);
    	elements.toggleClass(flashes[num-1]);
    }
    function startFlash(className) {
    	originalClassName = className;
    	elements = $('.'+className);
    	nextFlash(0);
    }
    function stopFlash() {
    	clearTimeout(timeout);
    	elements.attr('class',originalClassName);
    }
    </script>
    <div class="flash">HEY WATSUP</div>
    <a id="start" href="#" onclick="startFlash('flash');$(this).hide();$('#stop').show();">
    Start Flash!
    </a><a style="display: none;" id="stop" href="#" onclick="stopFlash();$(this).hide();$('#start').show();">
    Stop Flash!
    </a>
    

  6. there is no proper way of doing this, HOWEVER, you can hack it together with timeouts :), timeouts will not halt other script execution (unless there is an alert)

     

          setTimeout('loadFunction_1()',5);
          setTimeout('loadFunction_2()',5);
          setTimeout('loadFunction_3()',5);
          setTimeout('loadFunction_4()',5);
    

     

    Thanks for post but got a response off another forum this morning, turns out you need to do this:

     

    ...
    if (window.XMLHttpRequest)
      				{// code for IE7+, Firefox, Chrome, Opera, Safari
      				[color=red]var[/color] xmlhttp=new XMLHttpRequest();
      				}
    			else
      				{// code for IE6, IE5
      				[color=red]var[/color] xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      				}
    ...
    

     

    ohhh.. I thought you meant executing functions at the same time not 1 after the other..

     

    you know you can also do this...

     

    function loadFuntion() {
                var xmlhttp = '';
                if (window.XMLHttpRequest)
                  {// code for IE7+, Firefox, Chrome, Opera, Safari
                  xmlhttp=new XMLHttpRequest();
                  }
                else
                  {// code for IE6, IE5
                  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                  }
                return xmlhttp;
    }
    function getAndPopulate(xmlhttp,num,pageToGet) {
                xmlhttp.onreadystatechange=function()
                  {
                  if (xmlhttp.readyState==4 && xmlhttp.status==200)
                         {
                         document.getElementById("function_"+num).innerHTML=xmlhttp.responseText;
                         }
                  }
               xmlhttp.open("GET",pageToGet,true);
               xmlhttp.send();
    }
    getAndPopulate(loadFunction(),1,'/scripts/1.php');
    getAndPopulate(loadFunction(),2,'/scripts/2.php');
    getAndPopulate(loadFunction(),3,'/scripts/3.php');
    

     

    with alot less code :)

  7. there is no proper way of doing this, HOWEVER, you can hack it together with timeouts :), timeouts will not halt other script execution (unless there is an alert)

     

          setTimeout('loadFunction_1()',5);
          setTimeout('loadFunction_2()',5);
          setTimeout('loadFunction_3()',5);
          setTimeout('loadFunction_4()',5);
    

  8. not to sound stupid, but I think I speak for every developer on the board when I say, you overcomplicated your post..

     

    If you "dumbed" it down a bit we'd probably understand it better.. but I'm gonna give it a shot and see if I nailed it..

     

    Basically you want each element in your drop downs to do a specific something.. well it is possible.. your a tags have onclick events.. the simplest way would be to build a function for each option.. however, the BEST option.. would be to create 1 function, pass in "acute" "oblong" etc into the function.. and have a switch statement handle each possibility, but I'm not exactly sure your experience level, but both would be in the beginner category so you should be fine :)

  9. is this iframe pointed to a document under your domain? javascript implements a sort of  "security feature" for developers to prevent data being parsed/modified thru javascript unless it is across the same domain.. however.. if you're looking to parse an embed tag from another website.. you can do the parsing from php and then request that data with javascript via an XMLHttpRequest object (AJAX)

  10. Russell, no offense man, but that's probably the worst way to do it.  JavaScript allows one to dynamically alter an element's CSS on the fly.  Why write directly to the DOM when you can simply play with CSS attributes?

     

    To the OP: the problem has two components - grabbing a hold of all the elements of a certain class, then changing their CSS attributes once you have them.  The easiest way to do both is to use jQuery.  It's selector engine saves one from having to worry about those browsers that don't implement a getElementsByClassName function.  To get jQuery and read it's documentation, go to: http://jquery.com

     

    So, with that out of the way, something like:

     

    $('.sometext').each(function(){
       $(this).css('color', 'blue');
    });

     

    Should do the trick.

     

    Keep in mind, that solving this problem does not require jQuery to work.  It's just the simplest way to go about it.  You could do the same thing in vanilla JavaScript.  It would merely require you to do the heavy lifting of looping through elements to find the right class name, then looping through them again to apply the new CSS rule.

     

    you're talking about jquery..

     

    and what do you think jquery does.. it does the whole loop for you.. its still doing the loop.. instead, my solution modifies 1 div, no offense to you but your solution seems just as simple as mine, except yours does more work than mine will :)

     

    sometimes a couple lines of code extra will work better than 1 line of jquery, lines don't matter its efficiency :)

     

    and PLUS.. your jQuery solution will modify each matched element on the page.. so you're basically adding more characters to the page than mine does aswell..

     

    I'm adding a style tag and some class declarations.. you're adding

     

    style="xxxxx: whatever; xxxxxx2: whatever;" to each matched element.. its not the most horrible way to do it, its just better than anything you've ever seen ;) thanks :)

  11. no it will not ignore the number, an integer inside of quotations isn't lost it is infact retained, what happens is that instead of a numerical data being held within it is stored as a string, it is a number with a different DataType

     

    as with many other languages out there, JavaScript allows what is called DataTyping in which you can change the datatype of a value whenever you want..

     

    for example..

    // setting the datatype
    var num = Number("45"); // will return 45 (integer value)
    var num = String(num); // will turn num back to a string 
    
    // examples of why datatyping is important 
    var num = 45; // this will be an integer value by default..
    var num = num + 1; // will equal 46
    var num = num + '%'; // will be changed into a STRING value containing "45%"
    
    //now look at it this way..
    
    var num = "45"; // sets it to a STRING value of "45" not the integer value of 45
    var num = 45 + num; //will result in 4545 instead of 90 which you would have been expecting..
    // the reason it results in 4545 is because + for math works differently for strings, 
    // since you can't add a string to a number, you can add the number INTO the string just fine
    // and so it does, but many other languages will give you a case of the ass for this..

     

    and you get errors for trying to divide :)..

     

    answer in a nutshell: The value isn't lost, you just can't access the integer value easily.. if you took for example..

     

    var name = "square45";

     

    to get the number you'd need to do something like this..

     

    var name = "square45";
    var numb = Number(name.replace('square',''));

     

    answers your Q? :)

  12. you can probably dynamically write a style tag with custom styles inside..

     

    for example..

     

    document.write("<style type='text/css'>.someclass { font-size: 32px !important; }</style>");

     

    !important will tell the browser to make that declaration more important than any other declaration of same name for any element affected by the css block :)

     

    then you can just rewrite the style tag as needed..

     

    for example

     

    <script type="text/javascript">
    fontSize = 12;
    function increaseSize(className) {
      fontSize++;
      code = document.getElementById('codeHolder');
      code.innerHTML = "<style type='text/css'>"+
        className+" { \n  font-size: "+fontSize+'px !important;\n}'+
      "</style>";
    }
    </script>
    <div id="codeHolder"></div>
    <div class='piss'>TEST ME!</div>
    <div><a href='javascript:increaseSize(".piss");'>Increase Size</a></div>
    

     

    Note: Untested.. but I don't see why it wouldn't work :)

  13. I just took a look @ the page.. what function fires when the user leaves the menu? add in your custom code to that function and you should be alright.. the on blur will not happen because you're never focussed on it.. try onMouseOut instead if you're adamant about using an event on that particular element :), however that will fire whenever you hover over each individual link inside the div :).. you could also try onMouseLeave but I don't think that is crossbrowser friendly :) jquery .hover() will solve all your problems

×
×
  • 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.