Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
what to do, if I get error `breaking on JScript rumtime error - object expected
nirjari patel
Ranch Hand
Posts: 386
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
what to do, if I get error `breaking on JScript rumtime error - object expected, his is the error I am getting with following code
<html> <head> <style type="text/css"> body { text-align: center; } #all { margin: 0 auto; width: 800px; text-align: left; } </style> <script type="text/javascript"> var s = document.getElementById("menu1"); var ops = s.options[s.selectedIndex].value ; function defaultDisplay(){ document.getElementById('111').style.display = 'none'; document.getElementById('222').style.display = 'none'; document.getElementById('333').style.display = 'none'; } switch(ops){ alert("4"); case("tv"): document.getElementById('111').style.display = 'none'; document.getElementById('222').style.display = 'none'; document.getElementById('333').style.display = 'inline'; break; case("eating"): document.getElementById('111').style.display = 'inline'; document.getElementById('222').style.display = 'none'; document.getElementById('333').style.display = 'none'; break; case("biting"): document.getElementById('111').style.display = 'none'; document.getElementById('222').style.display = 'inline'; document.getElementById('333').style.display = 'none'; break; default: document.getElementById('111').style.display = 'none'; document.getElementById('222').style.display = 'none'; document.getElementById('333').style.display = 'none'; } </script> </head> <body onload="defaultDisplay()"> <div id="all"> <div> </div> <div id="header" stlye="float:left;"> <h3>Following is left image</h3> <img src="C:\Users\Jignesh\Desktop\Pics & Movies\IMG_4606.jpg" ¸width="300" height="200"/> </div> <div style="clear:both"></div> <div> <div id="middle"> <p>Lets see if this image has been aligned to right or not</p> <div style="float:right;"> <h3>Following is Right image</h3> </div> <div style="clear:both"></div> <p><img id="111" style="float:right" src="C:\Users\Jignesh\Desktop\Pics & Movies\IMG_5118.jpg" ¸width="200" height="135" /></p> <p><img id="222" style="float:right" src="C:\Users\Jignesh\Desktop\Pics & Movies\IMG_4729.jpg" ¸width="200" height="135" /></p> <p><img id="333" style="float:right" src="C:\Users\Jignesh\Desktop\Pics & Movies\IMG_4606.jpg" ¸width="200" height="135" /></p> <p> Select image for display on right</p> <select id="menu1" onchange="switch()"> <option value="noimage">Select Image</option> <option value="eating">Vedant eating with Swejal</option> <option value="tv">Vedant watching TV with Dhyey</option> <option value="biting">Vedant Biting Jignesh</option> </select> </div> </div> </div> </body> </html>
Whats wrong with this ?
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Learn to use the JavaScript debugger.
Check that the element exists when you are trying to reference it.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to display info to user after login for some time?
Html glass pane
Show animation during report building
web page printing
Display or not to display other controls
More...