HI,
How can I change a form variable with onClick?
I have a table which shows the results of a ColdFusion query. I need to have a drop down list box showing the other queries that could be sprayed into the table and want to change the variable storing the query to achieve this.
Any ideas would be appreciated!
thanks
Neil
6 5177 Dormilich 8,658
Recognized Expert Moderator Expert
basicly
where select is your drop down box. (if I understand you right)
Does the drop down contain the actual SQL? That sounds injection prone. It doesn't have to be if you're careful, make sure you're not using the sql from the client directly. The drop down should contain ids that reference the queries that are hard coded on the server
hi both,
Thanks for your help. What I have actually done is generated all my tables then just hidden then with some .css, using a javascript function to show the relevant table when the link is used: - <script language="JavaScript">
-
//here you place the ids of every element you want.
-
var ids=new Array('s1','s2','s3','s4','s5','s6','c1','c2','c3','c4','c5','c6');
-
-
function switchid(id){
-
hideallids();
-
showdiv(id);
-
}
-
-
function hideallids(){
-
//loop through the array and hide each element by id
-
for (var i=0;i<ids.length;i++){
-
hidediv(ids[i]);
-
}
-
}
-
-
function hidediv(id) {
-
//safe function to hide an element with a specified id
-
if (document.getElementById) { // DOM3 = IE5, NS6
-
document.getElementById(id).style.display = 'none';
-
}
-
else {
-
if (document.layers) { // Netscape 4
-
document.id.display = 'none';
-
}
-
else { // IE 4
-
document.all.id.style.display = 'none';
-
}
-
}
-
}
-
-
function showdiv(id) {
-
//safe function to show an element with a specified id
-
-
if (document.getElementById) { // DOM3 = IE5, NS6
-
document.getElementById(id).style.display = 'block';
-
}
-
else {
-
if (document.layers) { // Netscape 4
-
document.id.display = 'block';
-
}
-
else { // IE 4
-
document.all.id.style.display = 'block';
-
}
-
}
-
}
-
</script>
Thanks
Neil
Looks like a good solution, but your js code is sooooo 1995. do you really need to support browsers that don't support getElementById?
Also, your script tag shouldn't contain a language attribute, it should be
<script type="text/javascript">
acoder 16,027
Recognized Expert Moderator MVP
Correct. Change hidediv and showdiv to the following: - function hidediv(id) {
-
document.getElementById(id).style.display = 'none';
-
}
-
-
function showdiv(id) {
-
document.getElementById(id).style.display = 'block';
-
}
Thanks - i have changed it and it works fine!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: BigDadyWeaver |
last post by:
I am using the following code in asp to define a unique and
unpredictable record ID in Access.
<%
'GENERATE UNIQUE ID
Function genguid()
Dim Guid
guid =...
|
by: wjbell |
last post by:
I have a piece of javascript I need to modify. Right now it changes a
stylesheet in the document between style.css and no_indent.css. These
are in the head of my document:
<link rel=stylesheet...
|
by: Brandon Hoppe |
last post by:
I'm trying to change the src of an ilayer in the parent document from a link inside the
ilayer. I'm not able to get it to work. All that happens is Netscape 4 crashes. This is
for Netscape 4 only....
|
by: Ian F |
last post by:
I have some javascript which allows a header, iframe and picture to be
changed when the user clicks a next/previous button. In Opera, if you
click next enough times to loop back to the start, or...
|
by: MickG |
last post by:
I am trying to change the value of the variable "hard" according to
which radio button is pressed and I am having no joy. Could anyone
help me with this, the problematic section is marked with...
| |
by: chris |
last post by:
im new to javascript but slowly getting better
what i want to do is have some text on the screen and when an event happens
for example click a button the text would change to what i want.
how...
|
by: celtique |
last post by:
Hello everybody! I've just registered to this forum and yet got a question. :)
I've got some database, that is processed by PHP in a 'while' loop and each element that the loop draws (<li>) gets...
|
by: naurus |
last post by:
I have some code that must change the onclick function of a DIV:
function navChange(id,auto){
check = fetchById(id + "More").style.display;
if(check == "block"){
showLess(id,auto);
}
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |