Macintosh don't see javascript?

V

vitay

I have a page where button have the following java code:

onmouseover="style.cursor=\'hand\'; btn_img.src=\''.$img.'\';"
onmouseout="btn_img.src=\''.$img1.'\';" onclick="check();"

and someone (who use Macinthosh with Internet Explorer) tell me that on my
page this button don't work.
Default this button is disabled and when I normally choose some option then
this button is active but
in Mac this button is always not active.
Why?
 
H

Harlan Messinger

vitay said:
I have a page where button have the following java code:

This isn't Java, it's Javascript.
onmouseover="style.cursor=\'hand\'; btn_img.src=\''.$img.'\';"

You don't need to escape the single quotes that delimit the literal
strings in the Javascript because you used double quotes to delimit the
whole attribute. (Even if you do escape them, you have to use an HTML
escape for them, not a Javascript one.) Removing the backslashes
clarifies the existence of a problem:

onmouseover="style.cursor='hand'; btn_img.src=''.$img.'';"

The single quotes *inside* the string being assigned to btn_img.src *do*
need to be escaped:

onmouseover="style.cursor='hand'; btn_img.src='\'.$img.\'';"

I don't see what sense this code makes anyway. If you want the cursor to
turn into a pointer (not "hand"--that's IE-specific), you set the tag's
style attribute (or use a separate stylesheet) from the outset instead
of waiting for a mouseover:

style="cursor: pointer;"

As for the image's src property, even if $img expands into something
else, I don't see how setting the src to

'.http://www.example.com/resource.'

is what you want.
 
V

vitay

This isn't Java, it's Javascript.
Small mistake yes, of course it's javascript
I don't see what sense this code makes anyway. If you want the cursor to
turn into a pointer (not "hand"--that's IE-specific), you set the tag's
style attribute (or use a separate stylesheet) from the outset instead of
waiting for a mouseover:

style="cursor: pointer;"

It means thah I must set style on said:
As for the image's src property, even if $img expands into something else,
I don't see how setting the src to

'.http://www.example.com/resource.'

is what you want.

I don't understand this paragraph but in $img is only name of jpg and
nothing else.
 
H

Harlan Messinger

vitay said:
Small mistake yes, of course it's javascript


It means thah I must set style on <img>?

On whatever element you're trying to set the cursor for.
I don't understand this paragraph but in $img is only name of jpg and
nothing else.

So you want the value of the image's src property to be "something.jpg".
Instead you're making it "'.something.jpg.'".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top