Results 1 to 8 of 8

Thread: where is..?

  1. #1
    Join Date
    Dec 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default where is..?

    HTML Code:
    var agt=navigator.userAgent.toLowerCase();
    	var is_major = parseInt(navigator.appVersion);
        var is_minor = parseFloat(navigator.appVersion);
        var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
                    && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
                    && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
        var is_nav2 = (is_nav && (is_major == 2));
        var is_nav3 = (is_nav && (is_major == 3));
        var is_nav4 = (is_nav && (is_major == 4));
        var is_nav4up = (is_nav && (is_major >= 4));
        var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                              (agt.indexOf("; nav") != -1)) );
        var is_nav6 = (is_nav && (is_major == 5));
        var is_nav6up = (is_nav && (is_major >= 5));
        var is_gecko = (agt.indexOf('gecko') != -1);
    
    
        var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
        var is_ie3    = (is_ie && (is_major < 4));
        var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
        var is_ie4up  = (is_ie && (is_major >= 4));
        var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
        var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
        var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
        var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
        var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
        var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
    
        var is_aol   = (agt.indexOf("aol") != -1);
        var is_aol3  = (is_aol && is_ie3);
        var is_aol4  = (is_aol && is_ie4);
        var is_aol5  = (agt.indexOf("aol 5") != -1);
        var is_aol6  = (agt.indexOf("aol 6") != -1);
    
        var is_opera = (agt.indexOf("opera") != -1);
        var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
        var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
        var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
        var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
        var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
    
        var is_webtv = (agt.indexOf("webtv") != -1); 
    
        var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
        var is_AOLTV = is_TVNavigator;
    
        var is_hotjava = (agt.indexOf("hotjava") != -1);
        var is_hotjava3 = (is_hotjava && (is_major == 3));
         var is_hotjava3up = (is_hotjava && (is_major >= 3));
        var is_js;
        if (is_nav2 || is_ie3) is_js = 1.0;
        else if (is_nav3) is_js = 1.1;
        else if (is_opera5up) is_js = 1.3;
        else if (is_opera) is_js = 1.1;
        else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
        else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
        else if (is_hotjava3up) is_js = 1.4;
        else if (is_nav6 || is_gecko) is_js = 1.5;
        else if (is_nav6up) is_js = 1.5;
       else if (is_ie5up) is_js = 1.3
        else is_js = 0.0;
    	
    	<!--
    mes_pr = "Preview"
    mes_cpr = "Close Preview"
    previewSize = 250;
    displayPreview=1;
    var ns6=document.getElementById&&!document.all
    var ie4=document.all
    
    function Maximize(id, sURL){
    	var preview;
    	preview=new String(document.getElementById("idMax" + id).innerHTML);
    	var i=preview.indexOf("Maximize<");
    	if(i > 0){	
    		document.getElementById("idFrame" + id).height = 400;
    		document.getElementById("idMax" + id).innerHTML = '<font color=\"#ff0000\">&raquo;</font> <a href="javascript:Maximize(' + id + ', \'' + sURL + '\')" class=\"content\">Minimize</a>';
    		document.getElementById("idFrame" + id).src = sURL;
    	}
    	else{
    		document.getElementById("idFrame" + id).height = previewSize;
    		document.getElementById("idMax" + id).innerHTML = '<font color=\"#ff0000\">&raquo;</font> <a href="javascript:Maximize(' + id + ', \'' + sURL + '\')" class=\"content\">Maximize</a>';
    		document.getElementById("idFrame" + id).src = sURL;
    	}
    }
    
    function OnPreview(n, sUrl) {
      var prevID = n;  
      var preview;
      if(!ns6){
    		preview=document.getElementById("id" + prevID).innerText;
      }else{
    		preview=document.getElementById("id" + prevID).childNodes[0].nodeValue;		
      }
      var temp = new String(sUrl);
      var temp = new String(sUrl);
      if(preview == "Quick View"){
    	document.getElementById("id" + prevID).innerHTML = "Close Quick View";
    	document.getElementById("id" + prevID).style.cssText = "COLOR: 'red'; FONT-SIZE: 11px;";
    	if(!ns6)		
    		document.getElementById("idSpan" + prevID).style.visibility = "visible";
    	document.getElementById("idMax" + prevID).style.visibility = "visible";
    	document.getElementById("idShow" + prevID).style.display = "block";
    	document.getElementById("idFrame" + prevID).src = sUrl;
      }
      else{
    	document.getElementById("id" + prevID).innerHTML = "Quick View";
    	document.getElementById("id" + prevID).style.cssText = "COLOR: 'red'; FONT-SIZE: 11px;";
    	if(!ns6)	
    		document.getElementById("idSpan" + prevID).style.visibility = "hidden";
    	document.getElementById("idMax" + prevID).style.visibility = "hidden";
    	document.getElementById("idShow" + prevID).style.display = "none";
    	document.getElementById("idFrame" + prevID).src = "";
     }
    }
    function ppreview(url, id) {
    	var ti = url.replace(/'/g, '\\\'');
    	ti = ti.replace(/<b>/g, '');
    	ti = ti.replace(/<\/b>/g, '');
          if(is_nav4 == false)
     	document.write("&nbsp;<A class=\"content\" href=\""+url+"\" id=id"+id+" onClick=\"OnPreview("+id+",'"+ti+"');return false\">Quick View</A>");
     }
    function potherfunctions(url, id, title) {
    	var ti = title.replace(/'/g, '\\\'');
    	ti = ti.replace(/<b>/g, '');
    	ti = ti.replace(/<\/b>/g, '');	
          if(is_nav4 == false)
    	  {	
    		document.write("<span id=\"idMax"+id+"\" STYLE=\"visibility:hidden\"><font color=\"#ff0000\">&raquo;</font> <a href=\""+url+"\" onClick=\"javascript:Maximize("+id+",'"+url+"');return false\" class=\"content\">Maximize</a></span>&nbsp;");
    		if(!ns6)
    			document.write("<span id=\"idSpan"+id+"\" STYLE=\"visibility:hidden\"><font color=\"#ff0000\">&raquo;</font> <a href=\""+url+"\" onClick=\"javascript:window.external.AddFavorite('"+url+"','"+ti+"');return false\" class=\"content\">Bookmark</a></span>");
    		document.write("<div id=\"idShow"+id+"\" STYLE=\"display:none\"><iframe ID=\"idFrame"+id+"\" HEIGHT=\"250\" SRC WIDTH=\"90%\"></iframe></div>");
    	  }
     }
    Hello I have the code in javascript but I would like to know which is the function that generates the number go consecutivly, that is to say, 1 2 3 4 5 and more.. An example of what I want faeces is the following one <a href= "someurl" id= "go automatic generated"> Go to </a>

    REGARDS

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There is no such function I can see in the code from your post, any numbers (other than 1 and 0 for true and false) that it uses come from elsewhere (from where it is called from) as far as I can tell. To generate sequential numbers, try this out:

    Code:
    <script type="text/javascript">
    var count=0
    function getNum(){
    var num=count;
    count++
    return num;
    }
    </script>
    HTML Code:
    <input type="button" value="Get Number" onclick="alert(getNum())">
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    nice but i need to print the random number in html tag like:

    <a href="link.com" id="randomnumer">some name</a>

    how i can do this?

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    An id cannot be or begin with just a number. Do you want a random number or a sequential one or does it matter? Sort of sequential is easiest. Give all of your links that you want this done to a class name - say, 'numbered'. Example:

    HTML Code:
    <a class="numbered" href="link.com">some name</a>
    Put this script in the head:

    Code:
    <script type="text/javascript">
    function assignNums(){
    var links=document.links
    for (var i_tem = 0; i_tem < links.length; i_tem++)
    if (links[i_tem].className=='numbered')
    links[i_tem].id = 'link_'+i_tem
    }
    
    onload=assignNums;
    </script>
    All links on the page with the class 'numbered' will be assigned id's in the form of:

    link_#

    where # is a unique number.

    These numbers will not necessarily be sequential (there may be gaps between the numbers assigned) but, each will be larger than the one assigned to any given previous link, and so, different/unique.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Dec 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation

    ok and for finishe please help me with this code, all words with the name HERE is where i need to put a randomnumer can you help me please?

    HTML Code:
    <dl>
    
    	<dt><b><a href="<module:url>" CLASS="nav"><FONT COLOR="#0066cc" FACE="Verdana" SIZE="2"><module:title></FONT></a></b> <a href="<module:url>" target="_blank" id=[B]HERE[/B]><img src="<module:imageurl>/nw.gif" border=0></a> - <SCRIPT>ppreview('<module:url>','id=[B]HERE[/B]')</SCRIPT> 
    	<SCRIPT>potherfunctions('<module:url>','id=[B]HERE[/B]', '')</SCRIPT>
            
    	</dt>
    
    	<dd class="sr">
    
    		<module:description><BR>
    
    		
    	</dd>
    
    </dl>
    i understand i canīt put an id tag but please tell me how i can do to solve this problem
    Last edited by urgido; 12-11-2005 at 06:30 AM.

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    How does the rest of this code:

    Quote Originally Posted by urgido
    HTML Code:
    <dl>
    
    	<dt><b><a href="<module:url>" CLASS="nav"><FONT COLOR="#0066cc" FACE="Verdana" SIZE="2"><module:title></FONT></a></b> <a href="<module:url>" target="_blank" id=[B]HERE[/B]><img src="<module:imageurl>/nw.gif" border=0></a> - <SCRIPT>ppreview('<module:url>','id=[B]HERE[/B]')</SCRIPT> 
    	<SCRIPT>potherfunctions('<module:url>','id=[B]HERE[/B]', '')</SCRIPT>
            
    	</dt>
    
    	<dd class="sr">
    
    		<module:description><BR>
    
    		
    	</dd>
    
    </dl>
    get written to begin with? And, while I am at it, are you sure you want a random number now? Random numbers are not necessarily unique, you know.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Dec 2005
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I need it to create the effect of Quick view you can check it in www.whatseek.net and for this I need that every link generated in my page of index possesses(relies on) a number of ID differently. Since the tag module:url means the link. Regards and graces(thanks) for your patience

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes but, how does it get generated?
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •