/    Sign up×
Community /Pin to ProfileBookmark

Parent – Child Forms & Links

HELP!!!

All I want is for the surfer to be able to click on $2.50, $6.50 and so forth to take them to a different link depending on the price. Here is the script…

addOption(“19Kbps”, “Select Number Of Viewers”, “”, “”, 1); //Empty starter option
addList(“19Kbps”, “10”, “car”, “10”);
addList(“19Kbps”, “25”, “suv”, “25”);
addList(“19Kbps”, “50”, “truck”, “50”);
addList(“19Kbps”, “75”, “car”, “75”);
addList(“19Kbps”, “100”, “suv”, “100”);
addList(“19Kbps”, “200”, “truck”, “200”);

addOption(“10”, “$2.50”,1);

addOption(“25”, “$6.50”, “”);

addOption(“50”, “$13.00”, “”);

addOption(“75”, “$19.50”, “”);

addOption(“100”, “$26.00”, “”);

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@samliewOct 26.2007 — I noticed you only posted part of your code. It is not helpful to us because we don't know what the function call does, and how the rest of the page might affect your script (or vice-versa).

You talked about a form. Now where is the HTML code for it? Might as well post your entire page HTML here, or give us a link to it.
Copy linkTweet thisAlerts:
@creativesaltauthorOct 26.2007 — Here is the link to see it:

http://www.creativesalt.com/sleepy/windows_media.html

Here is the html:

<td><select name="make" style="width:200px;">
</select></td>
<td><select name="type" style="width:200px;">
</select></td>
<td><select name="model" size="1" multiple style="width:100px;">
</select></td>
<td><input name="button" type="button" onClick="resetListGroup('vehicles')" value="Reset">


Java:

var _disable_empty_list=false;

var _
hide_empty_list=false;

// ------

if (typeof(disable_empty_list)=="undefined") { disable_empty_list=_disable_empty_list; }

if (typeof(hide_empty_list)=="undefined") { hide_empty_list=_
hide_empty_list; }

var cs_goodContent=true, cs_M="M", cs_L="L", cs_curTop=null, cs_curSub=null;

function cs_findOBJ(obj,n) {

for (var i=0; i<obj.length; i++) {

if (obj[i].name==n) { return obj[i]; }

}

return null;

}

function cs_findContent(n) { return cs_findOBJ(cs_content,n); }



function cs_findM(m,n) {

if (m.name==n) { return m; }



var sm=null;

for (var i=0; i<m.items.length; i++) {

if (m.items[i].type==cs_M) {

sm=cs_findM(m.items[i],n);

if (sm!=null) { break; }

}

}

return sm;

}

function cs_findMenu(n) { return (cs_curSub!=null && cs_curSub.name==n)?cs_curSub:cs_findM(cs_curTop,n); }



function cs_contentOBJ(n,obj){ this.name=n; this.menu=obj; this.lists=new Array(); this.cookie=""; }; cs_content=new Array();

function cs_topmenuOBJ(tm) { this.name=tm; this.items=new Array(); this.df=0; this.addM=cs_addM; this.addL=cs_addL; }

function cs_submenuOBJ(dis,link,sub) {

this.name=sub;

this.type=cs_M; this.dis=dis; this.link=link; this.df=0;



var x=cs_findMenu(sub);

this.items=x==null?new Array():x.items;



this.addM=cs_addM; this.addL=cs_addL;

}

function cs_linkOBJ(dis,link) { this.type=cs_L; this.dis=dis; this.link=link; }



function cs_addM(dis,link,sub) { this.items[this.items.length]=new cs_submenuOBJ(dis,link,sub); }

function cs_addL(dis,link) { this.items[this.items.length]=new cs_linkOBJ(dis,link); }



function cs_showMsg(msg) { window.status=msg; }

function cs_badContent(n) { cs_goodContent=false; cs_showMsg("["+n+"] Not Found."); }



function cs_optionOBJ(text,value) { this.text=text; this.value=value; }

function cs_emptyList(list) { for (var i=list.options.length-1; i>=0; i--) { list.options[i]=null; } }

function cs_refreshList(list,opt,df) {

cs_emptyList(list);



for (var i=0; i<opt.length; i++) {

list.options[i]=new Option(opt[i].text, opt[i].value);

}



if (opt.length>0) {

list.selectedIndex=df;

}

}

function cs_getOptions(menu) {

var opt=new Array();

for (var i=0; i<menu.items.length; i++) {

opt[i]=new cs_optionOBJ(menu.items[i].dis, menu.items[i].link);

}

return opt;

}

