ako napisem noscript

Programovacie jazyky, rady, poradňa...
KaktusBR
Medium Expert
Medium Expert
Príspevky: 103
Registrovaný: 13 dec 2007, 17:13
Bydlisko: IOM
Kontaktovať používateľa:

ako napisem noscript

Príspevok od používateľa KaktusBR »

ahojte. potrebujem poradit. vsetko v scripte mi funguje ako chcem ale chcem ho osetrit pre pripad ze v prehliadaci nebezi javascript. viem ze pomocou <noscript> ale neviem kde a ako to mam napisat. lebo ked to dam na stranku a vypnem javascript tak sa mi zobrazi aj nefunkcna cast aj funkcna cast.

Kód: Vybrať všetko

  <div id="menu">
  
  <!--Links used to initiate the sub menus. Pass in the desired submenu index numbers (ie: 0, 1) -->
   <div id="frame">
 
 <ul id="navigation">
 <li><a onClick="showit(0)">Hlavnemenu</a></li>
 <li><a onClick="showit(1)">Hlavnemenu</a></li>
 <li><a href="">Hlavnemenu</a></li>
 <li><a onClick="showit(2)">Hlavnemenu</a></li>
 <li><a onClick="showit(3)">Hlavnemenu</a></li>
 <li><a onClick="showit(4)">Hlavnemenu</a></li>
 <li><a href="">Hlavnemenu</a></li>
 </ul>
  </div>
</div>
<!-- Edit the dimensions of the below, plus background color-->
<ilayer width=840 height=25 name="dep1" bgColor="#E6E6FF">
<layer name="dep2" width=840 height=25>
</layer>
</ilayer>
<div id="describe" onMouseover="clear_delayhide()" onMouseout="resetit(event)"></div>


<script language="JavaScript1.2">

/*
Tabs Menu (mouseover)- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var submenu=new Array()

//Set submenu contents. Expand as needed. For each content, make sure everything exists on ONE LINE. Otherwise, there will be JS errors.
 
submenu[0]='<div id="sub0"><a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a></div>'

submenu[1]='<div id="sub1"><a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a></div>'

submenu[2]='<div id="sub2"><a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a></div>'

submenu[3]='<div id="sub3"><a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a> | <a href="http://www.asdf.sk/">asdf</a></div>'

submenu[4]='<div id="sub4"><a href="http://www.asdf.sk/">asdf</a></div>'



//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=2000

/////No need to edit beyond here

var menuobj=document.getElementById? document.getElementById("describe") : document.all? document.all.describe : document.layers? document.dep1.document.dep2 : ""

function showit(which){
clear_delayhide()
thecontent=(which==-1)? "" : submenu[which]
if (document.getElementById||document.all)
menuobj.innerHTML=thecontent
else if (document.layers){
menuobj.document.write(thecontent)
menuobj.document.close()
}
}

function resetit(e){
if (document.all&&!menuobj.contains(e.toElement))
delayhide=setTimeout("showit(-1)",delay_hide)
else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhide=setTimeout("showit(-1)",delay_hide)
}

function clear_delayhide(){
if (window.delayhide)
clearTimeout(delayhide)
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

</script>
a cast ktora chcem aby sa zobrazila ked je vypnuty javascriptu

Kód: Vybrať všetko

 <div id="frame"><ul id="navigation">
    <li><a href="">hlavnemenu</a>
	<ul>
        <li><a href="http://www.asdf.sk">submenu</a></li>
        <li><a href="http://www.asdf.sk">submenu</a></li>
		<li><a href="http://www.asdf.sk">submenu</a></li>
      </ul>
	</li>

    <li><a href="">hlavnemenu</a>
      <ul>
        <li><a href="http://www.asdf.sk">submenu</a></li>
        <li><a href="http://www.asdf.sk">submenu</a></li>
		<li><a href="http://www.asdf.sk">submenu</a></li>
      </ul>
    </li>

    <li><a href="">hlavnemenu</a>

      <ul>
        <li><a href="http://www.asdf.sk">submenu</a></li>
        <li><a href="http://www.asdf.sk">submenu</a></li>
        <li><a href="http://www.asdf.sk">submenu</a></li>
		<li><a href="http://www.asdf.sk">submenu</a></li>
		<li><a href="http://www.asdf.sk">submenu</a></li>

      </ul>
    </li>
  
    <li><a href="http://www.asdf.sk">hlavnemenu</a></li>
  
    <li><a href="">hlavnemenu</a>
	   <ul>
	    <li><a href="http://www.asdf.sk">submenu</a></li>
        <li><a href="http://www.asdf.sk">submenu</a></li>
        <li><a href="http://www.asdf.sk">submenu</a></li>
	   </ul>
 	</li>
	
	    <li><a href="http://www.asdf.sk">hlavnemenu</a>
	   <ul>
	   <li><a href="http://www.asdf.sk">submenu</a></li>
		</ul>
	</li>
	
	   <li><a href="http://www.asdf.sk">hlavnemenu</a></li>
	
  </ul>
  </div>
</div>
za kazdu radu budem vdacny
zaggi
Medium Star
Medium Star
Používateľov profilový obrázok
Príspevky: 314
Registrovaný: 04 feb 2007, 19:32

Príspevok od používateľa zaggi »

proste to das do <noscript> ... </noscript> tagu ...

http://www.w3schools.com/TAGS/tag_noscript.asp

nie je na tom nic zazracne
KaktusBR
Medium Expert
Medium Expert
Príspevky: 103
Registrovaný: 13 dec 2007, 17:13
Bydlisko: IOM
Kontaktovať používateľa:

Príspevok od používateľa KaktusBR »

presne tak som to spravil ale ked som vypol javascript tak sa mi to zobrazilo 2 krat a stranku uplne rozhadzalo.

//autoeditacia

no nakoniec sa mi to podarilo spravit tak ze som napozicioval tak aby to prekrylo to co malo. neviem ci je to 100% validne takto to spravit ale dolezite je ze to ide. aj tak diky
zaggi
Medium Star
Medium Star
Používateľov profilový obrázok
Príspevky: 314
Registrovaný: 04 feb 2007, 19:32

Príspevok od používateľa zaggi »

dufam ze si cital aj toto:

Note: Browsers that do not recognize the <script> tag will display the tag content as text on the page. To prevent browsers from doing this, you should hide the script in comment tags. An old browser (one that does not recognize the <script> tag) will ignore the comment, and not write the tag content on the page. A new browser will understand that the script should be executed, even if it is surrounded by comment tags!
Napísať odpoveď