Go Back   Web Hosting UK Forums | Linux Windows Dedicated Server and cPanel VPS Hosting Forum > Support > php issues.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2008, 08:44 PM
Senior Member
 
Join Date: Dec 2006
Posts: 544
Send a message via MSN to karimali831
Default Can't use two javascripts at the same time?

Hi,

From a drop down on change it won't work if I use this script twice on one page:

Code:
<script language="JavaScript">
<!--

function goToNextPage()
{
PageIndex=document.form_menu.My_Choice.selectedIndex
if (document.form_menu.My_Choice.options[PageIndex].value != "none")
{
location = document.form_menu.My_Choice.options[PageIndex].value
}
}

-->
</script>
<form name="form_menu">
<p><span style="font-size: 7pt"><font face="Verdana">Theme Selection:-<br>
<font face="Tahoma"><select name="My_Choice" size="1" onchange="goToNextPage()">
<option value="none" selected="selected">Select....</option>
<option value="http://link.com">1</option>
<option value="http://link.com">2</option>
</select></font> </font></span>
E.g. From page

http://team-300.net/templates/2/300....e=themechanger
with the two same scripts, this won't work

When there's one of them, this will work :- http://team-300.net/templates/2/300.php?site=news
Reply With Quote
  #2 (permalink)  
Old 01-21-2008, 09:19 AM
Member
 
Join Date: Nov 2007
Posts: 33
Default

Hi karimali831,

I don't know a great deal about javascript but I think the solution is to change the name of the second script.

e.g.
function goToNextPage()
function goToNextPage1()

Of course, I might just be showing my ignorance of javascript and be miles off the mark.
Reply With Quote
  #3 (permalink)  
Old 01-21-2008, 09:58 AM
new member
 
Join Date: Nov 2007
Posts: 5
Send a message via Skype™ to rwsinter
Default

Surely, you need to send a reference to which <SELECT> object you are referencing:
<select name="My_Choice" size="1" onchange="goToNextPage(this)">
....
function goToNextPage(oSelect)
{
PageIndex=oSelect.selectedIndex

Hope this helps,

Chris
Reply With Quote
  #4 (permalink)  
Old 01-21-2008, 01:24 PM
Senior Member
 
Join Date: Dec 2006
Posts: 544
Send a message via MSN to karimali831
Default

Thanks to you to, I'll try this out when I get back home & I take it you been waiting for the 21st to help me out as I opened this thread a few days ago
Reply With Quote
  #5 (permalink)  
Old 01-30-2008, 02:22 PM
Senior Member
 
Join Date: Dec 2006
Posts: 544
Send a message via MSN to karimali831
Default

All I had to do is change "My_Choice" to something else, using the same of the selected name on the same page won't work.
Reply With Quote
  #6 (permalink)  
Old 02-16-2008, 05:02 AM
Senior Member
 
Join Date: Apr 2006
Location: Norway
Posts: 1,643
Default

Which browser you're working on? I guess it might be due to browser problem.
__________________

Reply With Quote
Reply

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:08 AM.
Copyright 2002-2007 WebHosting.uk.com. All rights reserved.
Web Hosting UK Forum