Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / November 2003

Tip: Looking for answers? Try searching our database.

Missing tag after .innerHTML replacement

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tobe - 23 Sep 2003 19:40 GMT
Loading the following page should change the displayed
options to:  Elbow & Knee.  But it does not.  The
innerHTML of the SELECT element is:
                Elbow</OPTION><OPTION>Knee</OPTION>
   instead of
<OPTION selected>Elbow</OPTION><OPTION>Knee</OPTION>
it is missing the first tag.  Why?  And how do I get the
expected results?

<html language='javascript'>
<head >
    <script>
        function Load() {
            var element =
document.getElementById("StationType");
            element.innerHTML = "<OPTION
selected>Elbow</OPTION><OPTION>Knee</OPTION>";
            var element1=
document.getElementById("ShowInnerText");
            element1.innerText =
element.innerHTML;
        }
    </script>
</head >
<body onload="Load();" >
    <SELECT id='StationType'>
        <OPTION>Keypad</OPTION>
        <OPTION>Dimmer</OPTION>
    </SELECT>
    <div id='ShowInnerText'></div>
</body>

</html
Alan Corbett \(.NET MVP\) - 21 Oct 2003 23:34 GMT
I've run in to this many times in the past....Sometimes setting the
outerhtml to itself does the trick:

element1.innerHTML = "something";
element1.outerhtml = element1.outerhtml.

Don't ask me why, but it works.

> Loading the following page should change the displayed
> options to:  Elbow & Knee.  But it does not.  The
[quoted text clipped - 29 lines]
>
> </html
name - 07 Nov 2003 08:40 GMT
that is really knee jerking response.

Does it work with outerHTML too?

\\\\\

> I've run in to this many times in the past....Sometimes setting the
> outerhtml to itself does the trick:
[quoted text clipped - 37 lines]
> >
> > </html

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.