Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows VistaWindows XPWindows MeWindows 98Windows 95Virtual PCInternet ExplorerOutlook ExpressWindows MediaSecurity
Related Topics
MS Server ProductsMS OfficePC HardwareMore Topics ...

Windows Forum / Internet Explorer / General Topics / June 2008

Tip: Looking for answers? Try searching our database.

Porblems Running JavaScript with IE6 or 7 but works fine on FireFox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
remon87 - 19 Jun 2008 19:38 GMT
Hi

I'm having a problem running some scripts on IE 6 & 7, but the sam
scripts runs fine on FireFox

I'm trying to get some rating (via stars images) and add that to the D
using ColdFusion as my back-end code

Here's my JavaScript code, please take a look and if you can assist m
with finding out why it doesn't work on IE

var ratingModule = Class.create(
ratingModule.prototype =
initialize: function()
preStars = []
preStars[0] = '/images/community/star_0.gif'
preStars[1] = '/images/community/star_1.gif'
preStars[2] = '/images/community/star_2.gif'
preStars[3] = '/images/community/star_3.gif'
preStars[4] = '/images/community/star_4.gif'
preStars[5] = '/images/community/star_5.gif'
preLightStars = []
preLightStars[0] = '/images/community/light_star_0.gif'
preLightStars[1] = '/images/community/light_star_1.gif'
preLightStars[2] = '/images/community/light_star_2.gif'
preLightStars[3] = '/images/community/light_star_3.gif'
preLightStars[4] = '/images/community/light_star_4.gif'
preLightStars[5] = '/images/community/light_star_5.gif';

stars = []
lightStars = []
for (var i = 0; i < preStars.length; i++)
stars[i] = new Image()
stars[i].src = preStars[i]
lightStars[i] = new Image()
lightStars[i].src = preLightStars[i]
//console.log(stars[i]+" "+lightStars[i]);              

this.ratingHook()
}
rate: function()
if(/light/.test($("stars").src))
rating = this.className.replace("star_", "")
starImage = lightStars[rating]
$("rating_"+rating).checked = true
$("stars").src = starImage.src

}
resetRate: function()
starImage = lightStars[1]
$("rating_1").checked = true
$("stars").src = starImage.src
}
setRating: function()
obj = this
rating = this.className.replace("star_", "")
starImage = stars[rating]
$("rating_"+rating).checked = true
$("stars").src = starImage.src
resetLink = document.createElement("a")
resetLink.setAttribute("href","")
Event.observe(resetLink, 'click'
function()
starImage = lightStars[1]
$("rating_1").checked = true
$("stars").src = starImage.src
return false

)
resetLink.appendChild(document.createTextNode("Reset Rating"))
if ($("instructions")){ DOM.replaceElement($("instructions")
resetLink);
}
ratingHook: function()
radioButtons = $$("input[name=rating]")
radioButtons.each(function(value){value.hide()})
ratings = $$("#star-rating div")
obj = this

ratings.each(function(value)
Event.observe(value, 'mouseover',obj.rate.bind(value))
})

ratings.each(function(value)
Event.observe(value, 'click', obj.setRating.bind(value))
})
}

--
remon87
jmichae3@yahoo.com - 20 Jun 2008 05:56 GMT
On Jun 19, 11:38 am, remon87 <remon87.3b9...@no-
mx.tabletquestions.com> wrote:
> Hi,
>
[quoted text clipped - 89 lines]
> --
> remon87

see http://www.crockford.com/javascript/inheritance.html
for a description on how javascript "classes" work.  Javascript
doesn't really have classes.  it has prototypal inheritance.
I am not from microsoft.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.