Current location: Hot Scripts Forums » General Web Coding » JavaScript » not working on a php page

not working on a php page

Reply
  #1 (permalink)  
Old 05-22-06, 01:53 PM
pkcidstudio's Avatar
pkcidstudio pkcidstudio is offline
Coding Addict
 
Join Date: Nov 2005
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
not working on a php page

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-22-06, 02:10 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 7,572
Thanks: 5
Thanked 27 Times in 24 Posts
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.

Code:
<script type="text/javascript" src="script.js"></script>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-22-06, 02:57 PM
pkcidstudio's Avatar
pkcidstudio pkcidstudio is offline
Coding Addict
 
Join Date: Nov 2005
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
ya its wierd casue its working on my html page but not on my php page. do you have a alternate script that does the same thing nico?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-22-06, 03:06 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 7,572
Thanks: 5
Thanked 27 Times in 24 Posts
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 05-22-06, 03:27 PM
pkcidstudio's Avatar
pkcidstudio pkcidstudio is offline
Coding Addict
 
Join Date: Nov 2005
Posts: 328
Thanks: 0
Thanked 0 Times in 0 Posts
thankx nico, turned out it was one of my invisible inputs for that form
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a HTML page from PHP fox1999 PHP 4 09-16-05 11:16 AM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
dynamic php page. tehnoobe PHP 4 04-02-04 11:49 AM
question about updating a page or database for an, php and mysql updating mikewooten PHP 1 02-12-04 12:11 AM
php on a html page Bonzo PHP 9 02-06-04 10:40 PM


All times are GMT -5. The time now is 11:16 AM.
vBulletin® Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.