JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Iron Speed
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old June 18th, 2003, 03:42 PM
moojjoo moojjoo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: NC
Posts: 32 moojjoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to moojjoo Send a message via MSN to moojjoo
Question WYSIWYG Editor

Hey can somebody help out to why I am receiving the following JavaScript Error?

'selFont' not defined.

This error on occurs when I go to change the heading size or view the HTML in the editor???

How do you define a variable in JavaScript...
__________________
Moojjoo

Reply With Quote
  #2  
Old June 19th, 2003, 07:50 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
var selFont

But you might be missing some code that would have all those var's setup for you.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old June 23rd, 2003, 08:50 AM
moojjoo moojjoo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: NC
Posts: 32 moojjoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to moojjoo Send a message via MSN to moojjoo
JavaScript Errors cont.

Stumpy thanks for the advice.

I added: var selectFont and now I am getting this error.

'options' is null or not an object

The strange part about this whole thing is when I remove the following from my page I do not get these errors...

<form onSubmit="return ProcessDocument();" name="frmDocument" action="documentPoster.asp" method="post">

My code for this heading change is the following:

<select name="selHeading" onChange="doHead(this.options[this.selectedIndex].value)">
<option value="">-- Heading --</option>
<option value="Heading 1">H1</option>
<option value="Heading 2">H2</option>
<option value="Heading 3">H3</option>
<option value="Heading 4">H4</option>
<option value="Heading 5">H5</option>
<option value="Heading 6">H6</option>
</select>

Script:

function doHead(hType)
{
if(hType != '')
{
var selFont
iView.document.execCommand('formatblock', false, hType);
doFont(selFont.options[selFont.selectedIndex].value);
}
}

Reply With Quote
  #4  
Old June 23rd, 2003, 09:06 AM
moojjoo moojjoo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: NC
Posts: 32 moojjoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to moojjoo Send a message via MSN to moojjoo
Reply

However the heading does change font size...

Reply With Quote
  #5  
Old June 23rd, 2003, 09:18 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
It could be anything - I don't wanna get into it all, cos the code off the site works as is. I'd say you've maybe just made a typo, or left out a chunk of functions or something. Have another crack at it and see how you go.

Reply With Quote
  #6  
Old June 23rd, 2003, 10:08 AM
moojjoo moojjoo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: NC
Posts: 32 moojjoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to moojjoo Send a message via MSN to moojjoo
Code off the Site???

The author of the site did not include the code to the second part of the article, so how can you tell if it works???

Reply With Quote
  #7  
Old June 23rd, 2003, 01:06 PM
moojjoo moojjoo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Location: NC
Posts: 32 moojjoo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via AIM to moojjoo Send a message via MSN to moojjoo
Lightbulb Finally the solution

Stumpy,

Thanks for the motivation.

The code causing the problem was the addition of the form tag.

When adding the Form you have to change your DOM reference in the Javascript...

function doHead(hType)
{
if(hType != '')
{
var selFont = 1
iView.document.execCommand('formatblock', false, hType);
//alert(hType + selFont)
doFont(document.frmDocument.selFont.options[document.frmDocument.selFont.selectedIndex].value);
}
}

function doToggleView()
{
if(viewMode == 1)
{
iHTML = iView.document.body.innerHTML;
iView.document.body.innerText = iHTML;

// Hide all controls
tblCtrls.style.display = 'none';
document.frmDocument.selFont.style.display = 'none';
document.frmDocument.selSize.style.display = 'none';
document.frmDocument.selHeading.style.display = 'none';
iView.focus();

viewMode = 2; // Code
}
else
{
iText = iView.document.body.innerText;
iView.document.body.innerHTML = iText;

// Show all controls
tblCtrls.style.display = 'inline';
document.frmDocument.selFont.style.display = 'inline';
document.frmDocument.selSize.style.display = 'inline';
document.frmDocument.selHeading.style.display = 'inline';
iView.focus();

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > WYSIWYG Editor


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five &quot;checkpoints&quot; for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway