Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

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

[SOLVED] Adding javascript to atahualpa


  #1  
Old May 27, 2011, 04:06 PM
DanDan
 
41 posts · Aug 2010
[SOLVED] Adding javascript to atahualpa

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
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Where exactly did you add it?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old May 27, 2011, 08:46 PM
DanDan
 
41 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
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
what is the error and what is the code?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old May 28, 2011, 08:11 AM
DanDan
 
41 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
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
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)
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

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 10:40 PM.


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