Modifying string object not working

O

OccasionalFlyer

I'm trying to overcome limitations in a function by passing a string
object rather than a string primitive. The code to set the string
object's attributes, however, seems to have no effect:
var msg = new String(
'WARNING: Quiting now will cancel all changes up to this point, ' +
'leaving your schedule as it was when you began this session. ' +
'Are you sure you want to quit?'
);
"msg".blink();
"msg".fontsize(7);

if (confirm(msg))
{
document.location.href = '<jsp:getProperty name="req"
property="contextPath"/>/regcontrol?command=SessionDone';
}
else
{
return false;
}

What's wrong? Thanks.

Ken
 
L

Lee

OccasionalFlyer said:
I'm trying to overcome limitations in a function by passing a string
object rather than a string primitive. The code to set the string
object's attributes, however, seems to have no effect:
var msg = new String(
'WARNING: Quiting now will cancel all changes up to this point, ' +
'leaving your schedule as it was when you began this session. ' +
'Are you sure you want to quit?'
);
"msg".blink();
"msg".fontsize(7);

if (confirm(msg))
{
document.location.href = '<jsp:getProperty name="req"
property="contextPath"/>/regcontrol?command=SessionDone';
}
else
{
return false;
}

What's wrong? Thanks.

You didn't read the manual. Or didn't understand what you read.
the blink() and fontsize() methods do not modify the string Object.
It's also a waste of time trying that. All they do is return the
string with the appropriate HTML markup added, and confirm() will
ignore the markup.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top