Current location: Hot Scripts Forums » General Web Coding » JavaScript » how to define value


how to define value

Reply
  #1 (permalink)  
Old 01-11-09, 01:21 PM
Frogger Frogger is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 149
Thanks: 5
Thanked 0 Times in 0 Posts
how to define value

Hi all,

Just wondering if someone can please help.
Getting an error message on FireFox regarding my javascript.
As a novice not sure how to fix.
Have tried var cur.filters and var filters but no luck.
ANy ideas please ?

Error message is:

javascript error cur.filters underfined

Code:

Code:
var cur;
 

  if (which==0) 
    cur.filters.alpha.opacity=100 
  else 
    cur.filters.alpha.opacity=35 
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-12-09, 04:39 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
cur has to be an object. Can you post the rest of the code and tell us exactly what you want to do?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-12-09, 04:48 AM
Frogger Frogger is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 149
Thanks: 5
Thanked 0 Times in 0 Posts
Sorry I think I missed something.

Code:
function makevisible(cur,which) { 

var cur;


  if (which==0) 
    cur.filters.alpha.opacity=100 
  else 
    cur.filters.alpha.opacity=35 
}
works with

HTML Code:
<a href="index.html"><img src="images/example.jpg" style="filter:alpha(opacity=100)" onmouseout="makevisible(this,0)" onmouseover="makevisible(this,1)" alt="" /></a>
Thanks again
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-12-09, 05:00 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Remove the var cur; line. That redefines the variable and gives it no value.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 01-12-09, 05:10 AM
Frogger Frogger is offline
Wannabe Coder
 
Join Date: Jul 2006
Posts: 149
Thanks: 5
Thanked 0 Times in 0 Posts
I did that but Firefox says .

Javascript Error:

cur.filters is undefined
Source File: http://www.domainname.com.au/swap.js line 31
Which is cur.filters.alpha.opacity=35


cur.filters is undefined
Source File: http://www.domainname.com.au/swap.js line 29
Which is cur.filters.alpha.opacity=100


It also says under CSS error

Warning: Error in parsing value for property 'filter'. Declaration dropped.
Source File: http://www.domainname.com.au/residential.htm
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 01-12-09, 05:16 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Ah yeah, Firefox doesn't use "filters". Use it's CSS opacity value.

https://developer.mozilla.org/en/CSS/opacity

Quote:
css Code:
  1. div.transp { /* make the div translucent */
  2.    opacity: 0.6;
  3.    filter: "alpha(opacity=60)"; /* expected to work in IE 8 */
  4.    filter: alpha(opacity=60);   /* IE 4-7 */
  5.    zoom: 1;                     /* needed in IE up to version 7, or set width or height to trigger "hasLayout" */
  6. }
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
define() and include problem darkcarnival PHP 15 04-23-07 10:36 AM
difference between typedef and #define KSB C/C++ 1 10-09-06 05:34 PM
Include problem in C bkbenson C/C++ 4 02-08-05 05:24 AM
Problems with Define Function 1jetsam PHP 2 01-30-05 08:40 PM
Constants, define(), and HTML Amulet PHP 5 01-10-05 05:55 PM


All times are GMT -5. The time now is 10:26 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.