any thoughts of why this wouldnt be working in a php page?
Code:
// JavaScript Document
function contractall(){
if (document.getElementById){
var inc=0
while (document.getElementById("hidden"+inc)){
document.getElementById("hidden"+inc).style.display="none"
inc++
}
}
}
function expandone(){
if (document.getElementById){
var selectedItem=document.priceform.priceoption.selectedIndex
contractall()
document.getElementById("hidden"+selectedItem).style.display="block"
}
}
if (window.addEventListener)
window.addEventListener("load", expandone, false)
else if (window.attachEvent)
window.attachEvent("onload", expandone)
it works with a html page but not in my php. am i missing something here?
It should work in both. PHP files are locally the same than HTML files. Only the extension changes. What you could try is to put the script in an extern .js page, and include it like this in your PHP page.
Well, if the script works on your html page than has it to work on your PHP page, unless you're doing something wrong, whatever that might be. There's no need for another script if this one works. If you're using Firefox, then check the javascript console and see if you get any errors there.