Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
|
|
Getelementbyid Doesn't Seem To Work In Ie
This is a discussion on Getelementbyid Doesn't Seem To Work In Ie, within the Javascript section. This forum and the thread "Getelementbyid Doesn't Seem To Work In Ie" are both part of the Programming Your Website category.
![]() ![]() |
Mar 27 2008, 09:08 AM
Post
#1
|
|
![]() Fresh Squeezed ![]() ![]() Posts: 17 Joined: 14-February 08 From: North Devon |
Hey peeps
Hope everyone is ok I have a search form with some example text in one box. When the submit is click some javascript removes the exmaple text if it is still there. However it doesn't work in IE for some reason. I'm sure i've over looked something. Here is the code: CODE <form action="" method="get" onSubmit="java script: keyword = document.getElementById('keyword'); if ( keyword.value == 'e.g. Mirabelle Ring' ) { keyword.value = ''; }"> and this: CODE KEYWORDS: <input type="text" name="keyword" id="keyword" class="searchInput" value="e.g. Mirabelle Ring" onClick="java script:if ( this.value == 'e.g. Mirabelle Ring' ) { this.value = ''; }" /> <div id="searchSubmit"> This is all the code for the page CODE <%includesitetemplate:ecommerce_component_xhtml_head.html%> <script type="text/javascript"> function noMatch() { if (window.location=="http://joots.kameleon-cms.com/0/jewllery/search/") { document.getElementById('no_match').innerHTML = ""; } } </script> <body onload="noMatch();"> <div id="main"> <%includesitetemplate:ecommerce_component_header.html%> <div id="contentSearch"><!-- START page content --> <div id="searchCritera"> <div class="subHeader2">Search by:</div> <div id="searchInputs"> <form action="" method="get" onSubmit="java script: keyword = document.getElementById('keyword'); if ( keyword.value == 'e.g. Mirabelle Ring' ) { keyword.value = ''; }"> Recipient: <select name="tag_recipient" size="1" class="searchSelect"> <option selected value="">All Recipients</option> <%loop|ecommerce:searchtag:recipient|%> <option value="<%value%>" <%if|value|equals:<<form-submitted-values:tag_recipient>>;%>selected="selected"<%endif%>><%value%></option> <%/loop%> </select> Price: <select name="price" id="price" size="1" class="searchSelect"> <option value="">All Prices</option> <option value="<10">less than £10</option> <option value="10-20">between £10 and £20</option> <option value="20-30">between £20 and £30</option> <option value="30-40">between £30 and £40</option> <option value=">40">more than £40</option> </select> Material: <select name="tag_material" size="1" class="searchSelect"> <option selected value="">All Material</option> <%loop|ecommerce:searchtag:material|%> <option value="<%value%>" <%if|value|equals:<<form-submitted-values:tag_material>>;%>selected="selected"<%endif%>><%value%></option> <%/loop%> </select> Gemstone: <select name="tag_gemstone" size="1" class="searchSelect"> <option selected value="">All Gems</option> <%loop|ecommerce:searchtag:gemstone|%> <option value="<%value%>" <%if|value|equals:<<form-submitted-values:tag_gemstone>>;%>selected="selected"<%endif%>><%value%></option> <%/loop%> </select> Designer: <select name="tag_occasion" size="1" class="searchSelect"> <option selected value="">All Designers</option> <%loop|ecommerce:searchtag:occasion|%> <option value="<%value%>" <%if|value|equals:<<form-submitted-values:tag_occasion>>;%>selected="selected"<%endif%>><%value%></option> <%/loop%> </select> KEYWORDS: <input type="text" name="keyword" id="keyword" class="searchInput" value="e.g. Mirabelle Ring" onClick="java script:if ( this.value == 'e.g. Mirabelle Ring' ) { this.value = ''; }" /> <div id="searchSubmit"> <input type="image" value="submitname" src="/images/submit.gif" title="Click here to submit search" alt="Click here to submit search" border="0" > </div> </form> <%page:content%> </div> </div> <%if-card-exists|form-submitted-values:keyword%> <script type="text/javascript"> keyword = document.getElementById("keyword"); keyword.value = "<%form-submitted-values:keyword%>"; </script> <%endif-card-exists%> <%if-card-exists|form-submitted-values:price%> <script type="text/javascript"> price = document.getElementById("price"); for ( x=0; x < price.options.length; x++ ) { if (price.options[x].value == "<%form-submitted-values:price%>" ) { price.options[x].selected = true; break; } } </script> <%endif-card-exists%> <div id="search"> <div class="subHeader2">Search Results</div> <div id="searchBorder"></div> <div id="searchResults"> <%loop|ecommerce:search-results|disable-increment:true;%> <div style="clear:both;"> <%loop|ecommerce:search-results|loop-count:3;%> <div class="searchResultText"> <a href="<%ecommerce:rooturl%>category/<%category-url%>/product/<%url%>/"> <div class="productBorder"><img height="70" class="productimage" src="/assets/ecommerce/<%mainimage-medium-filename%>" alt="product image" /></div> </a> <div> <%name%><br/> <%category-name%> £<%effective-price%> </div> </div> <%/loop%> </div> <%/loop%> <%if|ecommerce:search-results-count|equals:0;%> <div id="no_match">No matches found, please try again</div> <%endif%> </div> </div> </div><!-- END page content --> <%includesitetemplate:ecommerce_component_footer.html%> </div> </body> </html> -------------------- "Extraordinary claims require extraordinary evidence" - Carl Sagan
|
|
|
Mar 27 2008, 03:16 PM
Post
#2
|
|
![]() Squeeze Machine ![]() Posts: 760 Joined: 13-February 08 From: Catching the squeezed drips downunder. |
With your inline statements I think your problem might be that you are using "java script:keyword = etc..."
Try removing the space between java and script "java script:keyword = etc..." you use the space a few times and I don't think this is valid. -------------------- |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
12 | gribble | 554 | 19th February 2008 - 05:49 AM Last post by: welshstew |
|||
![]() |
11 | Jason | 492 | 19th March 2008 - 06:57 PM Last post by: Monie |
|||
![]() |
1 | Jason | 291 | 21st May 2008 - 11:49 AM Last post by: paintingtheweb |
|||
![]() |
1 | Jason | 188 | 26th March 2008 - 08:22 PM Last post by: christopher |
|||
![]() |
4 | Jason | 161 | 7th April 2008 - 03:25 AM Last post by: c010depunkk |
|||






Mar 27 2008, 09:08 AM








