Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

Wordpress Themes - WP Forum at BFA » Forum Usage » Forum How-To »

[SOLVED] Adding javascript to atahualpa


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old May 27, 2011, 04:06 PM
DanDan
 
20 posts · Aug 2010
I am trying to add rollover buttons in a sidebar widget. The code was generated by image ready and it works fine on the page that was generated. i copied the code into the head and the body tag using the Add HTML/CSS inserts feature but I am getting a javascript error. What could be wrong?

Thanks,

Dan
  #2  
Old May 27, 2011, 08:08 PM
juggledad's Avatar
juggledad
 
22,049 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
Where exactly did you add it?
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #3  
Old May 27, 2011, 08:46 PM
DanDan
 
20 posts · Aug 2010
I added the javascript to the head, added an ONLOAD statement to the body tag and added the rollover buttons to a widget in a sidebar.
  #4  
Old May 28, 2011, 04:22 AM
juggledad's Avatar
juggledad
 
22,049 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
what is the error and what is the code?
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #5  
Old May 28, 2011, 08:11 AM
DanDan
 
20 posts · Aug 2010
This was added to the head:

<SCRIPT LANGUAGE="JavaScript">
<!--

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
social_logos_01_over = newImage("images/social_logos_01-over.jpg");
social_logos_02_over = newImage("images/social_logos_02-over.jpg");
social_logos_03_over = newImage("images/social_logos_03-over.jpg");
social_logos_04_over = newImage("images/social_logos_04-over.jpg");
preloadFlag = true;
}
}

// -->
</SCRIPT>


This was added to the body tag:

ONLOAD="preloadImages();"

This was added to the widget in the sidebar:

<TABLE WIDTH=204 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<TR>
<TD>
<A HREF="#"
ONMOUSEOVER="changeImages('social_logos_01', 'images/social_logos_01-over.jpg'); return true;"
ONMOUSEOUT="changeImages('social_logos_01', 'images/social_logos_01.jpg'); return true;">
<IMG NAME="social_logos_01" SRC="images/social_logos_01.jpg" WIDTH=50 HEIGHT=46 BORDER=0></A></TD>
<TD>
<A HREF="#"
ONMOUSEOVER="changeImages('social_logos_02', 'images/social_logos_02-over.jpg'); return true;"
ONMOUSEOUT="changeImages('social_logos_02', 'images/social_logos_02.jpg'); return true;">
<IMG NAME="social_logos_02" SRC="images/social_logos_02.jpg" WIDTH=50 HEIGHT=46 BORDER=0></A></TD>
<TD>
<A HREF="#"
ONMOUSEOVER="changeImages('social_logos_03', 'images/social_logos_03-over.jpg'); return true;"
ONMOUSEOUT="changeImages('social_logos_03', 'images/social_logos_03.jpg'); return true;">
<IMG NAME="social_logos_03" SRC="images/social_logos_03.jpg" WIDTH=55 HEIGHT=46 BORDER=0></A></TD>
<TD>
<A HREF="#"
ONMOUSEOVER="changeImages('social_logos_04', 'images/social_logos_04-over.jpg'); return true;"
ONMOUSEOUT="changeImages('social_logos_04', 'images/social_logos_04.jpg'); return true;">
<IMG NAME="social_logos_04" SRC="images/social_logos_04.jpg" WIDTH=49 HEIGHT=46 BORDER=0></A></TD>
</TR>
</TABLE>

This was the error:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; EmbeddedWB 14.52 Embedded Web Browser from: http://bsalsa.com/; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C)
Timestamp: Sat, 28 May 2011 14:11:30 UTC


Message: Object expected
Line: 24
Char: 1
Code: 0
URI: http://knottydaughters.com/?cat=5


Message: Object expected
Line: 24
Char: 1
Code: 0
URI: http://knottydaughters.com/?cat=5


Message: Object expected
Line: 24
Char: 1
Code: 0
URI: http://knottydaughters.com/?cat=5


Message: Object expected
Line: 24
Char: 1
Code: 0
URI: http://knottydaughters.com/?cat=5


Message: Object expected
Line: 24
Char: 1
Code: 0
URI: http://knottydaughters.com/?cat=5
  #6  
Old May 28, 2011, 11:45 AM
juggledad's Avatar
juggledad
 
22,049 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
Well, I just dumped that code on my site, copied the images and it works fine in Safari and FireFox on a mac.

(not a good Idea to have a folder 'images' in the wordpress root - move it to the wp-content folder so it won't get wiped out on a wordpress upgrade)
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #7  
Old May 28, 2011, 01:26 PM
DanDan
 
20 posts · Aug 2010
I was trying it on a PC with IE so I tried it on Firefox. No error message but the rollovers don't work. Using IE I get an error as soon as the page loads. See it at http://knottydaughters.com to see it in it's actual environment.
  #8  
Old May 28, 2011, 03:41 PM
juggledad's Avatar
juggledad
 
22,049 posts · Mar 2009
OSX 10.8.5 WP 3.8.x Atahualpa 3.7.x Safari 6.x Firefox 25 XP
I Beleive you are using 367, apply the bugfix's (New Versions & Updates forum) and I think your issue will be resolved.
__________________
If you like my help, please consider donating. I am happy to provide greater detail on this and other topics if you hire me. Please send detailed support requests to me as a private message, thank you.
Juggledad | Forum Moderator/Support
  #9  
Old May 28, 2011, 06:37 PM
DanDan
 
20 posts · Aug 2010
That did it! I added the css.php file and it corrected it in both IE and Firefox.

Thanks!

Dan

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Custom Javascript/jQuery Popup not working in Atahualpa. Factorfiction Page & Category Menu Bars 1 Jan 30, 2011 02:20 PM
Adding a header menubar to Atahualpa theme sfrias Header configuration & styling 3 Oct 25, 2010 02:13 PM
adding javascript with <body> onLoad command bcnuggs Center area post/pages 1 Aug 16, 2010 07:22 AM
Adding Adsense Units in Atahualpa 3.4.1 djrishi Atahualpa 3 Wordpress theme 1 Aug 7, 2009 01:57 PM


All times are GMT -6. The time now is 11:32 PM.


Powered by vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.