Most of these characters are not on the standard keyboard.
Here's a successful contrivance, with comments & cautions,
a little page that works in IE6.
<HTML><HEAD><SC RIPT TYPE="text/javascript">
function alt() {
document.all.s1 .innerHTML="Cur rent Temp: 68°F";
var txt=document.al l.s1.innerText;
alert(txt);
}
</SCRIPT></HEAD>
<BODY>
<INPUT TYPE="button" VALUE="Temperat ure" onClick="alt()" >
<P ID="s1" STYLE="visibili ty:hidden"> </P>
</BODY></HTML>
comments: The innerHTML property is needed to produce the
character glyph from the entity code. If the entity string
were passed to innerText(in 1st statement) then the code
would remain literal.
This work-around depends on s1 being rendered before alt()
is called. It will not work as immediately executed code,
because element s1 would not exist yet.
cautions: Trying to style alert's display will produce error
msgs. Do not use <B>, <U>, or <I> tags in the argument
string. No Heading tags either.
Strange enough, an inline STYLE, setting font values, say,
does not give error msg, but will not execute either.
Alert ignores it.
You can use <BR> tags in the argument, which give the same
result as \n in a direct arg to alert().
In sum, you can tell alert what characters to display,
in what order, and on what line, but you cannot tell
alert HOW to display them.
hugo2, March 4, 2005 4 4021
hugo2 wrote: Most of these characters are not on the standard keyboard. Here's a successful contrivance, with comments & cautions, a little page that works in IE6.
Define "works". It does not "work" for me in IE6 on WinXP SP2.
Before posting code, you should at minimum validate the HTML and test it.
<HTML><HEAD><SC RIPT TYPE="text/javascript"> function alt() { document.all.s1 .innerHTML="Cur rent Temp: 68°F";
IE only.
var txt=document.al l.s1.innerText;
IE only.
alert(txt); }
function oneThatWorks(){
document.getEle mentById('s1'). innerHTML="Curr ent Temp: 68°F";
var txt= document.getEle mentById('s1'). innerHTML;
alert(txt);
}
Now, it is tested to work in IE6, Opera 7 and Mozilla.
</SCRIPT></HEAD> <BODY> <INPUT TYPE="button" VALUE="Temperat ure" onClick="alt()" >
Object does not support this method.
As reported by IE6 when given a strict doctype.
<P ID="s1" STYLE="visibili ty:hidden"> </P> </BODY></HTML>
comments: The innerHTML property is needed to produce the character glyph from the entity code. If the entity string were passed to innerText(in 1st statement) then the code would remain literal. This work-around depends on s1 being rendered before alt() is called. It will not work as immediately executed code, because element s1 would not exist yet.
See above. Reading this groups FAQ will show you how to insert, and
read, text from a div tag in most major browsers without resorting to IE
only code, even though it uses the semi-proprietary (non-standard) innerHTML
cautions: Trying to style alert's display will produce error msgs. Do not use <B>, <U>, or <I> tags in the argument string. No Heading tags either.
Who told you that garbage?
alert('This has a <B>, a <U> and an <I> tag in it, test it!')
Strange enough, an inline STYLE, setting font values, say, does not give error msg, but will not execute either. Alert ignores it.
Thats because you can't "style" an alert. If you want style, write your
own alert div tag in the page.
You can use <BR> tags in the argument, which give the same result as \n in a direct arg to alert().
BULL. Test before you post.
alert('This has a <BR> tag but no line break in the alert, test it!')
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
The easiest way to display characters not on the keyboard is simply:
alert('Current Temp: 68' + String.fromChar Code(176));
Randy Webb wrote: hugo2 wrote:
Most of these characters are not on the standard keyboard. Here's a successful contrivance, with comments & cautions, a little page that works in IE6. Define "works". It does not "work" for me in IE6 on WinXP SP2.
Before posting code, you should at minimum validate the HTML and test
it. <HTML><HEAD><SC RIPT TYPE="text/javascript"> function alt() { document.all.s1 .innerHTML="Cur rent Temp: 68°F"; IE only.
var txt=document.al l.s1.innerText;
IE only.
alert(txt); }
function oneThatWorks(){ document.getEle mentById('s1'). innerHTML="Curr ent Temp: 68°F"; var txt= document.getEle mentById('s1'). innerHTML; alert(txt); }
Now, it is tested to work in IE6, Opera 7 and Mozilla.
</SCRIPT></HEAD> <BODY> <INPUT TYPE="button" VALUE="Temperat ure" onClick="alt()" >
Object does not support this method.
As reported by IE6 when given a strict doctype.
<P ID="s1" STYLE="visibili ty:hidden"> </P> </BODY></HTML>
comments: The innerHTML property is needed to produce the character glyph from the entity code. If the entity string were passed to innerText(in 1st statement) then the code would remain literal. This work-around depends on s1 being rendered before alt() is called. It will not work as immediately executed code, because element s1 would not exist yet.
See above. Reading this groups FAQ will show you how to insert, and read, text from a div tag in most major browsers without resorting to
IE only code, even though it uses the semi-proprietary (non-standard)
innerHTML cautions: Trying to style alert's display will produce error msgs. Do not use <B>, <U>, or <I> tags in the argument string. No Heading tags either. Who told you that garbage?
alert('This has a <B>, a <U> and an <I> tag in it, test it!')
Strange enough, an inline STYLE, setting font values, say, does not give error msg, but will not execute either. Alert ignores it.
Thats because you can't "style" an alert. If you want style, write
your own alert div tag in the page.
You can use <BR> tags in the argument, which give the same result as \n in a direct arg to alert(). BULL. Test before you post.
alert('This has a <BR> tag but no line break in the alert, test it!')
-- Randy comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup
weekly Answer:It destroys the order of the conversation Question: Why? Answer: Top-Posting. Question: Whats the most annoying thing on Usenet?
hugo2 March 7, 2004
My apologies to everyone. The one problem with my post
is the function name: alt(). This one name does not work
(I had use several different names) because *alt* turns
out to be an HTML attribute, a rather obscure one in <IMG>,
but I should have checked!
All the other statements I made were derived from testing,
and they are all true, in the context of passing an HTML
fragment containing non-keyboard glyph to alert().
I was not talking about general use of alert().
If interested parties would change the function name to
at() or atl() or go(), then the page works fine,
though you would have to adapt it for other browsers.
hugo2 --
hugo2 wrote: Randy Webb wrote:
<snip> function oneThatWorks(){ document.getE lementById('s1' ).innerHTML="Cu rrent Temp: 68°F"; var txt= document.getEle mentById('s1'). innerHTML; alert(txt); }
Now, it is tested to work in IE6, Opera 7 and Mozilla.
<snip>
If interested parties would change the function name to at() or atl() or go(), then the page works fine, though you would have to adapt it for other browsers.
No need, I gave one that works (and tested) in IE6, Opera 7 and Mozilla,
so its just a matter of copy/paste. Although mine could stand a little
more feature detection before relying on getElementById and innerHTML
(although there has been no definitive test to ensure that changing an
elements innerHTML property actually changes it's visual appearance).
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joris De Groote |
last post by:
Hi,
I have a 1 dimensional table byte with a number af characters in ASCII code.
How do I convert those ASCII codes to real letters?
Thanks
|
by: many_years_after |
last post by:
Hi,everyone:
Have you any ideas?
Say whatever you know about this.
thanks.
|
by: umdsasha |
last post by:
So, basically, I need to detect whether an alert window was thrown. I
can't find where it's thrown from but I need to disable a button only
if there were no alert windows thrown. Any ideas?
Thanks
Alex
|
by: vandy1285 |
last post by:
Hello friends..
Is it posssbile to change the layout of the default alert window.....as in i want to change the font color,font size,background color of alert window...
is it possible....
|
by: Phil |
last post by:
Hi,
The Alert window appears but the value is "undefined".
I tried two ways
What don't i see here?
Thanks
Phil
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server"><title>Untitled Page</title></head>
| |
by: Phil |
last post by:
Hi,
This code produces an empty Alert window. No error.
How to get the value into the Alert window?
Thanks
Phil
aspx file (content page):
------------------------
|
by: gabrielk43 |
last post by:
My question is this: I use Flex Builder 2 and actionscript 2. Suppose that I have created a simple alert window like that:
var alertWindow:Alert = Alert.Show(message);.
What if I want to close it before user gives an input, let's say 2 seconds after I have opened it? Is there a way to send to this window a CloseEvent? Or do I have to wait
for the user to close it?
Thanks in advance.
|
by: cruzzer |
last post by:
I need to know how can I exclude a data item from the Alert Window’s list message if the user leaves a prompt window blank.
Example :
If the user types a value to both “idnumber” and “department” prompt but leaves the “access” prompt empty or clicks cancel, I want the Alert Message List to look…
LIKE THIS:
ID Number: “value”
...
|
by: yogesh6585 |
last post by:
How can i close alert box automatically without user iteration?
i call the another method but javascript execute code continue and i need to stop the execution for 5 to 10 second, i can not use sleep, wait or setTimeout method because this method also execute some code. like alert stop the process if user press ok button then continue the code execution.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |