?
Solved

Select div not working in safari for Mac.

Posted on 2006-04-02
4
Medium Priority
?
446 Views
Last Modified: 2008-03-17

I have the following:

<select name="country" onChange="javascript:if(this.options[this.selectedIndex].value != 'United Kingdom'){ document.all.warning7.style.display = 'block';}else{document.all.warning7.style.display = 'none';}">
                                          <option>Please select</option>
                          <option value="United Kingdom">United Kingdom</option>
...
</select>

<div id="warning7" style=" display:none;">
my text.
</div>

Which works fine in IE and Firefox etc.. but in Safari for Mac the div tag doesn't apear.
0
Comment
Question by:gabbs1
  • 2
3 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 16354649
try

<select name="country" onChange="javascript:if(this.options[this.selectedIndex].value != 'United Kingdom'){ document.all.warning7.style.display = '';}else{document.all.warning7.style.display = 'none';}">
0
 
LVL 9

Accepted Solution

by:
smaccari earned 500 total points
ID: 16354714
The document.all is IE specific.
You should use document.getElementById instead (that will work even on IE though).

So your SELECT will become :

<select name="country" onChange="javascript:if(this.options[this.selectedIndex].value != 'United Kingdom'){ document.getElementById('warning7').style.display = 'block';}else{document.getElementById('warning7').style.display = 'none';}">
                                          <option>Please select</option>
                      <option value="United Kingdom">United Kingdom</option>
...
</select>
0
 
LVL 33

Expert Comment

by:hongjun
ID: 16354724
smaccari is correct. I miss it
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question