Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
problem with JS scripting...
Old 10-21-2008, 08:35 AM problem with JS scripting...
Average Talker

Posts: 24
Name: Ignatius Vinoth
Trades: 0
Dear Friendz,

I was tring to execute below JS in my page. But Im not sure why it it not working. As im completely zero in JS scripting. Can some one help me out. Even Im not sure will it work or not???


Code:
var htmltooltip={
 tipclass: 'htmltooltip',
 fadeeffect: [false, 400],
 anchors: [],
 tooltips: [], //array to contain references to all tooltip DIVs on the page
 positiontip:function($, tipindex, e){
  var anchor=this.anchors[tipindex]
  var tooltip=this.tooltips[tipindex]
  var scrollLeft=window.pageXOffset? window.pageXOffset : this.iebody.scrollLeft
  var scrollTop=window.pageYOffset? window.pageYOffset : this.iebody.scrollTop
  var docwidth=(window.innerWidth)? window.innerWidth-15 : htmltooltip.iebody.clientWidth-15
  var docheight=(window.innerHeight)? window.innerHeight-18 : htmltooltip.iebody.clientHeight-15
  var tipx=anchor.dimensions.offsetx
  var tipy=anchor.dimensions.offsety+anchor.dimensions.h
  tipx=(tipx+tooltip.dimensions.w-scrollLeft>docwidth)? tipx-tooltip.dimensions.w : tipx //account for right edge
  tipy=(tipy+tooltip.dimensions.h-scrollTop>docheight)? tipy-tooltip.dimensions.h-anchor.dimensions.h : tipy //account for bottom edge
  $(tooltip).css({left: tipx, top: tipy})
 },
 showtip:function($, tipindex, e){
  var tooltip=this.tooltips[tipindex]
  if (this.fadeeffect[0])
   $(tooltip).hide().fadeIn(this.fadeeffect[1])
  else
   $(tooltip).show()
 },
 hidetip:function($, tipindex, e){
  var tooltip=this.tooltips[tipindex]
  if (this.fadeeffect[0])
   $(tooltip).fadeOut(this.fadeeffect[1])
  else
   $(tooltip).hide() 
 },
 updateanchordimensions:function($){
  var $anchors=$('*[@rel="'+htmltooltip.tipclass+'"]')
  $anchors.each(function(index){
   this.dimensions={w:this.offsetWidth, h:this.offsetHeight, offsetx:$(this).offset().left, offsety:$(this).offset().top}
  })
 },
 render:function(){
 
  jQuery(document).ready(function($){
   htmltooltip.iebody=(document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
   var $anchors=$('*[@rel="'+htmltooltip.tipclass+'"]')
   var $tooltips=$('div[@class="'+htmltooltip.tipclass+'"]')
   $anchors.each(function(index){ //find all links with "title=htmltooltip" declaration
    this.dimensions={w:this.offsetWidth, h:this.offsetHeight, offsetx:$(this).offset().left, offsety:$(this).offset().top} //store anchor dimensions
    
    this.tippos=index+' pos' //store index of corresponding tooltip
    var tooltip=$tooltips.eq(index).get(0) //ref corresponding tooltip
    if (tooltip==null) //if no corresponding tooltip found
     return //exist
    tooltip.dimensions={w:tooltip.offsetWidth, h:tooltip.offsetHeight}
    $(tooltip).remove().appendTo('body') //add tooltip to end of BODY for easier positioning
    htmltooltip.tooltips.push(tooltip) //store reference to each tooltip
    htmltooltip.anchors.push(this) //store reference to each anchor
    var $anchor=$(this)
    $anchor.hover(
     function(e){ //onMouseover element
      htmltooltip.positiontip($, parseInt(this.tippos), e)
      htmltooltip.showtip($, parseInt(this.tippos), e)
     },
     function(e){ //onMouseout element
      htmltooltip.hidetip($, parseInt(this.tippos), e)
     }
    )
    $(window).bind("resize", function(){htmltooltip.updateanchordimensions($)})
   })
  })
  
 },
 
 reRender:function(){
  htmltooltip.updateanchordimensions($)
 }
}
htmltooltip.render()
HTML Code:
<div id="content1">
<div id="movies">
        <div id="movies1">
<h1><a href='movies.php'>LATEST MOVIES: HINDI</a></h1>
</div>
</div>
<center>
<table border="0" cellpadding="0px">
       <tr>
<td>
<table border="0" cellspacing="3" cellpadding="2">
<tr>     
   <td valign="top"><a href='hindi-ramchandpakistani.php'><img src="http://tbn0.google.com/images?q=tbn:nZTCBv-zEoCzoM:http://i6.photobucket.com/albums/y222/DesiMD/ramchand_pakistani.jpg" width="130" height="100"  rel="htmltooltip.js" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                  <div class="htmltooltip"><b><a href='hindi-ramchandpakistani.php'>Ramchand Pakistani (2008)</a></b><br>Genre: Drama</div>
<td valign="top"><a href='hindi-hello.php'><img src="http://tbn0.google.com/images?q=tbn:Q7xds_qze2Ce3M:http://bp3.blogger.com/_NjdBzKI5nYs/R4fAi11PLRI/AAAAAAAAAUA/R7OLK-bnio8/s400/hello%2Bmovie%2Bchetan%2Bbhagat.gif" width="130" height="100"  rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                  <div class="htmltooltip"><b><a href='hindi-hello.php'>Hello (2008)</a></b><br>Genre: Drama</div>
<td valign="top"><a href='hindi-kidnap.php'><img src="http://tbn0.google.com/images?q=tbn:UmTF9XWK2HE7eM:http://www.masala.com/images/tmp/full/kidnapadvance_full.jpg" width="130" height="100"  rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                  <div class="htmltooltip"><b><a href='hindi-kidnap.php'>Kidnap (2008)</a></b><br>Genre: Action</div>
<td valign="top"><a href='hindi-drona.php'><img src="http://tbn0.google.com/images?q=tbn:eCc3EtZ7vBQkWM:http://nowrunning.com/comingsoon/Drona/poster.jpg" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                 <div class="htmltooltip"><b><a href='hindi-drona.php'>Drona (2008)</a></b><br>Genre: Action<br> & Fantasy</div>
</tr><tr>
<td valign="top"><a href='hindi-welcometosajjanpur.php'><img src="http://tbn0.google.com/images?q=tbn:olbs_0XEFEUeOM:http://media.santabanta.com/newsite/cinemascope/images/wts_big.jpg" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                 <div class="htmltooltip"><b><a href='hindi-welcometosajjanpur.php'>Welcome to Sajjanpur (2008)</a></b><br>Genre: Drama</div>
<td valign="top"><a href='hindi-singhisking.php'><img src="http://tbn0.google.com/images?q=tbn:MpMMXmzVpHn3YM:http://www.luckykabutar.com/images/cddvds/SinghIsKing.jpg" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                 <div class="htmltooltip"><b><a href='hindi-singhisking.php'>Singh Is King (2008)</a></b><br>Genre:Action & Comedy</div>
</tr>
</table>
</td>
</tr>
</table>
</center>
<div id="more">
<ul>
                             <li id="catagories">
<ul><li><a href='index.php'>More...</a></li></ul>
</li>
</ul>
</div>
<div class="contentbottom"></div>
<!-- end content1 -->

<!-- start content2 --> 
<div id="movies">
        <div id="movies1">
<h1><a href='movies.php'>LATEST MOVIES: ENGLISH</a></h1>
</div>
</div>
<center> 
<table border="0" cellpadding="0px">
          <tr>
            <td>
              <table border="0" cellspacing="3" cellpadding="2">
                <tr>

<td valign="top"><a href='english-taken.php'><img src="http://tbn0.google.com/images?q=tbn:0wALodtq__X9PM:http://bp2.blogger.com/_ohdukKYzgLA/R-pz_TPNQSI/AAAAAAAAABc/MBs-w6apyWA/s320/taken-movie-wallpaper-001.jpg" width="130" height="100"  rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                  <div class="htmltooltip"><b><a href='english-taken.php'>TAKEN (2008)</a></b><br>Genre: Action</div>
<td valign="top"><a href='english-forbiddenkingdom.php'><img src="http://tbn0.google.com/images?q=tbn:theTOhWlq8eaTM:http://ilovehaagendazs.com" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                 <div class="htmltooltip"><b><a href='english-forbiddenkingdom.php'>The Forbidden Kingdom (2008)</a></b><br>Genre: Action & Fantasy</div>
<td valign="top"><a href='english-wanted.php'><img src="http://tbn0.google.com/images?q=tbn:ohKz212avKPx8M:http://iamthelostgirl.files.wordpress.com/2008/04/angie-2.jpg" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                  <div class="htmltooltip"><b><a href='english-wanted.php'>Wanted (2008) </a></b><br>Genre: Action<br></div>
</tr>
</table>
</td>
</tr>
</table>
</center>
<div id=more>
<ul>
                             <li id="catagories">
<ul><li><a href='index.php'>More...</a></li></ul>
</li>
</ul>
</div>
<!-- end content2 -->

<!-- start content3 --> 
<div id="movies">
        <div id="movies1">
<h1><a href='movies.php'>LATEST MOVIES: TAMIL</a></h1>
</div>
</div>
<center>
<table border="0" cellpadding="0px">
          <tr>
            <td>
              <table border="0" cellspacing="3" cellpadding="2">
                <tr>
<td valign="top"><a href='tamil-poisollaporom.php'><img src="http://1.bp.blogspot.com/_Qul3VnFzlPw/SNk3vniroFI/AAAAAAAAPbw/W6n8xZf8rws/s400/poi+solla+porom_techsatish.jpg" width="130" height="100"  rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                  <div class="htmltooltip"><b><a href='tamil-poisollaporom.php'> Poi Sollo Porom(2008)</a></b><br>Genre: Comedy</div>
<td valign="top"><a href='tamil-satyam.php'><img src="http://tbn0.google.com/images?q=tbn:mKuxG-NWfKy3SM:http://www.behindwoods.com/image-gallery-stills/photos-7/sathyam/tamil-movie-banner.jpg" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
                 <div class="htmltooltip"><b><a href='tamil-satyam.php'>Satyam (2008)</a></b><br>Genre: Action</div>
<td valign="top"><a href='tamil-dhaamdhoom.php'><img src="http://tbn0.google.com/images?q=tbn:6m4TaIz4zUe5uM:http://oceanic11.files.wordpress.com/2008/06/dhaam-dhoom-wallpaper1.jpg" width="130" height="100" rel="htmltooltip" onerror="this.src='http://apnaview.com/thumbimg/default.png';"></a></td>
       <div class="htmltooltip"><b><a href='tamil-dhaamdhoom.php'>Dhaam Dhoom (2008) </a></b><br>Genre:Action</div>
</tr>
</table>
</td>
</tr>
</table>
</center>
<div id="more">
<ul>
                             <li id="catagories">
<ul><li><a href='index.php'>More...</a></li></ul>
</li>
</ul>
</div>
</div>
<!-- end content3 -->
Quote:
/* tooltip */
div.htmltooltip{
position: absolute; /*leave this and next 3 values alone*/
z-index: 1000;
left: -1000px;
top: -1000px;
background: #91b5d0;
border: 5px solid #7ea4c1;
color: white;
padding: 3px;
width: 250px; /*width of tooltip*/
}
div.htmltooltip a{
color: #FFFFFF;
text-decoration: NONE;
}
/* tooltip end */
iggywiggy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-21-2008, 11:16 AM Re: problem with JS scripting...
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
It looks like the script is using the jQuery library. Have you included a link to it in the <head>, before the script that you are trying to run?
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 10-21-2008, 02:10 PM Re: problem with JS scripting...
Average Talker

Posts: 24
Name: Ignatius Vinoth
Trades: 0
Dear Abel,

I don't know how to say thanx but still Thank you, Thank you...Really you ppl are great & fabulous. Really this site is useful for the ppl like us.

Ignatius
iggywiggy is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to problem with JS scripting...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32197 seconds with 12 queries