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
mouseover not working
Old 04-24-2009, 06:55 PM mouseover not working
Skilled Talker

Posts: 68
Trades: 0
I created a mouseover using dreamweaver, and I want to put the script in an external file. This was the script from the head tag:
<script type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

I created a file named "mouseover.js" and put it in the same directory. I then put a link in my head tag:
<script language="JavaScript" type="text/javascript" src="mouseover.js"></script>

The mouseover is not working. It worked when directly in my head tag. Can anyone offer suggestions. Thanks!
kayla2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-25-2009, 03:55 AM Re: mouseover not working
nayes84's Avatar
Extreme Talker

Latest Blog Post:
Difference between ASP And JSP
Posts: 232
Name: John
Location: Tokyo
Trades: 0
in the script file you shouldn't write script tags
HTML Code:
<script type="text/JavaScript">
...
</script>
make sure javascript code is written directly without those tags
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

if(I'm("Helpful")) Add_Talkupation("nayes84");
nayes84 is offline
Reply With Quote
View Public Profile
 
Old 04-26-2009, 05:05 PM Re: mouseover not working
Skilled Talker

Posts: 68
Trades: 0
Thank you!
Do you know if there is a way to do a "clicked" state. The client wants the initial state, a rollover, and then a "clicked state".
kayla2 is offline
Reply With Quote
View Public Profile
 
Old 04-27-2009, 02:06 PM Re: mouseover not working
moatist's Avatar
Skilled Talker

Posts: 64
Trades: 0
Try using CSS. Using JavaScript exclusively for mouseovers is overkill and isn't always cross-browser compliant.

-Moatist
__________________
Think in code; Dream in digital.

<?php if($helpfull == true){ $talkupation++; } ?>

Last edited by moatist; 04-28-2009 at 04:27 PM.. Reason: -Other was irrelevant
moatist is offline
Reply With Quote
View Public Profile
 
Old 04-27-2009, 03:21 PM Re: mouseover not working
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Using JavaScript for mouseovers?? Hasn't that practice been outdated since the turn of the century? Simple CSS will do you much better, plus it still works if JavaScript is turned off.
__________________
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!
 
Reply     « Reply to mouseover not working
 

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.15148 seconds with 12 queries