JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
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:
  #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: 7
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
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
var selFont

But you might be missing some code that would have all those var's setup for you.

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: 7
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: 7
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
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 44 m 22 sec
Reputation Power: 0
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: 7
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: 7
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!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

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




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 11 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek