•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 425,973 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,684 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1707 | Replies: 10
![]() |
•
•
Join Date: Mar 2008
Posts: 153
Reputation:
Rep Power: 1
Solved Threads: 19
No, its not correct to state that (look at my dev site again, it is full of page elements "pulled via Ajax" and accessed by javascript). You just wont find the element using getElementById etc.
For example, lets say I have the following form, loaded into the page using Ajax:
On my main page that the Ajax content is loaded into, the following will work in IE but not Firefox and others:
While this will work in all:
HTH
Matti Ressler
Suomedia
For example, lets say I have the following form, loaded into the page using Ajax:
<form name="elemTest" id="elemTest" onsubmit="return checkCheckBoxes();" action=""> <input type="checkbox" name="box_1" value="1">1</p> <input type="checkbox" name="box_2" value="2">2</p> <input type="checkbox" name="box_3" value="3">3</p> <input type="submit" value="Submit" /> </form>
On my main page that the Ajax content is loaded into, the following will work in IE but not Firefox and others:
<SCRIPT TYPE="text/javascript">
<!--
function checkCheckBoxes() {
var dname = document.getElementById('elemtest');
if (dname.box_1.checked == false &&
dname.box_2.checked == false &&
dname.box_3.checked == false)
{
alert ('Please choose one of the checkboxes!');
return false;
}
else
{
return true;
}
}
//-->
</SCRIPT>While this will work in all:
<SCRIPT TYPE="text/javascript">
<!--
function checkCheckBoxes() {
if (document.elemTest.box_1.checked == false &&
document.elemTest.box_2.checked == false &&
document.elemTest.box_3.checked == false)
{
alert ('Please choose one of the checkboxes!');
return false;
}
else
{
return true;
}
}
//-->
</SCRIPT>HTH
Matti Ressler
Suomedia
Last edited by Suomedia : Mar 17th, 2008 at 7:39 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: problem with my radio button validation js
- Next Thread: CSS Brwoserresize Problems (FF+IE)


Linear Mode