»
EnglishFrenchVietnamese

Print - Dynamic Content 2.0 - JavaScriptBank.com

Full version: jsB@nk » Form » Table » Dynamic Content 2.0
URL: https://www.javascriptbank.com/dynamic-content.html

Dynamic Content 2.0 © JavaScriptBank.comThis JavaScript code displays different content for different links on the same area, dynamically. You can display any content in the area.

Full version: jsB@nk » Form » Table » Dynamic Content 2.0
URL: https://www.javascriptbank.com/dynamic-content.html



CSS
<style type="text/css">.link{font-family:verdana,arial,helvetica; font-size:8pt; color:#404040; font-weight:normal; text-decoration:underline}.link:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#CC0000; font-weight:normal; text-decoration:underline}.header{font-family:verdana,arial,helvetica; font-size:22pt; color:#404040; font-weight:bold; text-decoration:none}</style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script language="JavaScript1.2">//-----------------------------------------------// Dynamic Content 2.0                          |//  Now supports IE, NS4, NS6                   |// (c) 2002 Premshree Pillai                    |//-----------------------------------------------var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;var ns6=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;var ns4=document.layers;function showContent(content){ if(ie4) {  showContentObj=document.all.qiksearch_div; } if(ns6) {  showContentObj=document.getElementById("qiksearch_div"); } if(ie4||ns6) {  if(showContentObj.innerHTML!=content)  {   showContentObj.innerHTML=content;  }  else  {   showContentObj.innerHTML="";  } } if(ns4) {  document.nsdiv.document.write(content);  document.nsdiv.document.close(); }}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<a href="javascript:void(0);" onclick="javascript:showContent('<font face=verdana,arial,helvetica>This is Content 1</font>');"><font face="verdana,arial,helvetica" color="#cc0000" size="-1"><b>Content 1</b></font></a> | <a href="javascript:void(0);" onclick="javascript:showContent('<font face=verdana,arial,helvetica>This is Content 2</font>');"><font face="verdana,arial,helvetica" color="#cc0000" size="-1"><b>Content 2</b></font></a> | <a href="javascript:void(0);" onclick="javascript:showContent('<font face=verdana,arial,helvetica>This is Content 3</font>');"><font face="verdana,arial,helvetica" color="#cc0000" size="-1"><b>Content 3</b></font></a><br><br><layer id="nsdiv" left="310"></layer><div id="qiksearch_div"><font face="verdana,arial,helvetica">This is Content 3</font></div><!--END DYNAMIC CONTENT 2.0--><!--------------------------------------------------------------------------------------><br><table align="center" width="400" cellspacing="0"><tbody><tr><td><font face="verdana,arial,helvetica" size="-1" color="#404040">This JavaScript displays different content for different links on the same area, dynamically.<br><br>You can display any content in the area. The function is called like this »<br><br><font face="courier">&lt;a href=&quot;javascript:void(0);&quot; onClick=&quot;javascript:showContent(&#39;<b>&lt;font face=verdana,arial,helvetica&gt;This is Content 1&lt;/font&gt;</b>&#39;);&quot;&gt;&lt;font face=&quot;verdana,arial,helvetica&quot; color=&quot;#CC0000&quot; size=&quot;-1&quot;&gt;&lt;b&gt;Content 1&lt;/b&gt;&lt;/font&gt;&lt;/a&gt;</font><br><br>The content marked bold above is the content that you want to display when a link is clicked. You can include &lt;HTML&gt; tags also. So you can even include images.<br><br>This version (<b>v 2.0</b>) supports IE, NS4, NS6.</font><hr width="100%" style="height: 1px; color: rgb(204, 0, 0);"></td></tr></tbody></table><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->