function cs_updateListGroup(content,idx,sidx,mode) {

var i=0, curItem=null, menu=content.menu;



while (i<idx) {

menu=menu.items[content.lists[i++].selectedIndex];

}



if (menu.items[sidx].type==cs_M && idx<content.lists.length-1) {

var df=cs_getIdx(mode,content.cookie,idx+1,menu.items[sidx].df);



cs_refreshList(content.lists[idx+1], cs_getOptions(menu.items[sidx]), df);
if (content.cookie) {
cs_setCookie(content.cookie+"_"+(idx+1),df);
}

if (idx+1<content.lists.length) {
if (disable_empty_list) {
content.lists[idx+1].disabled=false;
}
if (hide_empty_list) {
content.lists[idx+1].style.display="";
}

cs_updateListGroup(content,idx+1,df,mode);
}

}

else {

for (var s=idx+1; s<content.lists.length; s++) {

cs_emptyList(content.lists[s]);



if (disable_empty_list) {
content.lists[s].disabled=true;
}
if (hide_empty_list) {
content.lists[s].style.display="none";
}

if (content.cookie) {
cs_setCookie(content.cookie+"_"+s,"");
}
}

}

}

function cs_initListGroup(content,mode) {

var df=cs_getIdx(mode,content.cookie,0,content.menu.df);

cs_refreshList(content.lists[0], cs_getOptions(content.menu), df);

if (content.cookie) {

cs_setCookie(content.cookie+"_"+0,df);

}

cs_updateListGroup(content,0,df,mode);

}

function cs_updateList() {

var content=this.content;

for (var i=0; i<content.lists.length; i++) {

if (content.lists[i]==this) {

if (content.cookie) {

cs_setCookie(content.cookie+"_"+i,this.selectedIndex);

}



if (i<content.lists.length-1) {
cs_updateListGroup(content,i,this.selectedIndex,"");
}
}

}

}

function cs_getIdx(mode,name,idx,df) {

if (mode) {

var cs_idx=cs_getCookie(name+"_"+idx);

if (cs_idx!="") {

df=parseInt(cs_idx);

}

}

return df;

}

function _setCookie(name, value) {

document.cookie=name+"="+value;

}

function cs_setCookie(name, value) {

setTimeout("_
setCookie('"+name+"','"+value+"')",0);

}

function cs_getCookie(name) {

var cookieRE=new RegExp(name+"=([^;]+)");

if (document.cookie.search(cookieRE)!=-1) {

return RegExp.$1;

}

else {

return "";

}

}

// ----

function addListGroup(n,tm) {

if (cs_goodContent) {

cs_curTop=new cs_topmenuOBJ(tm); cs_curSub=null;

var c=cs_findContent(n);
if (c==null) {
cs_content[cs_content.length]=new cs_contentOBJ(n,cs_curTop);
}
else {
delete(c.menu); c.menu=cs_curTop;
}

}

}

function addList(n,dis,link,sub,df) {

if (cs_goodContent) {

cs_curSub=cs_findMenu(n);

if (cs_curSub!=null) {
cs_curSub.addM(dis,link||"",sub);
if (typeof(df)!="undefined") { cs_curSub.df=cs_curSub.items.length-1; }
}
else {
cs_badContent(n);
}

}

}

function addOption(n,dis,link,df) {

if (cs_goodContent) {

cs_curSub=cs_findMenu(n);

if (cs_curSub!=null) {
cs_curSub.addL(dis,link||"");
if (typeof(df)!="undefined") { cs_curSub.df=cs_curSub.items.length-1; }
}
else {
cs_badContent(n);
}

}

}

function initListGroup(n) {

var _content=cs_findContent(n), count=0;

if (_
content!=null) {

content=new cs_contentOBJ("cs_"+n,_content.menu);

cs_content[cs_content.length]=content;

for (var i=1; i<initListGroup.arguments.length; i++) {
if (typeof(arguments[i])=="object" && arguments[i].tagName && arguments[i].tagName=="SELECT") {
content.lists[count]=arguments[i];

arguments[i].onchange=cs_updateList;
arguments[i].content=content; arguments[i].idx=count++;
}
else if (typeof(arguments[i])=="string" && /^[a-zA-Z_]w*$/.test(arguments[i])) {
content.cookie=arguments[i];
}
}

if (content.lists.length>0) {
cs_initListGroup(content,content.cookie);
}

}

}

function resetListGroup(n) {

var content=cs_findContent("cs_"+n);

if (content!=null && content.lists.length>0) {

cs_initListGroup(content,"");

}

}
Copy linkTweet thisAlerts:
@samliewOct 31.2007 — So... what is the criteria for "different link depending on the price"?
Copy linkTweet thisAlerts:
@creativesaltauthorOct 31.2007 — First, they choose a bit rate, which brings up certain choices for number of viewers, hen they choose the number of viewers, which brings up the price for the chosen bit rate and number of users. Then (here is where I am stuck) they click on a "Go" button (or on the price itself) which takes them to a pre-determined URL link somewhere else.
×

Success!

Help @creativesalt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...