Hi there,
It looks like safari has a problem with innerHTML. I have to change a
dropdown depending on a selection in another dropdown. When I change
the selection in the first dropdown the second apears, then when I
change the selection in the second I can display it. If I try to
repeat this again it's not working anymore. This works fine on several
browsers under Windows. Here is the code:
<select name="listOrder " onchange="chang eList();">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<div id="list">
</div>
<div id="selection" >
</div>
<script>
function changeList(){
var fes = document.forms[0].elements;
var list = '<select name="list" onchange="showS election();">';
if(fes['listOrder'].value == "1"){
list += '<option value="a">a</option>';
list += '<option value="b">b</option>';
list += '<option value="c">c</option>';
}else if(fes('listOrd er').value == "2"){
list += '<option value="d">d</option>';
list += '<option value="e">e</option>';
list += '<option value="f">f</option>';
list += '</select>';
}else{
list += '<option value="x">x</option>';
list += '<option value="y">y</option>';
list += '<option value="z">z</option>';
}
list += '</select>';
document.getEle mentById('list' ).innerHTML = list;
}
function showSelection() {
var fes = document.forms[0].elements;
var selection = fes['list'].value;
document.getEle mentById('selec tion').innerHTM L = selection;
}
</script> 3 2571
Wow!... Did you ever try to change a bulb in your lamp by using the hummer
and the garden scissors? By the approach it's about the same.
<select name="listOrder " onchange="chang eList(this);">
function changeList(myLi st) {
for (var i = 0; myList.options. length; i++) {
myList.options[i].text = myText[i];
myList.options[i].value = myValue[i];
}
// or to add a new option:
var oOption = document.create Element("OPTION ");
oOption.text="N ew text";
oOption.value=" New value";
myList.add(oOpt ion);
}
Hi VK,
I agree your way is more efficient, but it doesn't fix the problem. In
my application I have to hide and display the second dropdown, so I have
to use innerHTML - that's where the problem is.
Thanks
mtz
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
> In my application I have to hide and display the second dropdown, so I
have to use innerHTML - that's where the problem is.
No, you don't!
The only two occasions to semi-understandable use of innerHTML are:
1) a plain rtf(text)-containing <div>
2) a cell content manipulations in the DOM-TOM(IE) cross-browsers solutions
In all other cases you have to use the appropriate DOM methods.
Besides letting you to work "in white gloves", it will insure that all
"model's change" listeners will be accordingly notified (including your
forms).
document.create Element()
Read it, print it out, stick on your screen, use it in your everyday life
someObject.inne rHTML
Simply say "NO"... unless you REALLY have to... :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: KK |
last post by:
Please help!
I am currently experiencing a bug in Safari v125.9.
When I modify the value of form input box and then get the innerHTML
property of the surrounding div object - I am returned the original
form value not the changed value!
Has anyone else encountered this?
Cheers.
|
by: joaopedrogoncalves |
last post by:
Hi,
I want to load an external javascript file, get its results and stick
them inside a <div> block. I also
want to do this in several places on a web page.
This way the browser doesn't have to wait for the external resource to
load to show up the page,
thus giving a perceiving faster load time for the user.
|
by: Jochem Donkers |
last post by:
Hi,
So far I wrote a few little things in javascript, but I got a small
problem with the following code. Apperently, only Apple's Safari is
handling the following code correctly. I took it from a webpage, and
modified it a bit (just the request line). I might have made some basic
mistake there.
My questions is especially concerning th following piece of code. There
seems to be a problem in the line with http.open(). At least if I put
|
by: garthusenet |
last post by:
I have a fairly complicated application written in Javascript+DOM, and
I've run into an odd problem that only shows up in Safari. Basically,
after setting innerHTML of a DIV, the div ends up empty instead of with
the correct content. In fact, the children of the DIV all vanish, and
it becomes impossible to set the contents thereafter.
The much simplified scenario:
<div id='divname'>
hello
|
by: dirt29 |
last post by:
I'm builiding an online insurance application, where people input thier data, and it gives them rates, then lets them apply. I was wondering if someone could take a look and maybe tell me what the issue is?
Here is the url: http://67.62.217.33/test5
You will need to supply a valid zip, as it does a check for areas the insurance is available. You can use 23834
The issue I'm having is on the the next page there, intro-page2.asp, if you...
| |
by: dd |
last post by:
Hi,
I've discovered a scenario where Safari 1.3 (I need to make my stuff
compliant with 1.3+) gets confused about the scope of local variables
WITHIN functions that were created in dynamic script blocks. I've made
this example where function def has a local i variable in a loop, and
it calls function abc which also has a local i variable in a loop. What
happens is that Safari is not respecting the scope and is allowing the
called...
|
by: Tom |
last post by:
I have an oo-type javascript program running perfectly on IE 6.0+, FF
1.5+, and Opera 7+ on Windows 98+, Linux (RH 9, FC 6), and Mac OS X.
4. As usual, the Safari browser is not working correctly, and because
it lacks an internal debugger, I'm completely unable to see what the
problem is.
So I downloaded that "Drosera" debugging program, but I'm finding it
useless for the following reasons:
1) I cannot "Attach" it to Safari 2.0...
|
by: Gretsch |
last post by:
I have modelled my program on the std code below (from http://www.w3schools.com/dom/dom_parser.asp)..
It works in IE & Firefox, but does not work with Safari - nor does Safari issue the alert "Your browser cannot handle this script" !
I've seen elsewhere on this forum that Safari supports HttpRequest, but this is new technology for me. My XML is very simple (only 7 data items).
- Is there a simple way to get the script below to work...
|
by: rosaryshop |
last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php.
As the user makes selections, it updates images of various parts, giving them a preview of the finished item. The preview resides within a div and is simply a series of <br>-separated images. Simple html. The system is working fine with FireFox and Safari, but some MSIE 6 and 7 users are reporting that only the first image is updating and the...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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: 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...
| |