Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
LinkBack Thread Tools Display Modes
Old 03-09-2008, 07:41 AM   #1 (permalink)
Junior Member
 
Join Date: 12-14-07
Posts: 7
iTrader: 0 / 0%
Latest Blog:
None

pipelineae is liked by many
JavaScript - Function is undefined (But I defined it, I swear!)

When I try to run the following code, it claims the ptModCss function is undefined. However, when I remove the code declaring ptHeader, it works perfectly.

The error I get onLoad is:
Code:
missing ; before statement [Break on this error] document.getElementById('pt-ht').innerHTML=a+'Left Sidebar');\n
And the error I get when I mouseOver where the function is supposed to execute:
Code:
ptModCss is not defined onmouseover(mouseover clientX=0, clientY=0)
The code is as follows (Functions declared in the head of the document):
Code:
<script type="text/javascript"> function ptModCss(divId, action, class, old) { if (action=='on') { original=old; document.getElementById(divId).className=class; } else if (action=='off') { document.getElementById(divId).className=original; } else if (action=='edit') { document.getElementById('pt-wrap').className='hidden'; document.getElementById('pt-edit').className='pt-edit'; ptHeader(divId); } else if (action=='placement') { document.getElementById('pt-wrap').className='pt-wrap'; document.getElementById('pt-edit').className='hidden'; } } function ptHeader(divId) { var a='Below are your ad settings for '; if (divId=='sbl1' || divId=='sbl2' || divId=='sbl3' || divId=='sbl4') { document.getElementById('pt-ht').innerHTML=a+'Left Sidebar'); } else if (divId=='sbml1' || divId=='sbml2' || divId=='sbml3' || divId=='sbml4') { document.getElementById('pt-ht').innerHTML=a+'Middle Left Sidebar'; } else if (divId=='sbr1' || divId=='sbr2' || divId=='sbr3' || divId=='sbr4') { document.getElementById('pt-ht').innerHTML=a+'Right Sidebar'; } else if (divId=='sbmr1' || divId=='sbmr2' || divId=='sbmr3' || divId=='sbmr4') { document.getElementById('pt-ht').innerHTML=a+'Middle Right Sidebar'; } else if (divId=='sbmr1' || divId=='sbmr2' || divId=='sbmr3' || divId=='sbmr4') { document.getElementById('pt-ht').innerHTML=a+'Middle Right Sidebar'; } } </script>
Code that calls the function:
Code:
<div class="sbl1" id="sbl1" onMouseOver="ptModCss('sbl1', 'on', 'hovered', 'sbl1');" onMouseOut="ptModCss('sbl1', 'off');" onClick="ptModCss('sbl1', 'edit');">
Any help is greatly appreciated, I'm having a lot of trouble with this, and I'm pulling hair out. I just wish I could find the problem, because I know it's gonna be something simple I can't see because I'm frustrated.
pipelineae is offline  
Add Post to del.icio.us
Reply With Quote
Old 03-09-2008, 08:16 AM   #2 (permalink)
Junior Member
 
Join Date: 12-14-07
Posts: 7
iTrader: 0 / 0%
Latest Blog:
None

pipelineae is liked by many
Nevermind, someone in another forum solved it. Turned out:
Code:
document.getElementById('pt-ht').innerHTML=a+'Left Sidebar';
Needed to be:
Code:
document.getElementById('pt-ht').innerHTML=a+'Left Sidebar<br />';
pipelineae is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum

Reply


Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)
 
Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot assign a function to JavaScript event; o_O. stewart Coding Forum 3 11-22-2007 11:07 AM
Hell Defined nigelaxis Forum Lobby 8 03-20-2007 08:13 AM
JavaScript is evil, I swear Arenlor Coding Forum 6 01-17-2007 01:54 AM
[PHP] Undefined Index?? Izzmo Coding Forum 15 11-19-2006 06:23 AM
Reseller Defined Ashish Reseller Hosting 16 04-11-2005 11:17 AM


Sponsor Links
Get exposure! Contextual Links V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 04:54 PM.
© Copyright 2008 V7 Inc
Powered by vBulletin
Copyright © 2000-2009 Jelsoft Enterprises Limited.


Search Engine Optimization by vBSEO 3.3.0 ©2009, Crawlability, Inc.